public void WhenAppIdParamIsSet_ThenAppIdIsSetFromParams() { // Arrange Guid masterAppId = Guid.NewGuid(); WebHealthVaultConfiguration webHealthVaultConfiguration = new WebHealthVaultConfiguration { MasterApplicationId = masterAppId }; Ioc.Container.Configure(c => c.ExportInstance(webHealthVaultConfiguration).As <WebHealthVaultConfiguration>()); Uri uri = new Uri("http://www.bing.com", UriKind.Absolute); // Create a dictionary - we are not setting app id as part of the parameters Dictionary <string, object> parameters = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase) { { "Appid", "test-id" } }; ShellUrlBuilder urlBuilder = new ShellUrlBuilder( shellUri: uri, target: "Action", applicationPath: "/Test", parameters: parameters); // Act urlBuilder.EnsureAppId(); // Assert Assert.AreEqual("test-id", parameters["appid"]); }
public void WhenActionQsAreNotInParams_ThenActionsQsPopulatedFromPathAndQuery() { // Arrange WebHealthVaultConfiguration webHealthVaultConfiguration = new WebHealthVaultConfiguration(); Ioc.Container.Configure(c => c.ExportInstance(webHealthVaultConfiguration).As <WebHealthVaultConfiguration>()); Uri uri = new Uri("http://www.bing.com/redirect.aspx?actionqs=test", UriKind.Absolute); // Create a dictionary - we are not setting app id as part of the parameters Dictionary <string, object> parameters = new Dictionary <string, object>(); ShellUrlBuilder urlBuilder = new ShellUrlBuilder( shellUri: uri, target: "Action", applicationPath: "/Test", parameters: parameters); // Act urlBuilder.EnsureAppQs(); // Assert Assert.AreEqual("/redirect.aspx?actionqs=test", parameters["actionqs"]); }
public void WhenRedirectOverrideNotSetInConfiguration_ThenParamaeterOverrideIsNotSet() { // Arrange WebHealthVaultConfiguration webHealthVaultConfiguration = new WebHealthVaultConfiguration(); Ioc.Container.Configure(c => c.ExportInstance(webHealthVaultConfiguration).As <WebHealthVaultConfiguration>()); Uri uri = new Uri("http://www.bing.com/redirect.aspx?actionqs=test", UriKind.Absolute); // Create a dictionary - we are not setting app id as part of the parameters Dictionary <string, object> parameters = new Dictionary <string, object>(); ShellUrlBuilder urlBuilder = new ShellUrlBuilder( shellUri: uri, target: "Action", applicationPath: "/Test", parameters: parameters); // Act urlBuilder.EnsureRedirect(); // Assert Assert.IsFalse(parameters.ContainsKey("redirect")); }