Ejemplo n.º 1
0
        public async Task ManageOrganisationHandler_OrganisationNotExists_CreateOrganisaton()
        {
            var userId  = Guid.NewGuid();
            var request = new ManageOrganisationRequest
            {
                Name                = "Test",
                OrganisationType    = "Test",
                OrganisationUkprn   = 10003000,
                RoATPApproved       = true,
                CreatedBy           = Guid.NewGuid(),
                PrimaryContactEmail = "*****@*****.**"
            };
            var organisationDetails = new OrganisationDetails
            {
                TradingName   = "Trading name",
                CompanyNumber = "12322322",
                CharityNumber = "2232332",
                Address1      = "T1",
                Address2      = "T2",
                Address3      = "T3",
                City          = "Test",
                Postcode      = "DD12TT"
            };

            request.OrganisationDetails = organisationDetails;
            _organisationRepository.Setup(x => x.GetOrganisationByName(It.IsAny <string>())).ReturnsAsync(() => null);
            _organisationRepository.Setup(x => x.CreateOrganisation(It.IsAny <Organisation>())).ReturnsAsync(() => Guid.NewGuid());

            var result = await _handler.Handle(request, new CancellationToken());

            result.Should().NotBeNull();
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <Organisation> > CreateOrganisation([FromBody] ManageOrganisationRequest request)
        {
            var org = await _mediator.Send(request);

            if (org is null)
            {
                return(BadRequest());
            }

            return(Ok(org));
        }