public async Task get_list_of_whos_in_control_submitted_when_AddPeopleInControl_tag_filled(string name1, string dateOfBirth1, string name2, string dateOfBirth2)
        {
            var expectedPersonInControl2 = new PersonInControl {
                Name = name1, MonthYearOfBirth = dateOfBirth1
            };
            var expectedPersonInControl1 = new PersonInControl {
                Name = name2, MonthYearOfBirth = dateOfBirth2
            };

            var consumedTabularData = new TabularData
            {
                DataRows = new List <TabularDataRow>
                {
                    new TabularDataRow {
                        Columns = new List <string> {
                            name1, dateOfBirth1
                        }
                    },
                    new TabularDataRow {
                        Columns = new List <string> {
                            name2, dateOfBirth2
                        }
                    }
                }
            };

            _qnaApiClient
            .Setup(x => x.GetTabularDataByTag(_applicationId, RoatpWorkflowQuestionTags.AddPeopleInControl))
            .ReturnsAsync(consumedTabularData);

            _qnaApiClient
            .Setup(x => x.GetTabularDataByTag(_applicationId, RoatpWorkflowQuestionTags.AddPartners))
            .ReturnsAsync((TabularData)null);

            _qnaApiClient
            .Setup(x => x.GetAnswerByTag(_applicationId, RoatpWorkflowQuestionTags.SoleTradeDob, null))
            .ReturnsAsync((Answer)null);

            _qnaApiClient
            .Setup(x => x.GetAnswerByTag(_applicationId, RoatpWorkflowQuestionTags.UkrlpLegalName, null))
            .ReturnsAsync((Answer)null);

            var result = await _controller.GetWhosInControlFromSubmitted(_applicationId) as OkObjectResult;

            result.Value.Should().BeOfType <List <PersonInControl> >();
            var peopleInControl = (List <PersonInControl>)result.Value;

            Assert.AreEqual(2, peopleInControl.Count);
            Assert.AreEqual(peopleInControl[0].Name, expectedPersonInControl1.Name);
            Assert.AreEqual(peopleInControl[0].MonthYearOfBirth, expectedPersonInControl1.MonthYearOfBirth);
            Assert.AreEqual(peopleInControl[1].Name, expectedPersonInControl2.Name);
            Assert.AreEqual(peopleInControl[1].MonthYearOfBirth, expectedPersonInControl2.MonthYearOfBirth);

            _qnaApiClient.Verify(x => x.GetTabularDataByTag(_applicationId, RoatpWorkflowQuestionTags.AddPeopleInControl), Times.Once);
            _qnaApiClient.Verify(x => x.GetTabularDataByTag(It.IsAny <Guid>(), RoatpWorkflowQuestionTags.AddPartners), Times.Never);
            _qnaApiClient.Verify(x => x.GetAnswerByTag(It.IsAny <Guid>(), RoatpWorkflowQuestionTags.SoleTradeDob, null), Times.Never);
            _qnaApiClient.Verify(x => x.GetAnswerByTag(It.IsAny <Guid>(), RoatpWorkflowQuestionTags.UkrlpLegalName, null), Times.Never);
        }
コード例 #2
0
        public async Task get_list_of_trustees_from_apply(string name1, string name2)
        {
            var expectedPersonInControl2 = new PersonInControl {
                Name = name1, MonthYearOfBirth = null
            };
            var expectedPersonInControl1 = new PersonInControl {
                Name = name2, MonthYearOfBirth = null
            };

            var application = new Apply
            {
                ApplicationId = _applicationId,
                ApplyData     = new ApplyData
                {
                    GatewayReviewDetails = new ApplyGatewayDetails
                    {
                        CharityCommissionDetails = new CharityCommissionSummary
                        {
                            Trustees = new List <Trustee>
                            {
                                new Trustee {
                                    Name = name1
                                },
                                new Trustee {
                                    Name = name2
                                }
                            }
                        }
                    }
                }
            };

            _mediator.Setup(x => x.Send(It.IsAny <GetApplicationRequest>(), It.IsAny <CancellationToken>())).ReturnsAsync(application);

            var result = await _controller.GetTrusteesFromCharityCommission(_applicationId) as OkObjectResult;

            result.Value.Should().BeOfType <List <PersonInControl> >();
            var peopleInControl = (List <PersonInControl>)result.Value;

            Assert.AreEqual(2, peopleInControl.Count);
            Assert.AreEqual(peopleInControl[0].Name, expectedPersonInControl1.Name);
            Assert.AreEqual(peopleInControl[0].MonthYearOfBirth, expectedPersonInControl1.MonthYearOfBirth);
            Assert.AreEqual(peopleInControl[1].Name, expectedPersonInControl2.Name);
            Assert.AreEqual(peopleInControl[1].MonthYearOfBirth, expectedPersonInControl2.MonthYearOfBirth);
        }
コード例 #3
0
        public async Task get_list_of_company_directors_from_apply(string name1, DateTime?dateOfBirth1, string name2, DateTime?dateOfBirth2)
        {
            var expectedPersonInControl2 = new PersonInControl {
                Name = name1, MonthYearOfBirth = $"{dateOfBirth1:MMM yyyy}"
            };
            var expectedPersonInControl1 = new PersonInControl {
                Name = name2, MonthYearOfBirth = $"{dateOfBirth2:MMM yyyy}"
            };

            var application = new Apply
            {
                ApplicationId = _applicationId,
                ApplyData     = new ApplyData
                {
                    GatewayReviewDetails = new ApplyGatewayDetails
                    {
                        CompaniesHouseDetails = new CompaniesHouseSummary
                        {
                            Directors = new List <DirectorInformation>
                            {
                                new DirectorInformation {
                                    Name = name1, DateOfBirth = dateOfBirth1
                                },
                                new DirectorInformation {
                                    Name = name2, DateOfBirth = dateOfBirth2
                                }
                            }
                        }
                    }
                }
            };

            _mediator.Setup(x => x.Send(It.IsAny <GetApplicationRequest>(), It.IsAny <CancellationToken>())).ReturnsAsync(application);

            var result = await _controller.GetDirectorsFromCompaniesHouse(_applicationId) as OkObjectResult;

            result.Value.Should().BeOfType <List <PersonInControl> >();
            var peopleInControl = (List <PersonInControl>)result.Value;

            Assert.AreEqual(2, peopleInControl.Count);
            Assert.AreEqual(peopleInControl[0].Name, expectedPersonInControl1.Name);
            Assert.AreEqual(peopleInControl[0].MonthYearOfBirth, expectedPersonInControl1.MonthYearOfBirth);
            Assert.AreEqual(peopleInControl[1].Name, expectedPersonInControl2.Name);
            Assert.AreEqual(peopleInControl[1].MonthYearOfBirth, expectedPersonInControl2.MonthYearOfBirth);
        }
        public async Task get_list_of_whos_in_control_submitted_when_SoleTradeDob_tag_filled(string legalName, string soleTraderDob, string formattedDob)
        {
            var expectedPersonInControl1 = new PersonInControl {
                Name = legalName, MonthYearOfBirth = soleTraderDob
            };

            _qnaApiClient
            .Setup(x => x.GetTabularDataByTag(_applicationId, RoatpWorkflowQuestionTags.AddPeopleInControl))
            .ReturnsAsync((TabularData)null);

            _qnaApiClient
            .Setup(x => x.GetTabularDataByTag(_applicationId, RoatpWorkflowQuestionTags.AddPartners))
            .ReturnsAsync((TabularData)null);

            _qnaApiClient
            .Setup(x => x.GetAnswerByTag(_applicationId, RoatpWorkflowQuestionTags.SoleTradeDob, null))
            .ReturnsAsync(new Answer {
                Value = soleTraderDob
            });

            _qnaApiClient
            .Setup(x => x.GetAnswerByTag(_applicationId, RoatpWorkflowQuestionTags.UkrlpLegalName, null))
            .ReturnsAsync(new Answer {
                Value = legalName
            });

            var result = await _controller.GetWhosInControlFromSubmitted(_applicationId) as OkObjectResult;

            result.Value.Should().BeOfType <List <PersonInControl> >();
            var peopleInControl = (List <PersonInControl>)result.Value;

            Assert.AreEqual(1, peopleInControl.Count);
            Assert.AreEqual(peopleInControl[0].Name, expectedPersonInControl1.Name);
            Assert.AreEqual(peopleInControl[0].MonthYearOfBirth, formattedDob);

            _qnaApiClient.Verify(
                x => x.GetTabularDataByTag(_applicationId, RoatpWorkflowQuestionTags.AddPeopleInControl), Times.Once);
            _qnaApiClient.Verify(x => x.GetTabularDataByTag(_applicationId, RoatpWorkflowQuestionTags.AddPartners),
                                 Times.Once);
            _qnaApiClient.Verify(x => x.GetAnswerByTag(It.IsAny <Guid>(), RoatpWorkflowQuestionTags.SoleTradeDob, null),
                                 Times.Once);
            _qnaApiClient.Verify(
                x => x.GetAnswerByTag(It.IsAny <Guid>(), RoatpWorkflowQuestionTags.UkrlpLegalName, null), Times.Once);
        }
コード例 #5
0
        public async Task get_list_of_trustees_submitted(string name1, string dateOfBirth1, string name2, string dateOfBirth2)
        {
            var expectedPersonInControl2 = new PersonInControl {
                Name = name1, MonthYearOfBirth = dateOfBirth1
            };
            var expectedPersonInControl1 = new PersonInControl {
                Name = name2, MonthYearOfBirth = dateOfBirth2
            };

            var consumedTabularData = new TabularData
            {
                DataRows = new List <TabularDataRow>
                {
                    new TabularDataRow {
                        Columns = new List <string> {
                            name1, dateOfBirth1
                        }
                    },
                    new TabularDataRow {
                        Columns = new List <string> {
                            name2, dateOfBirth2
                        }
                    }
                }
            };

            _qnaApiClient
            .Setup(x => x.GetTabularDataByTag(_applicationId, RoatpWorkflowQuestionTags.CharityCommissionTrustees))
            .ReturnsAsync(consumedTabularData);

            var result = await _controller.GetTrusteesFromSubmitted(_applicationId) as OkObjectResult;

            result.Value.Should().BeOfType <List <PersonInControl> >();
            var peopleInControl = (List <PersonInControl>)result.Value;

            Assert.AreEqual(2, peopleInControl.Count);
            Assert.AreEqual(peopleInControl[0].Name, expectedPersonInControl1.Name);
            Assert.AreEqual(peopleInControl[0].MonthYearOfBirth, expectedPersonInControl1.MonthYearOfBirth);
            Assert.AreEqual(peopleInControl[1].Name, expectedPersonInControl2.Name);
            Assert.AreEqual(peopleInControl[1].MonthYearOfBirth, expectedPersonInControl2.MonthYearOfBirth);
        }