Пример #1
0
        public void Customize_ShouldAddOptionsBuilderToFixture(InMemoryContextCustomization customization,
                                                               Fixture fixture)
        {
            fixture.Customize(customization);

            fixture.Customizations.Should()
            .ContainSingle(x => x.GetType() == typeof(InMemoryOptionsSpecimenBuilder));
        }
Пример #2
0
        public void SaveChanges_ShouldCreateCustomerRecord(
            InMemoryContextCustomization customization,
            Fixture fixture)
        {
            fixture.Customize(
                new CompositeCustomization(
                    customization,
                    new ConstructorCustomization(
                        typeof(TestDbContext),
                        new GreedyConstructorQuery())));

            using var context = fixture.Create <TestDbContext>();
            context.Database.EnsureCreated();

            context.Customers.Add(new Customer("John Doe"));
            context.SaveChanges();

            context.Customers.Should().Contain(x => x.Name == "John Doe");
        }
Пример #3
0
 public void Customize_ForNullFixture_ShouldThrow(InMemoryContextCustomization customization)
 {
     Action act = () => customization.Customize(default);