diff --git a/PlexRequests.Helpers.Tests/PasswordHasherTests.cs b/PlexRequests.Helpers.Tests/PasswordHasherTests.cs index 500d07534..2ac54a547 100644 --- a/PlexRequests.Helpers.Tests/PasswordHasherTests.cs +++ b/PlexRequests.Helpers.Tests/PasswordHasherTests.cs @@ -24,7 +24,6 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // ************************************************************************/ #endregion -using System.Diagnostics; using NUnit.Framework; @@ -41,7 +40,7 @@ namespace PlexRequests.Helpers.Tests var hash = PasswordHasher.ComputeHash(password, salt); Assert.That(hash, Is.Not.EqualTo(password)); - + var match = PasswordHasher.VerifyPassword(password, salt, hash); Assert.That(match, Is.True); diff --git a/PlexRequests.Helpers.Tests/PlexRequests.Helpers.Tests.csproj b/PlexRequests.Helpers.Tests/PlexRequests.Helpers.Tests.csproj index bb9e7143b..9f3adbd0d 100644 --- a/PlexRequests.Helpers.Tests/PlexRequests.Helpers.Tests.csproj +++ b/PlexRequests.Helpers.Tests/PlexRequests.Helpers.Tests.csproj @@ -8,7 +8,7 @@ Properties PlexRequests.Helpers.Tests PlexRequests.Helpers.Tests - v4.6 + v4.5 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10.0 @@ -16,6 +16,7 @@ $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages False UnitTest + true diff --git a/PlexRequests.Helpers.Tests/UriHelperTests.cs b/PlexRequests.Helpers.Tests/UriHelperTests.cs index 93fb32997..cc748f95c 100644 --- a/PlexRequests.Helpers.Tests/UriHelperTests.cs +++ b/PlexRequests.Helpers.Tests/UriHelperTests.cs @@ -26,7 +26,8 @@ #endregion using System; -using System.Linq.Expressions; +using System.Collections.Generic; + using NUnit.Framework; namespace PlexRequests.Helpers.Tests @@ -35,11 +36,9 @@ namespace PlexRequests.Helpers.Tests public class UriHelperTests { [TestCaseSource(nameof(UriData))] - public void CreateUri1(string uri, Uri expected) + public Uri CreateUri1(string uri) { - var result = uri.ReturnUri(); - - Assert.That(result, Is.EqualTo(expected)); + return uri.ReturnUri(); } [Test] @@ -52,54 +51,58 @@ namespace PlexRequests.Helpers.Tests } [TestCaseSource(nameof(UriDataWithPort))] - public void CreateUri2(string uri, int port, Uri expected) + public Uri CreateUri2(string uri, int port) { - var result = uri.ReturnUri(port); - - Assert.That(result, Is.EqualTo(expected)); + return uri.ReturnUri(port); } [TestCaseSource(nameof(UriDataWithSubDir))] - public void CreateUriWithSubDir(string uri, int port, bool ssl, string subDir, Uri expected) + public Uri CreateUriWithSubDir(string uri, int port, bool ssl, string subDir) { - var result = uri.ReturnUriWithSubDir(port, ssl, subDir); - - Assert.That(result, Is.EqualTo(expected)); + return uri.ReturnUriWithSubDir(port, ssl, subDir); } - static readonly object[] UriData = + private static IEnumerable UriData { - new object[] { "google.com", new Uri("http://google.com/"), }, - new object[] { "http://google.com", new Uri("http://google.com/"), }, - new object[] { "https://google.com", new Uri("https://google.com/"), }, - new object[] { "192.168.1.1", new Uri("http://192.168.1.1")}, - new object[] { "0.0.0.0:5533", new Uri("http://0.0.0.0:5533")}, - new object[] {"www.google.com", new Uri("http://www.google.com/")}, - new object[] {"http://www.google.com/", new Uri("http://www.google.com/") }, - new object[] {"https://www.google.com", new Uri("https://www.google.com/") }, - new object[] {"www.google.com:443", new Uri("http://www.google.com:443/") }, - new object[] {"https://www.google.com:443", new Uri("https://www.google.com:443/") }, - new object[] {"http://www.google.com:443/id=2", new Uri("http://www.google.com:443/id=2") }, - new object[] {"www.google.com:4438/id=22", new Uri("http://www.google.com:4438/id=22") } - }; + get + { + yield return new TestCaseData("google.com").Returns(new Uri("http://google.com/")); + yield return new TestCaseData("http://google.com").Returns(new Uri("http://google.com/")); + yield return new TestCaseData("https://google.com").Returns(new Uri("https://google.com/")); + yield return new TestCaseData("192.168.1.1").Returns(new Uri("http://192.168.1.1")); + yield return new TestCaseData("0.0.0.0:5533").Returns(new Uri("http://0.0.0.0:5533")); + yield return new TestCaseData("www.google.com").Returns(new Uri("http://www.google.com/")); + yield return new TestCaseData("http://www.google.com/").Returns(new Uri("http://www.google.com/")); + yield return new TestCaseData("https://www.google.com").Returns(new Uri("https://www.google.com/")); + yield return new TestCaseData("www.google.com:443").Returns(new Uri("http://www.google.com:443/")); + yield return new TestCaseData("https://www.google.com:443").Returns(new Uri("https://www.google.com/")); + yield return new TestCaseData("http://www.google.com:443/id=2").Returns(new Uri("http://www.google.com:443/id=2")); + yield return new TestCaseData("www.google.com:4438/id=22").Returns(new Uri("http://www.google.com:4438/id=22")); + } + } - static readonly object[] UriDataWithPort = + private static IEnumerable UriDataWithPort { - new object[] {"www.google.com", 80, new Uri("http://www.google.com:80/"), }, - new object[] {"www.google.com", 443, new Uri("http://www.google.com:443/") }, - new object[] {"http://www.google.com", 443, new Uri("http://www.google.com:443/") }, - new object[] {"https://www.google.com", 443, new Uri("https://www.google.com:443/") }, - new object[] {"http://www.google.com/id=2", 443, new Uri("http://www.google.com:443/id=2") }, - new object[] {"http://www.google.com/id=2", 443, new Uri("http://www.google.com:443/id=2") }, - new object[] {"https://www.google.com/id=2", 443, new Uri("https://www.google.com:443/id=2") }, - }; + get + { + yield return new TestCaseData("www.google.com", 80).Returns(new Uri("http://www.google.com:80/")); + yield return new TestCaseData("www.google.com", 443).Returns(new Uri("http://www.google.com:443/")); + yield return new TestCaseData("http://www.google.com", 443).Returns(new Uri("http://www.google.com:443/")); + yield return new TestCaseData("https://www.google.com", 443).Returns(new Uri("https://www.google.com:443/")); + yield return new TestCaseData("http://www.google.com/id=2", 443).Returns(new Uri("http://www.google.com:443/id=2")); + yield return new TestCaseData("https://www.google.com/id=2", 443).Returns(new Uri("https://www.google.com:443/id=2")); + } + } - static readonly object[] UriDataWithSubDir = -{ - new object[] {"www.google.com", 80, false,"test", new Uri("http://www.google.com:80/test"), }, - new object[] {"www.google.com", 443, false,"test", new Uri("http://www.google.com:443/test") }, - new object[] {"http://www.google.com", 443, true,"test", new Uri("https://www.google.com:443/test") }, - new object[] {"https://www.google.com", 443,true,"test", new Uri("https://www.google.com:443/test") }, - }; + private static IEnumerable UriDataWithSubDir + { + get + { + yield return new TestCaseData("www.google.com", 80, false, "test").Returns(new Uri("http://www.google.com:80/test")); + yield return new TestCaseData("www.google.com", 443, false, "test").Returns(new Uri("http://www.google.com:443/test")); + yield return new TestCaseData("http://www.google.com", 443, true, "test").Returns(new Uri("https://www.google.com:443/test")); + yield return new TestCaseData("https://www.google.com", 443, true, "test").Returns(new Uri("https://www.google.com:443/test")); + } + } } } \ No newline at end of file diff --git a/PlexRequests.Helpers.Tests/app.config b/PlexRequests.Helpers.Tests/app.config index 6a9f5188b..1911601e2 100644 --- a/PlexRequests.Helpers.Tests/app.config +++ b/PlexRequests.Helpers.Tests/app.config @@ -1,15 +1,15 @@ - + - - + + - - + + - \ No newline at end of file + diff --git a/PlexRequests.sln b/PlexRequests.sln index 77eb7e978..93ac3b1f4 100644 --- a/PlexRequests.sln +++ b/PlexRequests.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 +# Visual Studio 14 VisualStudioVersion = 14.0.25123.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlexRequests.UI", "PlexRequests.UI\PlexRequests.UI.csproj", "{68F5F5F3-B8BB-4911-875F-6F00AAE04EA6}" @@ -35,20 +35,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlexRequests.Services.Tests EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlexRequests.Updater", "PlexRequests.Updater\PlexRequests.Updater.csproj", "{EBE6FC1C-7B4B-47E9-AF54-0EE0604A2BE5}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlexRequests.Helpers.Tests", "PlexRequests.Helpers.Tests\PlexRequests.Helpers.Tests.csproj", "{0E6395D3-B074-49E8-898D-0EB99E507E0E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1252336D-42A3-482A-804C-836E60173DFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1252336D-42A3-482A-804C-836E60173DFA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1252336D-42A3-482A-804C-836E60173DFA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1252336D-42A3-482A-804C-836E60173DFA}.Release|Any CPU.Build.0 = Release|Any CPU - {566EFA49-68F8-4716-9693-A6B3F2624DEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {566EFA49-68F8-4716-9693-A6B3F2624DEA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {566EFA49-68F8-4716-9693-A6B3F2624DEA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {566EFA49-68F8-4716-9693-A6B3F2624DEA}.Release|Any CPU.Build.0 = Release|Any CPU {68F5F5F3-B8BB-4911-875F-6F00AAE04EA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {68F5F5F3-B8BB-4911-875F-6F00AAE04EA6}.Debug|Any CPU.Build.0 = Debug|Any CPU {68F5F5F3-B8BB-4911-875F-6F00AAE04EA6}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -57,26 +51,38 @@ Global {8CB8D235-2674-442D-9C6A-35FCAEEB160D}.Debug|Any CPU.Build.0 = Debug|Any CPU {8CB8D235-2674-442D-9C6A-35FCAEEB160D}.Release|Any CPU.ActiveCfg = Release|Any CPU {8CB8D235-2674-442D-9C6A-35FCAEEB160D}.Release|Any CPU.Build.0 = Release|Any CPU - {92433867-2B7B-477B-A566-96C382427525}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {92433867-2B7B-477B-A566-96C382427525}.Debug|Any CPU.Build.0 = Debug|Any CPU - {92433867-2B7B-477B-A566-96C382427525}.Release|Any CPU.ActiveCfg = Release|Any CPU - {92433867-2B7B-477B-A566-96C382427525}.Release|Any CPU.Build.0 = Release|Any CPU {95834072-A675-415D-AA8F-877C91623810}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {95834072-A675-415D-AA8F-877C91623810}.Debug|Any CPU.Build.0 = Debug|Any CPU {95834072-A675-415D-AA8F-877C91623810}.Release|Any CPU.ActiveCfg = Release|Any CPU {95834072-A675-415D-AA8F-877C91623810}.Release|Any CPU.Build.0 = Release|Any CPU + {DD7DC444-D3BF-4027-8AB9-EFC71F5EC581}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD7DC444-D3BF-4027-8AB9-EFC71F5EC581}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD7DC444-D3BF-4027-8AB9-EFC71F5EC581}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD7DC444-D3BF-4027-8AB9-EFC71F5EC581}.Release|Any CPU.Build.0 = Release|Any CPU + {92433867-2B7B-477B-A566-96C382427525}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {92433867-2B7B-477B-A566-96C382427525}.Debug|Any CPU.Build.0 = Debug|Any CPU + {92433867-2B7B-477B-A566-96C382427525}.Release|Any CPU.ActiveCfg = Release|Any CPU + {92433867-2B7B-477B-A566-96C382427525}.Release|Any CPU.Build.0 = Release|Any CPU + {1252336D-42A3-482A-804C-836E60173DFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1252336D-42A3-482A-804C-836E60173DFA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1252336D-42A3-482A-804C-836E60173DFA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1252336D-42A3-482A-804C-836E60173DFA}.Release|Any CPU.Build.0 = Release|Any CPU {A930E2CF-79E2-45F9-B06A-9A719A254CE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A930E2CF-79E2-45F9-B06A-9A719A254CE4}.Debug|Any CPU.Build.0 = Debug|Any CPU {A930E2CF-79E2-45F9-B06A-9A719A254CE4}.Release|Any CPU.ActiveCfg = Release|Any CPU {A930E2CF-79E2-45F9-B06A-9A719A254CE4}.Release|Any CPU.Build.0 = Release|Any CPU + {FCFECD5D-47F6-454D-8692-E27A921BE655}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FCFECD5D-47F6-454D-8692-E27A921BE655}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FCFECD5D-47F6-454D-8692-E27A921BE655}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FCFECD5D-47F6-454D-8692-E27A921BE655}.Release|Any CPU.Build.0 = Release|Any CPU + {566EFA49-68F8-4716-9693-A6B3F2624DEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {566EFA49-68F8-4716-9693-A6B3F2624DEA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {566EFA49-68F8-4716-9693-A6B3F2624DEA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {566EFA49-68F8-4716-9693-A6B3F2624DEA}.Release|Any CPU.Build.0 = Release|Any CPU {CB37A5F8-6DFC-4554-99D3-A42B502E4591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CB37A5F8-6DFC-4554-99D3-A42B502E4591}.Debug|Any CPU.Build.0 = Debug|Any CPU {CB37A5F8-6DFC-4554-99D3-A42B502E4591}.Release|Any CPU.ActiveCfg = Release|Any CPU {CB37A5F8-6DFC-4554-99D3-A42B502E4591}.Release|Any CPU.Build.0 = Release|Any CPU - {DD7DC444-D3BF-4027-8AB9-EFC71F5EC581}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DD7DC444-D3BF-4027-8AB9-EFC71F5EC581}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DD7DC444-D3BF-4027-8AB9-EFC71F5EC581}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DD7DC444-D3BF-4027-8AB9-EFC71F5EC581}.Release|Any CPU.Build.0 = Release|Any CPU {EAADB4AC-064F-4D3A-AFF9-64A33131A9A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EAADB4AC-064F-4D3A-AFF9-64A33131A9A7}.Debug|Any CPU.Build.0 = Debug|Any CPU {EAADB4AC-064F-4D3A-AFF9-64A33131A9A7}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -85,12 +91,10 @@ Global {EBE6FC1C-7B4B-47E9-AF54-0EE0604A2BE5}.Debug|Any CPU.Build.0 = Debug|Any CPU {EBE6FC1C-7B4B-47E9-AF54-0EE0604A2BE5}.Release|Any CPU.ActiveCfg = Release|Any CPU {EBE6FC1C-7B4B-47E9-AF54-0EE0604A2BE5}.Release|Any CPU.Build.0 = Release|Any CPU - {FCFECD5D-47F6-454D-8692-E27A921BE655}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FCFECD5D-47F6-454D-8692-E27A921BE655}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FCFECD5D-47F6-454D-8692-E27A921BE655}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FCFECD5D-47F6-454D-8692-E27A921BE655}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(NestedProjects) = preSolution + {0E6395D3-B074-49E8-898D-0EB99E507E0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0E6395D3-B074-49E8-898D-0EB99E507E0E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0E6395D3-B074-49E8-898D-0EB99E507E0E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0E6395D3-B074-49E8-898D-0EB99E507E0E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE