예제 #1
0
        public void PinpadTable_Construction_ShouldThrowException_IfPinpadCommunicationIsNull()
        {
            // Assert
            Assert.Throws <ArgumentNullException>(() =>
            {
                // Arrange
                IPinpadCommunication nullPinpadCommunication = null;

                // Act
                PinpadTable table = new PinpadTable(nullPinpadCommunication);
            });
        }
예제 #2
0
        public void PinpadTable_Construction_ShouldNotReturnNull_IfParametersAreCorrect()
        {
            // Arrange
            IPinpadConnection conn = Mock.Of <IPinpadConnection>();

            Stubs.PinpadCommunicationStub pinpadCommunicationStub =
                new Stubs.PinpadCommunicationStub();

            // Act
            PinpadTable table = new PinpadTable(pinpadCommunicationStub);

            // Assert
            Assert.IsNotNull(table);
        }
예제 #3
0
        public void PinpadTable_AddEntry_ShouldThrowException_IfUnknownTableEntry()
        {
            // Assert
            Assert.Throws <NotImplementedException>(() =>
            {
                // Arrange
                Stubs.PinpadCommunicationStub pinpadCommunicationStub =
                    new Stubs.PinpadCommunicationStub();
                Dummies.DummyTable dummyTable = new Dummies.DummyTable();
                PinpadTable table             = new PinpadTable(pinpadCommunicationStub);

                // Act
                table.AddEntry(dummyTable);
            });
        }
예제 #4
0
        public void PinpadTable_CapkTable_ShouldMatchTheNumberOrTablesAdded()
        {
            // Arrange
            PinpadTable table = new PinpadTable(new Stubs.PinpadCommunicationStub());

            // Assert
            Assert.AreEqual(table.CapkTable.Count, 0);

            // Arrange
            for (int i = 0; i < 10; i++)
            {
                table.AddEntry(this.GetCapk(4));
            }

            // Assert
            Assert.AreEqual(table.CapkTable.Count, 1);
        }