Exemplo n.º 1
0
        public void GetTrips_NonExisting_Null()
        {
            Mock<ITripRepository> TripRepository = new Mock<ITripRepository>();
            Mock<ILoggerService> loggerService = new Mock<ILoggerService>();

            TripRepository.SetupSequence(o => o.GetTrips(It.IsAny<Guid>())).Returns(null);

            TripService Service = new TripService(TripRepository.Object, loggerService.Object);
            IList<Trip> list = Service.GetTrips(Guid.NewGuid());
            Assert.IsNull(list);
        }
Exemplo n.º 2
0
        public void GetTrips_Existing_ListReturned()
        {
            IList<Trip> trips = new List<Trip>();
            for (int i = 0; i < 3; i++)
            {
                Trip trip = new Trip();
                trip.ID = new Guid();
                trip.TripName = i.ToString();
                trips.Add(trip);
            }

            Mock<ITripRepository> TripRepository = new Mock<ITripRepository>();
            Mock<ILoggerService> loggerService = new Mock<ILoggerService>();

            TripRepository.Setup(o => o.GetTrips(It.IsAny<Guid>())).Returns(trips);

            TripService Service = new TripService(TripRepository.Object, loggerService.Object);
            IList<Trip> list = Service.GetTrips(Guid.NewGuid());
            Assert.AreEqual(trips, list);
        }