public void SetDefaults_ReturnsOriginalRoute() { Route route = new Route("{language}/{year}", new Mock<IRouteHandler>().Object); Assert.That(route.SetDefaults(language => "en-US", year => 2014), Is.SameAs(route)); }
public void SetDefaults_DefaultsWasNull_SetDefaults() { Route route = new Route("{language}/{year}", new Mock<IRouteHandler>().Object); route.Defaults = null; Assert.That(route.Defaults, Is.Null); route.SetDefaults(language => "en-US", year => 2014); Assert.That(route.Defaults, Is.Not.Null); Assert.That(route.Defaults.Count, Is.EqualTo(2)); Assert.That(route.Defaults.ContainsKey("language")); Assert.That(route.Defaults.ContainsKey("year")); Assert.That(route.Defaults["language"], Is.EqualTo("en-US")); Assert.That(route.Defaults["year"], Is.EqualTo(2014)); }
public void SetDefaults_OverwritesExistingDefaultValue() { Route route = new Route("{language}/{year}", new Mock<IRouteHandler>().Object); route.Defaults = new RouteValueDictionary { { "language", "hr-HR" }, { "year", 2000} }; Assert.That(route.Defaults["language"], Is.EqualTo("hr-HR")); Assert.That(route.Defaults["year"], Is.EqualTo(2000)); route.SetDefaults(language => "en-US", year => 2014); Assert.That(route.Defaults.Count, Is.EqualTo(2)); Assert.That(route.Defaults.ContainsKey("language")); Assert.That(route.Defaults.ContainsKey("year")); Assert.That(route.Defaults["language"], Is.EqualTo("en-US")); Assert.That(route.Defaults["year"], Is.EqualTo(2014)); }
public void SetDefaults_CanBeChained() { Route route = new Route("{language}/{year}", new Mock<IRouteHandler>().Object); route.SetDefaults(language => "en-US").SetDefaults(year => 2014); Assert.That(route.Defaults["language"], Is.EqualTo("en-US")); Assert.That(route.Defaults["year"], Is.EqualTo(2014)); }