示例#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);
        }