Example #1
0
        public async Task <bool> LeaveTrip()
        {
            var response = await TripController.LeaveTrip(Trip.TripId);

            if (response.IsSuccessStatusCode)
            {
                return(true);
            }
            return(false);
        }
Example #2
0
        public void CallCacheServiceMethodRemoveOnce()
        {
            //Arrange
            var cacheServiceMock = new Mock <ICacheService>();

            var controller = new TripController(
                this.usersServiceMock.Object,
                this.tripsServiceMock.Object,
                cacheServiceMock.Object,
                this.mapperMock.Object);

            //Act
            controller.LeaveTrip(It.IsAny <int>());

            //Assert
            cacheServiceMock.Verify(s => s.Remove(It.IsAny <string>()), Times.Once);
        }
Example #3
0
        public void CallTripsServiceMethodLeaveTripOnce()
        {
            //Arrange
            var tripsServiceMock = new Mock <ITripsService>();

            var controller = new TripController(
                this.usersServiceMock.Object,
                tripsServiceMock.Object,
                this.cacheServiceMock.Object,
                this.mapperMock.Object);

            //Act
            controller.LeaveTrip(It.IsAny <int>());

            //Assert
            tripsServiceMock.Verify(s => s.LeaveTrip(It.IsAny <Trip>()), Times.Once);
        }