public void MappingTester_should_throw_for_incorrectly_mapped_collection() { var brokenMappings = new TestMappingSource(); //Remove the customer.Orders mapping. var customerMapping = brokenMappings.OfType<Mapping<Customer>>().Cast<IMapping>().Single(); customerMapping.Mappings.RemoveAt(2); DataContextFactory = () => new TestDataContext(brokenMappings); Assert.Throws<MappingException>(() => { using (var test = Verify<Customer>()) { test.TestCollection(x => x.Orders, new Order() { OrderDate = DateTime.Now }); } }); }
public void MappingTester_should_throw_for_incorrectly_mapped_proprty() { var brokenMappings = new TestMappingSource(); //Remove the Customer.Name mapping. var customerMapping= brokenMappings.OfType<Mapping<Customer>>().Cast<IMapping>().Single(); customerMapping.Mappings.RemoveAt(1); DataContextFactory = () => new TestDataContext(brokenMappings); Assert.Throws<MappingException>(() => { using (var test = Verify<Customer>()) { test.TestProperty(x => x.Name, "Jeremy"); } }); }
public void MappingTester_should_throw_for_incorrectly_mapped_proprty() { var brokenMappings = new TestMappingSource(); //Remove the Customer.Name mapping. var customerMapping = brokenMappings.OfType <Mapping <Customer> >().Cast <IMapping>().Single(); customerMapping.Mappings.RemoveAt(1); DataContextFactory = () => new TestDataContext(brokenMappings); Assert.Throws <MappingException>(() => { using (var test = Verify <Customer>()) { test.TestProperty(x => x.Name, "Jeremy"); } }); }
public void MappingTester_should_throw_for_incorrectly_mapped_collection() { var brokenMappings = new TestMappingSource(); //Remove the customer.Orders mapping. var customerMapping = brokenMappings.OfType <Mapping <Customer> >().Cast <IMapping>().Single(); customerMapping.Mappings.RemoveAt(2); DataContextFactory = () => new TestDataContext(brokenMappings); Assert.Throws <MappingException>(() => { using (var test = Verify <Customer>()) { test.TestCollection(x => x.Orders, new Order() { OrderDate = DateTime.Now }); } }); }