Exemple #1
0
        public void ReturnsListAllResponseWith200Status()
        {
            var expected = new TaxonomyResponseList()
            {
                Categories   = Randomm.CreateMany <TaxonomyResponse>().ToList(),
                Demographics = Randomm.CreateMany <TaxonomyResponse>().ToList()
            };

            _mockUseCase.Setup(u => u.ExecuteGet(It.Is <int?>(p => p == null))).Returns(expected);
            var response = _classUnderTest.ListTaxonomies(null) as OkObjectResult;

            response.Should().NotBeNull();
            response.StatusCode.Should().Be(200);
            response.Value.Should().BeEquivalentTo(expected);
        }
        public void ReturnsTaxonomiesByVocab()
        {
            var taxonomies = Randomm.CreateMany <TaxonomyDomain>().ToList();

            taxonomies[0].Vocabulary = "category";
            taxonomies[0].Vocabulary = "demographic";
            taxonomies[0].Vocabulary = "category";
            _mockTaxonomyGateway.Setup(g => g.GetTaxonomiesByVocabulary(It.IsAny <string>())).Returns(taxonomies);
            var expectedResponse = new TaxonomyResponseList()
            {
                Categories   = taxonomies.Where(x => x.Vocabulary == "category").ToList().ToResponse(),
                Demographics = new List <TaxonomyResponse>()
            };
            var response = _classUnderTest.ExecuteGet(1);

            response.Should().NotBeNull();
            response.Should().BeEquivalentTo(expectedResponse);
        }