Exemplo n.º 1
0
        public void DepartFrom_01()
        {
            // arrange:
            VoyageNumber number   = new VoyageNumber("VYGTEST01");
            ISchedule    schedule = MockRepository.GenerateStrictMock <ISchedule>();

            // act:
            CompletedVoyage state = new CompletedVoyage(number, schedule);

            // assert:
            Assert.Throws <InvalidOperationException>(delegate { state.DepartFrom(MockRepository.GenerateStrictMock <ILocation>()); });
            schedule.VerifyAllExpectations();
        }
Exemplo n.º 2
0
        public void Ctor_01()
        {
            // arrange:
            VoyageNumber number   = new VoyageNumber("VYGTEST01");
            ISchedule    schedule = MockRepository.GenerateStrictMock <ISchedule>();

            schedule.Expect(s => s.MovementsCount).Return(3).Repeat.Any();

            // act:
            CompletedVoyage state = new CompletedVoyage(number, schedule);

            // assert:
            Assert.AreSame(schedule, state.Schedule);
            Assert.IsFalse(state.IsMoving);
        }
Exemplo n.º 3
0
        public void Equals_06()
        {
            // arrange:
            VoyageNumber number   = new VoyageNumber("VYGTEST01");
            ISchedule    schedule = MockRepository.GenerateStrictMock <ISchedule>();

            schedule.Expect(s => s.MovementsCount).Return(3).Repeat.Any();

            // act:
            CompletedVoyage state1 = new CompletedVoyage(number, schedule);
            VoyageState     state2 = MockRepository.GeneratePartialMock <VoyageState>(number, schedule);

            // assert:
            Assert.IsFalse(state1.Equals(state2));
            schedule.VerifyAllExpectations();
            state2.VerifyAllExpectations();
        }
Exemplo n.º 4
0
        public void WillStopOverAt_01()
        {
            // arrange:
            VoyageNumber number   = new VoyageNumber("VYGTEST01");
            ISchedule    schedule = MockRepository.GenerateStrictMock <ISchedule>();

            schedule.Expect(s => s.MovementsCount).Return(3).Repeat.Any();
            ILocation location = MockRepository.GenerateStrictMock <ILocation>();

            // act:
            CompletedVoyage state = new CompletedVoyage(number, schedule);
            bool            willStopOverAtLocation = state.WillStopOverAt(location);

            // assert:
            Assert.IsFalse(willStopOverAtLocation);
            location.VerifyAllExpectations();
            schedule.VerifyAllExpectations();
        }
Exemplo n.º 5
0
        public void Equals_02()
        {
            // arrange:
            VoyageNumber number   = new VoyageNumber("VYGTEST01");
            ISchedule    schedule = MockRepository.GenerateStrictMock <ISchedule>();

            schedule.Expect(s => s.MovementsCount).Return(4).Repeat.Any();
            schedule.Expect(s => s.Equals(schedule)).Return(true).Repeat.Any();

            // act:
            CompletedVoyage state1 = new CompletedVoyage(number, schedule);
            CompletedVoyage state2 = new CompletedVoyage(number, schedule);

            // assert:
            Assert.IsTrue(state1.Equals(state2));
            Assert.IsTrue(state2.Equals(state1));
            schedule.VerifyAllExpectations();
        }
Exemplo n.º 6
0
        public void NextExpectedLocation_01()
        {
            // arrange:
            VoyageNumber number   = new VoyageNumber("VYGTEST01");
            ISchedule    schedule = MockRepository.GenerateStrictMock <ISchedule>();

            schedule.Expect(s => s.MovementsCount).Return(3).Repeat.Any();
            UnLocode         arrivalLocation = new UnLocode("ATEND");
            ICarrierMovement movement        = MockRepository.GenerateStrictMock <ICarrierMovement>();

            movement.Expect(m => m.ArrivalLocation).Return(arrivalLocation).Repeat.Once();
            schedule.Expect(s => s[2]).Return(movement).Repeat.Once();

            // act:
            CompletedVoyage state = new CompletedVoyage(number, schedule);

            // assert:
            Assert.AreSame(arrivalLocation, state.NextExpectedLocation);
            movement.VerifyAllExpectations();
            schedule.VerifyAllExpectations();
        }