public async Task Put_Throws_ExtraMembers()
        {
            TestEntity entity      = CreateTestEntity();
            string     stringValue = entity.StringValue;
            int        intValue    = entity.IntValue;

            // create a new entity to update
            using (HttpResponseMessage postResponse = await this.testClient.PostAsJsonAsync(Address, entity))
            {
                Assert.Equal(HttpStatusCode.Created, postResponse.StatusCode);
                entity = await postResponse.Content.ReadAsAsync <TestEntity>();
            }

            var patchEntity = new TestInvalidEntity
            {
                Id              = entity.Id,
                StringValue     = "Hello",
                UnknownProperty = "Value"
            };

            var location = new Uri(this.testClient.BaseAddress, Address + "/" + entity.Id);
            HttpRequestMessage putRequest = new HttpRequestMessage
            {
                RequestUri = location,
                Method     = new HttpMethod("PUT"),
                Content    = (HttpContent) new ObjectContent <TestInvalidEntity>(patchEntity, this.config.Formatters.JsonFormatter)
            };

            using (HttpResponseMessage putResponse = await this.testClient.SendAsync(putRequest))
            {
                Assert.Equal(HttpStatusCode.BadRequest, putResponse.StatusCode);
            }
        }
        public void Validate_business_entitys_Id_property_with_mocked_validation_rule_should_be_invalid_and_new_validation_error_should_be_added_to_the_entity()
        {
            var entity = new TestInvalidEntity();

            Assert.IsFalse(entity.ValidatePropertyByName("Id"));
            Assert.IsTrue(entity.ValidationErrors.Count > 0);
        }
        public async Task Post_Throws_ExtraMembers()
        {
            var entity = new TestInvalidEntity
            {
                StringValue     = "Hello",
                UnknownProperty = "Value"
            };

            // Post a new entity and verify entity returned
            using (HttpResponseMessage postResponse = await this.testClient.PostAsJsonAsync(Address, entity))
            {
                Assert.Equal(HttpStatusCode.BadRequest, postResponse.StatusCode);
            }
        }