Esempio n. 1
0
 public void autodata_demo()
 {
     var fixture = new Fixture();
     fixture.Customize(new AutoNSubstituteCustomization());
     var service = fixture.Create<UserService>();
     service.Should().NotBeNull();
 }
Esempio n. 2
0
        public void CustomizeFixture_NoWithout()
        {
            // Arrange
            var fixture = new Fixture();
            fixture.Customize<Employee>(ob => ob
                .Do(AssignRandomEmployeeType));

            // Act
            var employee = fixture.Create<Employee>();

            // Assert
            var inList = _names.Contains(employee.Name);
            Assert.IsTrue(inList); // Will always fail because the action executed in Do is overwritten by Autofixture
        }
Esempio n. 3
0
        public void CustomizeFixture_WithWithout()
        {
            // Arrange
            var fixture = new Fixture();
            fixture.Customize<Employee>(ob => ob
                .Without(e => e.Name)
                .Do(AssignRandomEmployeeType));

            // Act
            var employee = fixture.Create<Employee>();

            // Assert
            var inList = _names.Contains(employee.Name);
            Assert.IsTrue(inList);
        }
 public TestClassWithFixture()
 {
     // This gets hit first with every run, including each theory
     _fixture = new Fixture();
 }