public async void Get_ReturnsData() { // arrange var targetId = context.Makes.FirstOrDefault().Id; ICommandFactory <Make> commandFactory = new CommandFactory <Make>(); var validationServiceMoq = new Mock <IValidationService>(); var sut = new MakeService(context, commandFactory, validationServiceMoq.Object); // act var result = await sut.Get(targetId); // assert Assert.NotNull(result.Data); }
public async void Get_WhenNotFoundReturnsNotFound() { // arrange var targetId = context.Makes.FirstOrDefault().Id; var targetEntity = await context.FindAsync <Make>(targetId); ICommandFactory <Make> commandFactory = new CommandFactory <Make>(); var validationServiceMoq = new Mock <IValidationService>(); var sut = new MakeService(context, commandFactory, validationServiceMoq.Object); var removeResult = context.Remove(targetEntity); await context.SaveChangesAsync(); // act var result = await sut.Get(targetId); // assert Assert.Equal(ResultCode.NotFound, result.ResultCode); }