示例#1
0
        public async Task ShouldDeleteTrip()
        {
            var trip     = Trips.First();
            int numTrips = Trips.Count;
            await TripManager.DeleteTrip(trip.Value);

            Assert.That(!Trips.ContainsKey(trip.Key));
            Assert.That(Trips.Count, Is.EqualTo(numTrips - 1));
            var unused = Uow.Received(1).CommitAsync();
        }
示例#2
0
        public async Task ShouldUpdateTrip()
        {
            var trip       = Trips.First();
            var oldComment = trip.Value.Comment;

            trip.Value.Comment = "Test update";
            var end = DateTimeOffset.Now.AddDays(10);

            trip.Value.EndDate = end;
            await TripManager.UpdateTrip(trip.Value);

            Assert.That(Trips.First().Value.Comment, Is.Not.EqualTo(oldComment));
            Assert.That(Trips.First().Value.EndDate, Is.EqualTo(end));
            Assert.That(Trips.First().Value.Id, Is.EqualTo(trip.Value.Id));
            var unused = Uow.Received(1).CommitAsync();
        }
示例#3
0
        public async Task ShouldAddNewTrip()
        {
            var trip = new Trip
            {
                StartDate   = DateTimeOffset.Now.AddDays(10),
                EndDate     = DateTimeOffset.Now.AddDays(20),
                Comment     = "Test Add",
                Destination = "France"
            };

            int numTrips = Trips.Count;
            await TripManager.CreateTrip(trip);

            Assert.That(trip, Is.EqualTo(Trips[trip.Id]));
            Assert.That(Trips.Count, Is.EqualTo(numTrips + 1));
            var unused = Uow.Received(1).CommitAsync();
        }