public void Delete_ExistingEntity_ReturnsTrue() { Trip trip = new Trip() { ID = Guid.NewGuid() }; Mock<ITripRepository> TripRepository = new Mock<ITripRepository>(); Mock<ILoggerService> loggerService = new Mock<ILoggerService>(); TripRepository.Setup(o => o.Delete(It.IsAny<Trip>())); TripRepository.SetupSequence(o => o.GetByID(trip.ID)).Returns(trip); TripService Service = new TripService(TripRepository.Object, loggerService.Object); Assert.IsTrue(Service.DeleteTrip(trip)); }
public void Delete_NullEntity_ReturnsFalse() { Mock<ITripRepository> TripRepository = new Mock<ITripRepository>(); Mock<ILoggerService> loggerService = new Mock<ILoggerService>(); TripService Service = new TripService(TripRepository.Object, loggerService.Object); bool Result = Service.DeleteTrip(null); Assert.IsFalse(Result); }