예제 #1
0
        public void FailWithArgumentExceptionIfSingleProviderDoesntExistInRepository()
        {
            var mockUnitOfWork = new Mock <IUnitOfWork>();

            mockUnitOfWork.Setup(un => un.ProviderRepository.GetByID(It.IsAny <int>()));
            ProviderService providerService = new ProviderService(mockUnitOfWork.Object);

            Provider returnedProvider = providerService.GetSingleProvider(5);
        }
예제 #2
0
        public void BeAbleToReturnSingleProvicerFromRepository()
        {
            Provider singleProvider = new Provider("UTE", 60, new List <IField>());
            var      mockUnitOfWork = new Mock <IUnitOfWork>();

            mockUnitOfWork.Setup(un => un.ProviderRepository.GetByID(singleProvider.ID)).Returns(singleProvider);
            ProviderService providerService = new ProviderService(mockUnitOfWork.Object);

            Provider returnedProvider = providerService.GetSingleProvider(singleProvider.ID);

            mockUnitOfWork.VerifyAll();
            Assert.AreSame(singleProvider, returnedProvider);
        }