public void autodata_demo() { var fixture = new Fixture(); fixture.Customize(new AutoNSubstituteCustomization()); var service = fixture.Create<UserService>(); service.Should().NotBeNull(); }
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 }
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); }