Пример #1
0
        public void Append_01()
        {
            // arrange:
            UnLocode loc1        = new UnLocode("CODLD");
            UnLocode loc2        = new UnLocode("CODUN");
            DateTime arrivalDate = DateTime.UtcNow + TimeSpan.FromDays(10);
            ILeg     leg         = MockRepository.GenerateStrictMock <ILeg>();

            leg.Expect(l => l.LoadLocation).Return(loc1).Repeat.Once();
            leg.Expect(l => l.UnloadLocation).Return(loc2).Repeat.Once();
            leg.Expect(l => l.UnloadTime).Return(arrivalDate).Repeat.Once();
            Itinerary empty = new Itinerary();

            // act:
            IItinerary tested = empty.Append(leg);

            // assert:
            Assert.IsNotNull(tested);
            Assert.AreEqual(1, tested.Count());
            Assert.AreSame(leg, tested.First());
            Assert.AreSame(leg, tested.Last());
            Assert.AreEqual(loc1, tested.InitialDepartureLocation);
            Assert.AreEqual(loc2, tested.FinalArrivalLocation);
            Assert.AreEqual(arrivalDate, tested.FinalArrivalDate);
            leg.VerifyAllExpectations();
        }