public async Task ThenANewOrganisationIsSavedAndReturned()
        {
            var tempSupportRequest = new TempSupportRequest
            {
                Id                 = Guid.NewGuid(),
                ReferenceId        = "REF8765",
                BuildingAndStreet1 = "BS1",
                BuildingAndStreet2 = "BS2",
                TownOrCity         = "TC",
                County             = "C",
                Postcode           = "PC",
                OrganisationName   = "OrgName"
            };
            var result = await Handler.Handle(new GetOrCreateOrganisationRequest(tempSupportRequest), new CancellationToken());

            (await Context.Organisations.CountAsync()).Should().Be(1);
            var savedOrganisation = await Context.Organisations.SingleAsync();

            savedOrganisation.ReferenceId.Should().Be("REF8765");
            savedOrganisation.BuildingAndStreet1.Should().Be("BS1");
            savedOrganisation.BuildingAndStreet2.Should().Be("BS2");
            savedOrganisation.TownOrCity.Should().Be("TC");
            savedOrganisation.County.Should().Be("C");
            savedOrganisation.Postcode.Should().Be("PC");
            savedOrganisation.OrganisationName.Should().Be("OrgName");

            result.Should().Be(savedOrganisation);
        }
        public async Task ThenTheCorrectTempSupportRequestIsReturned()
        {
            var dbContext = ContextHelper.GetInMemoryContext();
            var requiredSupportRequestId = Guid.NewGuid();
            var requestedSupportRequest  = new TempSupportRequest {
                Id = requiredSupportRequestId, OrganisationName = "Org 2"
            };

            await dbContext.TempSupportRequests.AddRangeAsync(new List <TempSupportRequest>
            {
                new TempSupportRequest {
                    Id = Guid.NewGuid(), OrganisationName = "Org 1"
                },
                requestedSupportRequest,
                new TempSupportRequest {
                    Id = Guid.NewGuid(), OrganisationName = "Org 3"
                },
            });

            await dbContext.SaveChangesAsync();

            var handler = new GetTempSupportRequestHandler(dbContext);

            var supportRequest = await handler.Handle(new GetTempSupportRequest(requiredSupportRequestId), CancellationToken.None);

            supportRequest.Should().BeEquivalentTo(requestedSupportRequest);
        }
Beispiel #3
0
        public TempSupportRequest UpdateTempSupportRequest(TempSupportRequest supportRequest)
        {
            supportRequest.OrganisationType      = SelectedOrganisationType;
            supportRequest.OtherOrganisationType = Other;

            return(supportRequest);
        }
        public TempSupportRequest ToTempSupportRequest(TempSupportRequest supportRequest)
        {
            supportRequest.AdditionalComments = AdditionalComments;
            supportRequest.Agree = Agree;

            return(supportRequest);
        }
 public OtherDetailsViewModel(TempSupportRequest supportRequest)
 {
     RequestId          = supportRequest.Id;
     AdditionalComments = supportRequest.AdditionalComments;
     Agree              = supportRequest.Agree;
     Email              = supportRequest.Email;
     DisplayName        = supportRequest.FirstName + " " + supportRequest.LastName;
     SupportRequestType = supportRequest.SupportRequestType;
 }
Beispiel #6
0
        public TempSupportRequest UpdateTempSupportRequest(TempSupportRequest supportRequest)
        {
            supportRequest.FirstName   = FirstName;
            supportRequest.LastName    = LastName;
            supportRequest.JobRole     = JobRole;
            supportRequest.PhoneNumber = PhoneNumber;
            supportRequest.Email       = Email;

            return(supportRequest);
        }
Beispiel #7
0
 public YourDetailsViewModel(TempSupportRequest supportRequest, Guid requestId, bool edit)
 {
     FirstName    = supportRequest.FirstName;
     LastName     = supportRequest.LastName;
     JobRole      = supportRequest.JobRole;
     PhoneNumber  = supportRequest.PhoneNumber;
     Email        = supportRequest.Email;
     ConfirmEmail = supportRequest.Email;
     RequestId    = requestId;
     Edit         = edit;
 }
        public async Task ThenANewContactIsNotSaved()
        {
            var tempSupportRequest = new TempSupportRequest()
            {
                Email = "*****@*****.**"
            };

            await Handler.Handle(new GetOrCreateOrganisationContactRequest(tempSupportRequest, _organisationId), new CancellationToken());

            (await Context.OrganisationContacts.CountAsync()).Should().Be(2);
        }
        public async Task ThenExistingContactIsReturned()
        {
            var tempSupportRequest = new TempSupportRequest()
            {
                Email = "*****@*****.**"
            };

            var result = await Handler.Handle(new GetOrCreateOrganisationContactRequest(tempSupportRequest, _organisationId), new CancellationToken());

            result.Id.Should().Be(_existingContactId);
        }
 public CheckYourDetailsViewModel(TempSupportRequest tempSupportRequest, string numberOfOrgs, string searchTerm)
 {
     RequestId          = tempSupportRequest.Id;
     Name               = $"{tempSupportRequest.FirstName} {tempSupportRequest.LastName}";
     JobRole            = tempSupportRequest.JobRole;
     PhoneNumber        = tempSupportRequest.PhoneNumber;
     Email              = tempSupportRequest.Email;
     OrganisationType   = EnumHelper.GetEnumDescription(tempSupportRequest.OrganisationType);
     OrganisationName   = tempSupportRequest.OrganisationName;
     BuildingAndStreet1 = tempSupportRequest.BuildingAndStreet1;
     BuildingAndStreet2 = tempSupportRequest.BuildingAndStreet2;
     TownOrCity         = tempSupportRequest.TownOrCity;
     County             = tempSupportRequest.County;
     Postcode           = tempSupportRequest.Postcode;
     SupportRequestType = tempSupportRequest.SupportRequestType;
     if (numberOfOrgs != null)
     {
         NumberOfOrgs = (DfeOrganisationCheckResult)int.Parse(numberOfOrgs);
     }
     SearchTerm = searchTerm;
 }
Beispiel #11
0
        public async Task ThenNewContactIsSaved()
        {
            var tempSupportRequest = new TempSupportRequest()
            {
                Email       = "*****@*****.**",
                FirstName   = "Dave",
                LastName    = "Smith",
                PhoneNumber = "080882088008"
            };

            var organisationId = Guid.NewGuid();
            var result         = await Handler.Handle(new GetOrCreateOrganisationContactRequest(tempSupportRequest, organisationId), new CancellationToken());

            (await Context.OrganisationContacts.CountAsync()).Should().Be(1);
            var savedContact = await Context.OrganisationContacts.SingleAsync();

            savedContact.Email.Should().Be("*****@*****.**");
            savedContact.FirstName.Should().Be("Dave");
            savedContact.LastName.Should().Be("Smith");
            savedContact.PhoneNumber.Should().Be("080882088008");
            savedContact.OrganisationId.Should().Be(organisationId);

            result.Should().Be(savedContact);
        }
Beispiel #12
0
 public GetOrCreateOrganisationContactRequest(TempSupportRequest tempSupportRequest, Guid organisationId)
 {
     TempSupportRequest = tempSupportRequest;
     OrganisationId     = organisationId;
 }
Beispiel #13
0
 public GetOrCreateOrganisationRequest(TempSupportRequest tempSupportRequest)
 {
     TempSupportRequest = tempSupportRequest;
 }
 public SubmitSupportRequest(TempSupportRequest tempSupportRequest)
 {
     TempSupportRequest = tempSupportRequest;
 }
Beispiel #15
0
 public OrganisationTypeViewModel(TempSupportRequest supportRequest)
 {
     RequestId = supportRequest.Id;
     Other     = supportRequest.OtherOrganisationType;
     SelectedOrganisationType = supportRequest.OrganisationType;
 }
Beispiel #16
0
 public OrganisationSearchViewModel(TempSupportRequest request, string searchTerms)
 {
     RequestId        = request.Id;
     OrganisationType = EnumHelper.GetEnumDescription(request.OrganisationType);
     Search           = searchTerms;
 }