public async Task Should_return_null_and_cast_error_when_invalid_data_is_provided() { var newApplication = await ExecuteCommand((context) => { var uow = new UnitOfWork(context); var applicationDomainService = new ApplicationDomainService(_mediator, new ApplicationRepository(context)); var applicationAppService = new ApplicationAppService(uow, applicationDomainService); return(applicationAppService.Add(new ApplicationModel { Name = "", Version = "0.1" })); }); using (new AssertionScope()) { newApplication.Should().BeNull(); await _mediator.Received(1).Publish(Arg.Is <ErrorNotification>(d => d.Error.Equals(DomainMessageError.ApplicationNameCannotBeNullOrEmpty))); } }
public async Task Should_add_new_service() { var newApplication = await ExecuteCommand((context) => { var uow = new UnitOfWork(context); var applicationDomainService = new ApplicationDomainService(_mediator, new ApplicationRepository(context)); var applicationAppService = new ApplicationAppService(uow, applicationDomainService); return(applicationAppService.Add(new ApplicationModel { Name = "App01", Version = "0.1" })); }); using (new AssertionScope()) { newApplication.Name.Should().Be("App01"); newApplication.Version.Should().Be("0.1"); } }