public void GIVEN_dispense_a_ticket_WHEN_dispense_a_new_ticket_at_the_same_machine_THEN_turn_number_of_the_new_ticket_is_greater()
 {
     TicketDispenser ticketDispenser = new TicketDispenser();
     TurnTicket oldTicket = ticketDispenser.GetTurnTicket();
     TurnTicket newTicket = ticketDispenser.GetTurnTicket();
     Assert.Greater(newTicket.TurnNumber, oldTicket.TurnNumber);
 }
示例#2
0
        public void turnTicketDispenser_should_samedispenser_send_a_ticker_with_greater_number_than_previous_ticket()
        {
            TicketDispenser ticketDispenser = new TicketDispenser();
            TurnTicket      ticket          = ticketDispenser.GetTurnTicket();
            TurnTicket      ticket2         = ticketDispenser.GetTurnTicket();

            Assert.Greater(ticket2.TurnNumber, ticket.TurnNumber);
        }
        public void GIVEN_dispense_a_ticket_WHEN_dispense_a_new_ticket_at_the_same_machine_THEN_turn_number_of_the_new_ticket_is_greater()
        {
            TicketDispenser ticketDispenser = new TicketDispenser();
            TurnTicket      oldTicket       = ticketDispenser.GetTurnTicket();
            TurnTicket      newTicket       = ticketDispenser.GetTurnTicket();

            Assert.Greater(newTicket.TurnNumber, oldTicket.TurnNumber);
        }
        public void A_new_ticket_must_have_the_turn_number_subsequent_to_the_previous_ticket()
        {
            TicketDispenser ticketDispenser = new TicketDispenser();
            TurnTicket      previousTicket  = ticketDispenser.GetTurnTicket();

            TurnTicket newTicket = ticketDispenser.GetTurnTicket();

            Assert.Greater(newTicket.TurnNumber, previousTicket.TurnNumber, "turn number");
        }
        public void A_new_ticket_must_have_the_turn_number_subsequent_to_the_previous_ticket()
        {
            var ticketDispenser = new TicketDispenser();
            TurnTicket previousTicket = ticketDispenser.GetTurnTicket();

            TurnTicket newTicket = ticketDispenser.GetTurnTicket();

            Assert.Greater(newTicket.TurnNumber, previousTicket.TurnNumber, "turn number");
        }
示例#6
0
        public void WhenSecondAndThirdTicketThenNumberAre1And2()
        {
            var dispenser = new TicketDispenser();

            var ticket1 = dispenser.GetTurnTicket();
            var ticket2 = dispenser.GetTurnTicket();

            Assert.AreEqual(1, ticket1.TurnNumber);
            Assert.AreEqual(2, ticket2.TurnNumber);
        }
        public void A_new_ticket_should_have_the_turn_number_subsequent_to_the_previous_ticket()
        {
            // Arrange
            var        ticketDispenser = new TicketDispenser();
            TurnTicket previouseTicket = ticketDispenser.GetTurnTicket();

            // Act
            TurnTicket newTicket = ticketDispenser.GetTurnTicket();

            // Assert
            Assert.AreEqual(1, newTicket.TurnNumber - previouseTicket.TurnNumber);
        }
示例#8
0
        public void WhenFourthTicketThenNumberIsNot0()
        {
            var dispenser = new TicketDispenser();

            var ticket = dispenser.GetTurnTicket();

            Assert.AreNotEqual(0, ticket.TurnNumber);
        }
示例#9
0
        public void WhenFirstTicketThenNumberIs0()
        {
            var dispenser = new TicketDispenser();

            var ticket = dispenser.GetTurnTicket();

            Assert.AreEqual(0, ticket.TurnNumber);
        }
        public void A_new_ticket_must_have_the_turn_number_subsequent_to_the_previous_ticket_from_another_dispencer()
        {
            TicketDispenser firstTicketDispenser = new TicketDispenser();
            TurnTicket      previousTicket       = firstTicketDispenser.GetTurnTicket();

            TicketDispenser secondTicketDispenser = new TicketDispenser();
            TurnTicket      newTicket             = secondTicketDispenser.GetTurnTicket();

            Assert.Greater(newTicket.TurnNumber, previousTicket.TurnNumber, "turn number");
        }
        public void A_new_ticket_must_have_the_turn_number_subsequent_to_the_previous_ticket_from_another_dispencer()
        {
            var firstTicketDispenser = new TicketDispenser();
            TurnTicket previousTicket = firstTicketDispenser.GetTurnTicket();

            var secondTicketDispenser = new TicketDispenser();
            TurnTicket newTicket = secondTicketDispenser.GetTurnTicket();

            Assert.Greater(newTicket.TurnNumber, previousTicket.TurnNumber, "turn number");
        }
示例#12
0
        public void WhenSeveralTicketsPickedThenLatestIsBiggest()
        {
            var firstDispenser  = new TicketDispenser();
            var secondDispenser = new TicketDispenser();

            var firstTicket  = firstDispenser.GetTurnTicket();
            var secondTicket = secondDispenser.GetTurnTicket();

            Assert.IsTrue(secondTicket.TurnNumber > firstTicket.TurnNumber);
        }
        public void After_ticket_10_come_ticket_11()
        {
            var mockTurnNumberSequence = new MockTurnNumberSequence();
            mockTurnNumberSequence.SetExpectedGetNextTurnNumber(11);
            var ticketDispenser = new TicketDispenser(mockTurnNumberSequence);

            TurnTicket newTicket = ticketDispenser.GetTurnTicket();

            Assert.AreEqual(11, newTicket.TurnNumber, "turn number");
            mockTurnNumberSequence.Verify();
        }
        public void After_ticket_10_come_ticket_11()
        {
            MockTurnNumberSequence mockTurnNumberSequence = new MockTurnNumberSequence();

            mockTurnNumberSequence.SetExpectedGetNextTurnNumber(11);
            TicketDispenser ticketDispenser = new TicketDispenser(mockTurnNumberSequence);

            TurnTicket newTicket = ticketDispenser.GetTurnTicket();

            Assert.AreEqual(11, newTicket.TurnNumber, "turn number");
            mockTurnNumberSequence.Verify();
        }
        public void The_turn_number_sequence_of_the_regular_customers_starts_from_2001()
        {
            // Arrange
            TurnNumberSequence regularCustomerTurnNumberSequence = new TurnNumberSequence(2001);
            TicketDispenser    ticketDispenser = new TicketDispenser(regularCustomerTurnNumberSequence);

            // Act
            TurnTicket ticket = ticketDispenser.GetTurnTicket();

            // Assert
            Assert.AreEqual(TurnNumberSequence.RegularCustomerFirstNumber, ticket.TurnNumber);
        }
        public void The_turn_number_sequence_of_the_vip_customers_starts_from_1001()
        {
            // Arrange
            TurnNumberSequence vipCustomerTurnNumberSequence = new TurnNumberSequence(TurnNumberSequence.VIPCustomerFirstNumber);
            TicketDispenser    ticketDispenser = new TicketDispenser(vipCustomerTurnNumberSequence);

            // Act
            TurnTicket ticket = ticketDispenser.GetTurnTicket();

            // Assert
            Assert.AreEqual(TurnNumberSequence.VIPCustomerFirstNumber, ticket.TurnNumber);
        }
示例#17
0
        public void MultipleTicketDispensers_ShouldNotDispenseTheSameNumberTickets()
        {
            var ticketDispenser1 = new TicketDispenser();
            var ticketDispenser2 = new TicketDispenser();
            var turnticket1      = ticketDispenser1.GetTurnTicket();

            for (var i = 1; i < 100; i++)
            {
                var turnticket = ticketDispenser2.GetTurnTicket();
                Assert.That(turnticket1.TurnNumber, !Is.EqualTo(turnticket.TurnNumber));
            }
        }
        public void The_ticket_dispenser_should_dispense_the_ticket_number_11_if_give_a_turn_number_11_to_it()
        {
            // Arrange
            MockTurnNumberSequence mockTurnNumberSequence = new MockTurnNumberSequence();

            mockTurnNumberSequence.ArrangeNextTurnNumber(11);
            TicketDispenser ticketDispenser = new TicketDispenser(mockTurnNumberSequence);

            // Act
            TurnTicket ticket = ticketDispenser.GetTurnTicket();

            // Assert
            Assert.AreEqual(11, ticket.TurnNumber);
            mockTurnNumberSequence.VerifyMethodGetNextTurnNumberCalledOnce();
        }
        public void ShuldBeableToUseConsistentlyLegacyAndNonLegacyDispenserUsingSameSequence()
        {
            MockRepository mocks = new MockRepository();

            ITurnNumberSequence sequence = mocks.StrictMock<ITurnNumberSequence>();
            Expect.Call(sequence.GetNextNumber()).Return(0);
            Expect.Call(sequence.GetNextNumber()).Return(1);
            TurnNumberSequence.Instance=sequence;

            mocks.ReplayAll();

            LegacyTicketDispenser legacyticketDispenser = new LegacyTicketDispenser();
            TicketDispenser ticketDispenser = new TicketDispenser(TurnNumberSequence.Instance);

            TurnTicket first = new TurnTicket(0);
            TurnTicket second = new TurnTicket(1);

            Assert.AreEqual(first,ticketDispenser.GetTurnTicket());
            Assert.AreEqual(second,legacyticketDispenser.GetTurnTicket());

            mocks.VerifyAll();
        }
        public void TestTicketDispenserHighNumbers()
        {
            MockRepository mocks = new MockRepository();

            ITurnNumberSequence sequence = mocks.StrictMock<ITurnNumberSequence>();
            Expect.Call(sequence.GetNextNumber()).Return(999999);
            Expect.Call(sequence.GetNextNumber()).Return(1000000);

            mocks.ReplayAll();

            TicketDispenser ticketDispenser = new TicketDispenser(sequence);

            TurnTicket first = new TurnTicket(999999);
            TurnTicket second = new TurnTicket(1000000);

            Assert.AreEqual(first,ticketDispenser.GetTurnTicket());
            Assert.AreEqual(second,ticketDispenser.GetTurnTicket());

            mocks.VerifyAll();
        }