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); }
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")); } }
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); }
public string DeleteFlat(int flatid) { int i = fservice.DeleteFlat(flatid); return(i.ToString()); }