public void GetValueProvider_ThrowsIfControllerContextIsNull() { // Arrange RouteDataValueProviderFactory factory = new RouteDataValueProviderFactory(); // Act & assert Assert.ThrowsArgumentNull( delegate { factory.GetValueProvider(null); }, "controllerContext"); }
public void GetValueProvider_ThrowsIfControllerContextIsNull() { // Arrange RouteDataValueProviderFactory factory = new RouteDataValueProviderFactory(); // Act & assert Assert.ThrowsArgumentNull( delegate { factory.GetValueProvider(null); }, "controllerContext"); }
public void GetValueProvider_ThrowsIfControllerContextIsNull() { // Arrange RouteDataValueProviderFactory factory = new RouteDataValueProviderFactory(); // Act & assert ExceptionHelper.ExpectArgumentNullException( delegate { factory.GetValueProvider(null); }, "controllerContext"); }
public void GetValueProvider_ThrowsIfControllerContextIsNull() { // Arrange RouteDataValueProviderFactory factory = new RouteDataValueProviderFactory(); // Act & assert ExceptionHelper.ExpectArgumentNullException( delegate { factory.GetValueProvider(null); }, "controllerContext"); }
public void GetValueProvider() { // Arrange RouteDataValueProviderFactory factory = new RouteDataValueProviderFactory(); ControllerContext controllerContext = new ControllerContext(); controllerContext.RouteData = new RouteData(); controllerContext.RouteData.Values["forty-two"] = 42; // Act IValueProvider valueProvider = factory.GetValueProvider(controllerContext); // Assert Assert.AreEqual(typeof(RouteDataValueProvider), valueProvider.GetType()); ValueProviderResult vpResult = valueProvider.GetValue("forty-two"); Assert.IsNotNull(vpResult, "Should have contained a value for key 'forty-two'."); Assert.AreEqual(42, vpResult.RawValue); Assert.AreEqual("42", vpResult.AttemptedValue); Assert.AreEqual(CultureInfo.InvariantCulture, vpResult.Culture); }
public void GetValueProvider() { // Arrange RouteDataValueProviderFactory factory = new RouteDataValueProviderFactory(); ControllerContext controllerContext = new ControllerContext(); controllerContext.RouteData = new RouteData(); controllerContext.RouteData.Values["forty-two"] = 42; // Act IValueProvider valueProvider = factory.GetValueProvider(controllerContext); // Assert Assert.IsType<RouteDataValueProvider>(valueProvider); ValueProviderResult vpResult = valueProvider.GetValue("forty-two"); Assert.NotNull(vpResult); Assert.Equal(42, vpResult.RawValue); Assert.Equal("42", vpResult.AttemptedValue); Assert.Equal(CultureInfo.InvariantCulture, vpResult.Culture); }
public void GetValueProvider() { // Arrange RouteDataValueProviderFactory factory = new RouteDataValueProviderFactory(); ControllerContext controllerContext = new ControllerContext(); controllerContext.RouteData = new RouteData(); controllerContext.RouteData.Values["forty-two"] = 42; // Act IValueProvider valueProvider = factory.GetValueProvider(controllerContext); // Assert Assert.IsType <RouteDataValueProvider>(valueProvider); ValueProviderResult vpResult = valueProvider.GetValue("forty-two"); Assert.NotNull(vpResult); Assert.Equal(42, vpResult.RawValue); Assert.Equal("42", vpResult.AttemptedValue); Assert.Equal(CultureInfo.InvariantCulture, vpResult.Culture); }
public void GetValueProvider() { // Arrange RouteDataValueProviderFactory factory = new RouteDataValueProviderFactory(); ControllerContext controllerContext = new ControllerContext(); controllerContext.RouteData = new RouteData(); controllerContext.RouteData.Values["forty-two"] = 42; // Act IValueProvider valueProvider = factory.GetValueProvider(controllerContext); // Assert Assert.AreEqual(typeof(RouteDataValueProvider), valueProvider.GetType()); ValueProviderResult vpResult = valueProvider.GetValue("forty-two"); Assert.IsNotNull(vpResult, "Should have contained a value for key 'forty-two'."); Assert.AreEqual(42, vpResult.RawValue); Assert.AreEqual("42", vpResult.AttemptedValue); Assert.AreEqual(CultureInfo.InvariantCulture, vpResult.Culture); }