コード例 #1
0
        public async Task DeleteFlat_EmptyIdentifier_Warning()
        {
            var flatRepoMoq = new Mock <IFlatRepository>();

            var controller     = new FlatService(flatRepoMoq.Object);
            var actualResponse = await controller.DeleteFlat(0);

            Assert.Equal(ResponseStatuses.Warning, actualResponse.Status);
        }
コード例 #2
0
 public async Task <ServiceResponse <bool> > DeleteFlat([FromBody] DeleteFlatViewModel model)
 {
     try
     {
         return(await _flatService.DeleteFlat(model.Id));
     }
     catch (Exception e)
     {
         _logger.LogError(e, $"exception in  DeleteFlat, called with {model}");
         return(ServiceResponse <bool> .Exception("An error occured during delete-flat request"));
     }
 }
コード例 #3
0
        public async Task DeleteFlat_NonEmptyIdentifier_OkResponse(int id)
        {
            var flatRepoMoq = new Mock <IFlatRepository>();

            flatRepoMoq
            .Setup(m => m.Delete(id))
            .Returns(Task.FromResult(true));

            var controller     = new FlatService(flatRepoMoq.Object);
            var actualResponse = await controller.DeleteFlat(id);

            Assert.Equal(ResponseStatuses.Ok, actualResponse.Status);
        }
コード例 #4
0
        public string DeleteFlat(int flatid)
        {
            int i = fservice.DeleteFlat(flatid);

            return(i.ToString());
        }