コード例 #1
0
        public void should_have_no_fare()
        {
            const short fare = 10;

            var journey = new Journey();

            journey.AssignFare(od => fare);

            Assert.That(OriginDestination.HasNoJourney(journey.Project().OriginDestination), Is.True);
            Assert.That(journey.Project().Fare, Is.EqualTo(0));
        }
        public void should_be_bank_to_bank()
        {
            const string bank = "Bank";
            const short fare = 10;

            var journey = new Journey();

            var msg1 = new DeviceTappedCommand(journey.AccountId, bank, "rail");
            var msg2 = new DeviceTappedCommand(journey.AccountId, bank, "rail");

            journey.RecieveTap(msg2);
            journey.RecieveTap(msg1);

            journey.AssignFare(od => fare);

            Assert.That(journey.Project().OriginDestination, Is.EqualTo(OriginDestination.HereToHere(bank)));
            Assert.That(journey.Project().Fare, Is.EqualTo(10));
        }
コード例 #3
0
        public void should_be_bank_to_bank()
        {
            const string bank = "Bank";
            const short  fare = 10;

            var journey = new Journey();

            var msg1 = new DeviceTappedCommand(journey.AccountId, bank, "rail");
            var msg2 = new DeviceTappedCommand(journey.AccountId, bank, "rail");

            journey.RecieveTap(msg2);
            journey.RecieveTap(msg1);

            journey.AssignFare(od => fare);

            Assert.That(journey.Project().OriginDestination, Is.EqualTo(OriginDestination.HereToHere(bank)));
            Assert.That(journey.Project().Fare, Is.EqualTo(10));
        }
コード例 #4
0
        public void should_demonstrate_tinkering()
        {

            const string outerMongolia = "Outer Mongolia";
            const string bank = "Bank";
            const short fare = 10;

            var memento = new JourneyMemento
            {
                AccountId = Guid.NewGuid(),
                Origin = bank,
                Destination = bank,
                Fare = 0
            };

            var journey = new Journey(memento);
            memento.Destination = outerMongolia;
            journey.AssignFare((origin, destination) => fare);

            var projection = journey.Project();

            Assert.That(projection.Destination, Is.EqualTo(outerMongolia));
        }
コード例 #5
0
        public void should_include_fields()
        {
            const string bank = "Bank";
            const short fare = 10;

            var memento = new JourneyMemento
            {
                AccountId = Guid.NewGuid(),
                Origin = bank,
                Destination = bank,
                Fare = 0
            };

            var journey = new Journey(memento);
            
            journey.AssignFare((origin, destination) => fare);

            var projection = journey.Project();

            Assert.That(projection.AccountId, Is.EqualTo(memento.AccountId));
            Assert.That(projection.Origin, Is.EqualTo(bank));
            Assert.That(projection.Destination, Is.EqualTo(bank));
            Assert.That(projection.Fare, Is.EqualTo(10));
        }