public void GetTaxonomiesByVocabUseCaseCallsGatewayGetTaxonomiesByVocab()
        {
            var vocabularyId = Randomm.Create <int>();

            _classUnderTest.ExecuteGet(vocabularyId);
            _mockTaxonomyGateway.Verify(u => u.GetTaxonomiesByVocabulary(It.IsAny <string>()), Times.Once);
        }
        public void GetTaxonomyUseCaseCallsGatewayGetTaxonomy()
        {
            var id = Randomm.Create <int>();

            _classUnderTest.ExecuteGetById(id);
            _mockTaxonomyGateway.Verify(u => u.GetTaxonomy(It.IsAny <int>()), Times.Once);
        }
        public void DeleteUserOrganisationControllerActionCallsTheUserOrganisationsUseCase()
        {
            var requestParam = Randomm.Create <int>();

            _classUnderTest.DeleteUserOrganisation(requestParam);
            _mockUseCase.Verify(uc => uc.ExecuteDelete(requestParam), Times.Once);
        }
Exemple #4
0
        public void GetServiceControllerActionCallsTheServicesUseCase()
        {
            var requestParams = Randomm.Create <GetServiceByIdRequest>();

            _classUnderTest.GetService(requestParams);
            _mockUseCase.Verify(uc => uc.ExecuteGet(It.Is <GetServiceByIdRequest>(p => p == requestParams)), Times.Once);
        }
        public void CreateTaxonomyUseCaseCallsGatewayCreateTaxonomy()
        {
            var requestParams = Randomm.Create <TaxonomyRequest>();

            requestParams.VocabularyId = 1;
            _classUnderTest.ExecuteCreate(requestParams);
            _mockTaxonomyGateway.Verify(u => u.CreateTaxonomy(It.IsAny <Taxonomy>()), Times.Once);
        }
        public void DeleteTaxonomyWhereTaxonomyStillLinkedToServiceThrowsError()
        {
            var id = Randomm.Create <int>();
            var serviceTaxonomies = Randomm.CreateMany <ServiceTaxonomyDomain>().ToList();

            _mockTaxonomyGateway.Setup(g => g.GetServiceTaxonomies(It.IsAny <int>())).Returns(serviceTaxonomies);
            _classUnderTest.Invoking(c => c.ExecuteDelete(id)).Should().Throw <ServiceTaxonomyExistsException>();
        }
Exemple #7
0
        public void ServiceControllerSearchServiceActionWithTaxonomyIdCallsTheServicesUseCaseWithTheCorrectTaxonomyId()
        {
            var searchParams = Randomm.Create <SearchServicesRequest>();

            _classUnderTest.SearchServices(searchParams);
            _mockUseCase.Verify(uc =>
                                uc.ExecuteGet(It.Is <SearchServicesRequest>(p => p.TaxonomyIds == searchParams.TaxonomyIds)), Times.Once);
        }
        public void DeleteTaxonomyUseCaseCallsGatewayGetServiceTaxonomies()
        {
            var id = Randomm.Create <int>();
            var serviceTaxonomies = new List <ServiceTaxonomyDomain>();

            _mockTaxonomyGateway.Setup(g => g.GetServiceTaxonomies(It.IsAny <int>())).Returns(serviceTaxonomies);
            _classUnderTest.ExecuteDelete(id);
            _mockTaxonomyGateway.Verify(u => u.GetServiceTaxonomies(It.IsAny <int>()), Times.Once);
        }
        public void CallsGatewayDeleteAndThrowsErrorIfNotSuccessful()
        {
            var id = Randomm.Create <int>();
            var serviceTaxonomies = new List <ServiceTaxonomyDomain>();

            _mockTaxonomyGateway.Setup(g => g.GetServiceTaxonomies(It.IsAny <int>())).Returns(serviceTaxonomies);
            _mockTaxonomyGateway.Setup(g => g.DeleteTaxonomy(It.IsAny <int>())).Throws <InvalidOperationException>();
            _classUnderTest.Invoking(c => c.ExecuteDelete(id)).Should().Throw <InvalidOperationException>();
        }