mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Merge branch 'develop' into master
This commit is contained in:
commit
7aeb06863a
4 changed files with 37 additions and 5 deletions
|
@ -5,10 +5,10 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Moq" Version="4.7.99" />
|
||||
<PackageReference Include="Nunit" Version="3.8.1" />
|
||||
<PackageReference Include="NUnit.ConsoleRunner" Version="3.7.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0" />
|
||||
<PackageReference Include="Moq" Version="4.9.0" />
|
||||
<PackageReference Include="Nunit" Version="3.10.1" />
|
||||
<PackageReference Include="NUnit.ConsoleRunner" Version="3.8.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
|
||||
<packagereference Include="Microsoft.NET.Test.Sdk" Version="15.8.0"></packagereference>
|
||||
</ItemGroup>
|
||||
|
||||
|
|
26
src/Ombi.Core.Tests/StringHelperTests.cs
Normal file
26
src/Ombi.Core.Tests/StringHelperTests.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using NUnit.Framework;
|
||||
using Ombi.Helpers;
|
||||
|
||||
namespace Ombi.Core.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class StringHelperTests
|
||||
{
|
||||
[TestCaseSource(nameof(StripCharsData))]
|
||||
public string StripCharacters(string str, char[] chars)
|
||||
{
|
||||
return str.StripCharacters(chars);
|
||||
}
|
||||
|
||||
private static IEnumerable<TestCaseData> StripCharsData
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return new TestCaseData("this!is^a*string",new []{'!','^','*'}).Returns("thisisastring").SetName("Basic Strip Multipe Chars");
|
||||
yield return new TestCaseData("What is this madness'",new []{'\'','^','*'}).Returns("What is this madness").SetName("Basic Strip Multipe Chars");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -75,5 +75,10 @@ namespace Ombi.Helpers
|
|||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static string StripCharacters(this string str, params char[] chars)
|
||||
{
|
||||
return string.Concat(str.Where(c => !chars.Contains(c)));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -177,7 +177,8 @@ namespace Ombi.Notifications.Agents
|
|||
{
|
||||
try
|
||||
{
|
||||
await Api.PushAsync(settings.AccessToken, model.Message, settings.UserToken, settings.Priority, settings.Sound);
|
||||
//&+' < >
|
||||
await Api.PushAsync(settings.AccessToken, model.Message.StripCharacters('&','+','<','>'), settings.UserToken, settings.Priority, settings.Sound);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue