public JsonResult DeleteProjection(string Id) { JsonResult result = new JsonResult(); result.JsonRequestBehavior = JsonRequestBehavior.AllowGet; ProjectionService.DeleteProjection(Id); result.Data = new { Success = false }; return(result); }
public void ProjectionService_DeleteProjection_ReturnDeletedProjection() { // Arrange ProjectionService projectionsService = new ProjectionService(_mockProjectionsRepository.Object, _mockReservationService.Object); _mockProjectionsRepository.Setup(x => x.Delete(It.IsAny <Guid>())).Returns(_projection); _mockProjectionsRepository.Setup(x => x.Save()); // Act var resultAction = projectionsService.DeleteProjection(_projection.Id).ConfigureAwait(false).GetAwaiter().GetResult(); // Assert Assert.IsNotNull(resultAction); Assert.AreEqual(resultAction.Id, _projection.Id); Assert.IsInstanceOfType(resultAction, typeof(ProjectionDomainModel)); }
public void ProjectionService_DeleteProjection_ProjectionRepositoryReturnsNull_ReturnsNull() { // Arrange Projection projection = null; ProjectionService projectionsService = new ProjectionService(_mockProjectionsRepository.Object, _mockReservationService.Object); _mockProjectionsRepository.Setup(x => x.Delete(It.IsAny <Guid>())).Returns(projection); _mockProjectionsRepository.Setup(x => x.Save()); // Act var resultAction = projectionsService.DeleteProjection(_projection.Id).ConfigureAwait(false).GetAwaiter().GetResult(); // Assert Assert.IsNull(resultAction); }
public void ProjectionService_DeleteProjection_ReservationServiceReturnsNull_ReturnsNull() { // Arrange Task <IEnumerable <ReservationDomainModel> > reservationResponseTask = null; _mockReservationService = new Mock <IReservationService>(); _mockReservationService.Setup(x => x.DeleteByProjectionId(It.IsAny <Guid>())).Returns(reservationResponseTask); ProjectionService projectionsService = new ProjectionService(_mockProjectionsRepository.Object, _mockReservationService.Object); _mockProjectionsRepository.Setup(x => x.Delete(It.IsAny <Guid>())).Returns(_projection); _mockProjectionsRepository.Setup(x => x.Save()); // Act var resultAction = projectionsService.DeleteProjection(_projection.Id).ConfigureAwait(false).GetAwaiter().GetResult(); // Assert Assert.IsNull(resultAction); }