public async Task <MemoModel> GetCreatedData() { var model = GetMemoModelToCreate(); await _service.CreateAsync(model); return(await _service.ReadByIdAsync(model.Id)); }
public async Task Should_Success_Read_ById() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProviderMock(); var service = new MemoService(dbContext, serviceProviderMock.Object); var dataUtil = new MemoDataUtil(service); var data = await dataUtil.GetCreatedData(); var result = await service.ReadByIdAsync(data.Id); Assert.NotNull(result); }
public async Task Should_Success_MapToViewModel() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProviderMock(); var service = new MemoService(dbContext, serviceProviderMock.Object); var dataUtil = new MemoDataUtil(service); var data = await dataUtil.GetCreatedData(); var result = await service.ReadByIdAsync(data.Id); Mapper.Initialize(mapper => mapper.AddProfile <MemoProfile>()); Mapper.AssertConfigurationIsValid(); var viewModel = Mapper.Map <MemoViewModel>(result); Assert.NotNull(viewModel); var model = Mapper.Map <MemoModel>(viewModel); Assert.NotNull(model); }