Esempio n. 1
0
        public async Task GetAsync_MultipleSolutionsExist_ReturnsMultipleAdditionalServices()
        {
            const string solutionId1 = "sln1";
            const string solutionId2 = "sln2";

            var additionalService1 = AdditionalServiceDtoBuilder.Create().WithSolutionId(solutionId1).Build();
            var additionalService2 = AdditionalServiceDtoBuilder.Create().WithSolutionId(solutionId2).Build();

            List <IAdditionalService> additionalServiceResult = new List <IAdditionalService> {
                additionalService1, additionalService2
            };

            mockMediator
            .Setup(m => m.Send(
                       It.IsNotNull <GetAdditionalServiceBySolutionIdsQuery>(),
                       It.IsAny <CancellationToken>()))
            .ReturnsAsync(additionalServiceResult);

            var solutionIds = new List <string> {
                solutionId1, solutionId2
            };
            var response = await controller.GetAsync(solutionIds);

            var expected = GetAdditionalServicesResult(additionalServiceResult);

            response.Value.Should().BeEquivalentTo(expected);
        }
Esempio n. 2
0
        public async Task GetAsync_SingleSolutionExists_ReturnsAdditionalService()
        {
            const string solutionId = "sln1";

            var additionalService1 = AdditionalServiceDtoBuilder.Create().WithSolutionId(solutionId).Build();
            IEnumerable <IAdditionalService> additionalServiceResult = new List <IAdditionalService> {
                additionalService1
            };

            mockMediator
            .Setup(m => m.Send(
                       It.IsNotNull <GetAdditionalServiceBySolutionIdsQuery>(),
                       It.IsAny <CancellationToken>()))
            .ReturnsAsync(() => additionalServiceResult);

            IEnumerable <string> solutionIds = new List <string> {
                solutionId
            };
            var response = await controller.GetAsync(solutionIds);

            var expected = GetAdditionalServicesResult(additionalServiceResult);

            response.Value.Should().BeEquivalentTo(expected);
        }