public void TestShortenCaseSensitive() { RouteRegistrationService service = new RouteRegistrationService(mockConfigurationManager.Object); Assert.IsTrue(service.shorten("Participantregistration") == "Prt"); Assert.IsTrue(service.usedShortValues.Contains("Prt")); Assert.IsTrue(service.shorten("partICIPAntregiSTratiON") == "Prt"); Assert.IsTrue(service.usedShortValues.Contains("Prt")); Assert.IsTrue(service.shortenedNames.ContainsKey("ParticipantRegistration")); }
public void TestShortenSimilarNames() { RouteRegistrationService service = new RouteRegistrationService(mockConfigurationManager.Object); Assert.IsTrue(service.shorten("Participantregistration") == "Prt"); Assert.IsTrue(service.usedShortValues.Contains("Prt")); Assert.IsTrue(string.Equals(service.shorten("partICIPAntregiSTratiONing"), "Prt0", StringComparison.OrdinalIgnoreCase)); Assert.IsTrue(service.usedShortValues.Contains("Prt0")); Assert.IsTrue(service.shortenedNames.ContainsKey("partICIPAntregiSTratiONing")); }
public void TestMapRoute() { RouteTable.Routes.Clear(); RouteRegistrationService service = new RouteRegistrationService(mockConfigurationManager.Object); AreaRegistrationContext context = new AreaRegistrationContext("test", RouteTable.Routes); service.MapRoute(context, "Example_ParticipantRegistration", "ParticipantRegistration/{controller}/History/{jobseekerId}/{contractId}", new { jobseekerId = UrlParameter.Optional, contractId = UrlParameter.Optional, action = "History", area = "Example" }); Assert.IsTrue(service.routes.Count == 1); Assert.IsTrue(service.usedShortValues.Contains("Prt")); Assert.IsTrue(service.shortenedNames.ContainsKey("ParticipantRegistration")); }
public void TestMapRouteSimilarNames() { RouteTable.Routes.Clear(); RouteRegistrationService service = new RouteRegistrationService(mockConfigurationManager.Object); int hardcodedRenames = service.shortenedNames.Count; AreaRegistrationContext context = new AreaRegistrationContext("test", RouteTable.Routes); service.MapRoute(context, "Example_ParticipantRegistration", "ParticipantRegistration/{controller}/History/{jobseekerId}/{contractId}", new { jobseekerId = UrlParameter.Optional, contractId = UrlParameter.Optional, action = "History", area = "Example" }); Assert.IsTrue(service.usedShortValues.Contains("Prt")); Assert.IsTrue(service.shortenedNames.ContainsKey("ParticipantRegistration")); service.MapRoute(context, "Example_partICIPAntregiSTratiONing_2", "partICIPAntregiSTratiONing/{controller}/Testing/{jobseekerId}/{contractId}", new { jobseekerId = UrlParameter.Optional, contractId = UrlParameter.Optional, action = "History", area = "Testing" }); Assert.IsTrue(service.usedShortValues.Contains("Prt0")); Assert.IsTrue(service.shortenedNames.ContainsKey("partICIPAntregiSTratiONing")); Assert.IsTrue(service.shortenedNames.Count == 2 + hardcodedRenames); Assert.IsTrue(service.routes.Count == 2); }
public void TestShortenArgumentEmpty() { RouteRegistrationService service = new RouteRegistrationService(mockConfigurationManager.Object); service.shorten(""); }