public void ShouldNotMapIgnoredAttributeWhenRegistered() { var expectedModel = new TestModel { Id = 42, Ignored = "Anything at all" }; RouteAssert.AddIgnoreAttribute(typeof(IgnoreMeAttribute)); config.ShouldMap("/api/withignoredattribute/42").To<WithIgnoredAttributeController>( HttpMethod.Get, x => x.Get(expectedModel)); }
public void ShouldFailOnIgnoredAttributeWhichIsNotRegistered() { var expectedModel = new TestModel { Id = 42, Ignored = "Failed value" }; var testEngine = new FakeAssertEngine(); RouteAssert.UseAssertEngine(testEngine); RouteAssert.ClearIgnoreAttributes(); config.ShouldMap("/api/withignoredattribute/42").To<WithIgnoredAttributeController>( HttpMethod.Get, x => x.Get(expectedModel)); Assert.That(testEngine.FailCount, Is.EqualTo(1)); Assert.That(testEngine.Messages[0], Is.EqualTo("Expected 'Failed value', got missing value for 'Ignored' at url '/api/withignoredattribute/42'.")); }
public HttpResponseMessage Get(TestModel model) { return new HttpResponseMessage(); }