public async void GetAll_ReturnsData() { // arrange ICommandFactory <Make> commandFactory = new CommandFactory <Make>(); var validationServiceMoq = new Mock <IValidationService>(); var sut = new MakeService(context, commandFactory, validationServiceMoq.Object); // act var result = await sut.GetAll(); // assert Assert.NotEmpty(result.Data); }
public async void GetAll_WhenNotFoundReturnsNotFound() { // arrange var allMake = await context.Set <Make>().ToListAsync(); ICommandFactory <Make> commandFactory = new CommandFactory <Make>(); var validationServiceMoq = new Mock <IValidationService>(); var sut = new MakeService(context, commandFactory, validationServiceMoq.Object); context.Makes.RemoveRange(allMake); await context.SaveChangesAsync(); // act var result = await sut.GetAll(); // assert Assert.Equal(ResultCode.NotFound, result.ResultCode); }