public void Should_Not_Have_Validation_Error_When_Valid_Command() { var notificationHandler = ServiceProvider.GetRequiredService <INotificationHandler>(); var command = AddEmployeeCommandMock.GetValidDto(); //call command.IsValid(); //assert Assert.DoesNotContain(command.ValidationResult.Errors, e => e.CustomState is EntityError.InvalidEmployeeName); Assert.DoesNotContain(command.ValidationResult.Errors, e => e.CustomState is EntityError.InvalidEmployeeEmail); Assert.DoesNotContain(command.ValidationResult.Errors, e => e.CustomState is EntityError.InvalidEmployeePassword); }
public async Task Should_AddEmployee() { //parameters var command = AddEmployeeCommandMock.GetValidDto(); //call var handler = GetEmployeeHandler(); var result = await handler.Handle(command, new System.Threading.CancellationToken()); //assert Assert.NotNull(result); Assert.False(_notificationHandler.HasNotification()); Assert.Equal(command.Name, result.Name); Assert.Equal(command.Email, result.Email); }