コード例 #1
0
        public async Task <COAModel> GetTestData()
        {
            COAModel model = GetNewData();
            await Service.CreateAsync(model);

            return(await Service.ReadByIdAsync(model.Id));
        }
コード例 #2
0
        public async Task Should_Success_Delete_Data()
        {
            COAService service = new COAService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            COAModel   model   = await _dataUtil(service).GetTestData();

            var newModel = await service.ReadByIdAsync(model.Id);

            var Response = await service.DeleteAsync(newModel.Id);

            var deletedModel = await service.ReadByIdAsync(newModel.Id);

            Assert.Null(deletedModel);
        }
コード例 #3
0
        public async Task Should_Success_Update_Data()
        {
            COAService service = new COAService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            COAModel   model   = await _dataUtil(service).GetTestData();

            var newModel = await service.ReadByIdAsync(model.Id);

            newModel.Name += "[Updated]";
            var Response = await service.UpdateAsync(newModel.Id, newModel);

            Assert.NotEqual(0, Response);
        }
コード例 #4
0
        public async Task Should_Success_Revise_Empty_Name_Coa_But_Empty_List()
        {
            COAService service = new COAService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            COAModel   model   = _dataUtil(service).GetNewData();
            await service.CreateAsync(model);

            var createdModel = await service.ReadByIdAsync(model.Id);

            createdModel.Name = null;
            List <COAModel> models = new List <COAModel>()
            {
                createdModel
            };

            var reportResponse = await service.ReviseEmptyNamesCoa(models);

            Assert.NotEqual(0, reportResponse);
        }