コード例 #1
0
        public GetConditionsResponse GetConditions(GetConditionsRequest request)
        {
            GetConditionsResponse response = new GetConditionsResponse();
            IEnumerable <dynamic> conditions;

            conditions = leadScoreRuleRepository.GetConditions(request.Id);
            if (conditions == null)
            {
                throw new ResourceNotFoundException("[|The requested condition list was not found.|]");
            }
            response.Conditions = conditions;
            return(response);
        }
コード例 #2
0
        public async Task <GetConditionsResponse> GetConditions(GetConditionsRequest request)
        {
            var illnesses = await _hospitalRepository.SearchIllnesses(new SearchIllnessesRequest
            {
                IllnessName = request.Name,
                PageIndex   = request.PageIndex
            });

            return(new GetConditionsResponse
            {
                Data = illnesses.Data,
                PrevPageIndex = illnesses.PrevPageIndex,
                NextPageIndex = illnesses.NextPageIndex
            });
        }
コード例 #3
0
        public async void GetConditions_Should_Call_IBittnService_GetConditions()
        {
            var service = Substitute.For <IBittnService>();
            GetConditionsRequest arg = null;

            service.GetConditions(Arg.Do <GetConditionsRequest>(a => arg = a)).Returns(new GetConditionsResponse());

            var name = "name";
            var page = 1;
            await _controller.GetConditions(name, page, service);

            await service.Received(1).GetConditions(Arg.Any <GetConditionsRequest>());

            arg.Name.Should().Be(name);
            arg.PageIndex.Should().Be(page);
            arg.SortField.Should().BeNull();
            arg.SortDescending.Should().BeNull();
        }
コード例 #4
0
        public async void GetConditions_Should_Call_IHospitalRepository_SearchIllnesses()
        {
            SearchIllnessesRequest arg = null;

            _hospitalRepository.SearchIllnesses(Arg.Do <SearchIllnessesRequest>(a => arg = a)).Returns(new SearchIllnessesResponse());

            var request = new GetConditionsRequest
            {
                Name      = "name",
                PageIndex = 123
            };

            await _service.GetConditions(request);

            await _hospitalRepository.Received(1).SearchIllnesses(Arg.Any <SearchIllnessesRequest>());

            arg.ItemsPerPage.Should().BeNull();
            arg.IllnessName.Should().Be(request.Name);
            arg.PageIndex.Should().Be(request.PageIndex);
        }