public void user_project_command_failed() { //given var fixture = new Fixture().Customize(new AutoNSubstituteCustomization { ConfigureMembers = true }); fixture.Customizations.Add(new RandomNumericSequenceGenerator(long.MinValue, -1)); fixture.Register <Money>(() => Money.From(fixture.Create <Decimal>())); fixture.Register <EntityId>(() => EntityId.Empty()); fixture.Register <ProjectName>(() => ProjectName.Empty()); fixture.Register <ProjectCode>(() => ProjectCode.Empty()); fixture.Register <DateAndTime>(() => DateAndTime.Empty()); fixture.Register <Money>(() => fixture.Create <Money>()); var command = new AddProjectCommand(); var mediator = fixture.Create <IMediator>(); var logger = fixture.Create <ILogger <AddProjectCommandHandler> >(); var projectDb = fixture.Create <IDbSession <IProjectRepository> >(); var userDb = fixture.Create <IDbSession <IUserRepository> >(); // when var handler = new AddProjectCommandHandler(logger, mediator, projectDb, userDb); var result = handler.Execute(command); // then Assert.True(!result.IsSucceed && result.Violations.Count == 4); }