예제 #1
0
        public void CheqqueServicesGetLastCheques_GreaterThanZeroCount_ReturnListOfChecquesWithCount3()
        {
            ////Arrange
            var mockRepository = Mock
                                 .Of <IDBRepository>(m => m
                                                     .GetLastCheques(3) == new List <Cheque>
            {
                new Cheque {
                    Number = "1"
                },
                new Cheque {
                    Number = "2"
                },
                new Cheque {
                    Number = "3"
                },
            });

            var chequeService = new ChequeService(mockRepository);

            ////Act
            var lastCheques = (IList <Cheque>)chequeService.GetLastCheques(3);

            ////Assert
            Assert.That(lastCheques.Count, Is.EqualTo(3));
            Assert.That(lastCheques[0].Number, Is.EqualTo("1"));
            Assert.That(lastCheques[1].Number, Is.EqualTo("2"));
            Assert.That(lastCheques[2].Number, Is.EqualTo("3"));
        }
예제 #2
0
        public void CheqqueServicesGetLastCheques_LessOrEqualsZeroCount_ReturnEmptyListOfChecques(int count)
        {
            ////Arrange
            var mockRepository = new Mock <IDBRepository>();

            mockRepository.Setup(mock => mock.GetLastCheques(count)).Returns(
                new List <Cheque>());

            var chequeService = new ChequeService(mockRepository.Object);

            ////Act
            var lastCheques = (IList <Cheque>)chequeService.GetLastCheques(count);

            ////Assert
            Assert.That(lastCheques, Is.Empty);
        }