示例#1
0
        public async Task CanSubmitAnonymousRegistration()
        {
            var textContextIdentifier = DateTime.Now.ToShortTimeString();
            List <SecurityQuestion> securityQuestions = new List <SecurityQuestion>();

            securityQuestions.Add(new SecurityQuestion {
                Id = 1, Question = "question1", Answer = "answer1"
            });
            securityQuestions.Add(new SecurityQuestion {
                Id = 2, Question = "question2", Answer = "answer2"
            });
            securityQuestions.Add(new SecurityQuestion {
                Id = 3, Question = "question3", Answer = "answer3"
            });
            var profile = new RegistrantProfile
            {
                UserId            = null,
                Id                = null,
                AuthenticatedUser = false,
                VerifiedUser      = false,
                RestrictedAccess  = false,
                SecurityQuestions = securityQuestions,
                FirstName         = $"PriRegTestFirst-{textContextIdentifier}",
                LastName          = $"PriRegTestLast-{textContextIdentifier}",
                DateOfBirth       = "2000/01/01",
                Gender            = "Female",
                Initials          = "initials1",
                PreferredName     = "preferred1",
                Email             = "*****@*****.**",
                Phone             = "999-999-9999",
                PrimaryAddress    = new Address
                {
                    AddressLine1  = $"paddr1-{textContextIdentifier}",
                    AddressLine2  = "paddr2",
                    Country       = "CAN",
                    StateProvince = "BC",
                    PostalCode    = "v1v 1v1",
                    Community     = "226adfaf-9f97-ea11-b813-005056830319"
                },
                MailingAddress = new Address
                {
                    AddressLine1  = $"maddr1-{textContextIdentifier}",
                    AddressLine2  = "maddr2",
                    Country       = "USA",
                    StateProvince = "WA",
                    PostalCode    = "12345",
                    Community     = "Seattle"
                }
            };
            var needsAssessment = new NeedsAssessment
            {
                HouseholdMembers = new[]
                {
                    new HouseholdMember
                    {
                        Id = null,

                        FirstName   = $"MemRegTestFirst-{textContextIdentifier}",
                        LastName    = $"MemRegTestLast-{textContextIdentifier}",
                        Gender      = "X",
                        DateOfBirth = "2010-01-01"
                    }
                },
                HaveMedication                  = false,
                Insurance                       = InsuranceOption.Yes,
                HaveSpecialDiet                 = true,
                SpecialDietDetails              = "Gluten Free",
                HasPetsFood                     = true,
                CanEvacueeProvideClothing       = false,
                CanEvacueeProvideFood           = true,
                CanEvacueeProvideIncidentals    = null,
                CanEvacueeProvideLodging        = false,
                CanEvacueeProvideTransportation = true,
                Pets = new[]
                {
                    new Pet {
                        Type = $"dog{textContextIdentifier}", Quantity = "4"
                    }
                }
            };
            var cmd = new SubmitAnonymousEvacuationFileCommand
            {
                File = new EvacuationFile
                {
                    EvacuatedFromAddress = new Address
                    {
                        AddressLine1  = $"addr1-{textContextIdentifier}",
                        Country       = "CAN",
                        Community     = "226adfaf-9f97-ea11-b813-005056830319",
                        StateProvince = "BC",
                        PostalCode    = "v1v 1v1"
                    },
                    EvacuationDate   = DateTime.Now,
                    NeedsAssessments = new[] { needsAssessment },
                },
                SubmitterProfile = profile
            };

            var fileId = await manager.Handle(cmd);

            fileId.ShouldNotBeNull();
        }
示例#2
0
        public async Task CanSubmitAnonymousRegistration()
        {
            var textContextIdentifier = Guid.NewGuid().ToString().Substring(0, 4);
            var securityQuestions     = new List <SecurityQuestion>();

            securityQuestions.Add(new SecurityQuestion {
                Id = 1, Question = "question1", Answer = "answer1"
            });
            securityQuestions.Add(new SecurityQuestion {
                Id = 2, Question = "question2", Answer = "answer2"
            });
            securityQuestions.Add(new SecurityQuestion {
                Id = 3, Question = "question3", Answer = "answer3"
            });
            var profile = new RegistrantProfile
            {
                UserId            = null,
                Id                = null,
                AuthenticatedUser = false,
                VerifiedUser      = false,
                RestrictedAccess  = false,
                SecurityQuestions = securityQuestions,
                FirstName         = $"{textContextIdentifier}-PriRegTestFirst",
                LastName          = $"{textContextIdentifier}-PriRegTestLast",
                DateOfBirth       = "2000/01/01",
                Gender            = "Female",
                Initials          = "initials1",
                PreferredName     = "preferred1",
                Email             = "*****@*****.**",
                Phone             = "999-999-9999",
                PrimaryAddress    = new Address
                {
                    AddressLine1  = $"paddr1",
                    AddressLine2  = "paddr2",
                    Country       = "CAN",
                    StateProvince = "BC",
                    PostalCode    = "v1v 1v1",
                    Community     = TestData.RandomCommunity
                },
                MailingAddress = new Address
                {
                    AddressLine1  = $"maddr1",
                    AddressLine2  = "maddr2",
                    Country       = "USA",
                    StateProvince = "WA",
                    PostalCode    = "12345",
                    Community     = "Seattle"
                }
            };
            var needsAssessment = new NeedsAssessment
            {
                HouseholdMembers = new[]
                {
                    new HouseholdMember
                    {
                        IsPrimaryRegistrant = true,
                        FirstName           = profile.FirstName,
                        LastName            = profile.LastName,
                        DateOfBirth         = profile.DateOfBirth,
                        Gender   = profile.Gender,
                        Initials = profile.Initials,
                    },
                    new HouseholdMember
                    {
                        IsPrimaryRegistrant = false,
                        Id          = null,
                        FirstName   = $"{textContextIdentifier}-MemRegTestFirst",
                        LastName    = $"{textContextIdentifier}-MemRegTestLast",
                        Gender      = "X",
                        DateOfBirth = "2010-01-01"
                    }
                },
                TakeMedication           = false,
                HaveMedicalSupplies      = false,
                Insurance                = InsuranceOption.Yes,
                HaveSpecialDiet          = true,
                SpecialDietDetails       = "Gluten Free",
                HavePetsFood             = true,
                CanProvideClothing       = false,
                CanProvideFood           = true,
                CanProvideIncidentals    = null,
                CanProvideLodging        = false,
                CanProvideTransportation = true,
                Pets = new[]
                {
                    new Pet {
                        Type = $"dog{textContextIdentifier}", Quantity = "4"
                    }
                }
            };
            var cmd = new SubmitAnonymousEvacuationFileCommand
            {
                File = new EvacuationFile
                {
                    EvacuatedFromAddress = new Address
                    {
                        AddressLine1  = $"addr1",
                        Country       = "CAN",
                        Community     = TestData.RandomCommunity,
                        StateProvince = "BC",
                        PostalCode    = "v1v 1v1"
                    },
                    NeedsAssessment = needsAssessment,
                },
                SubmitterProfile = profile
            };

            var fileId = (await manager.Handle(cmd)).ShouldNotBeNull();

            var file = (await manager.Handle(new EvacuationFilesQuery {
                FileId = fileId
            })).Items.ShouldHaveSingleItem();

            file.HouseholdMembers.ShouldContain(m => m.IsPrimaryRegistrant == true && m.FirstName == profile.FirstName && m.LastName == profile.LastName);
            file.NeedsAssessment.HouseholdMembers.ShouldContain(m => m.IsPrimaryRegistrant == true && m.FirstName == profile.FirstName && m.LastName == profile.LastName);
            file.NeedsAssessment.HouseholdMembers.ShouldContain(m => m.IsPrimaryRegistrant == false && m.FirstName == $"{textContextIdentifier}-MemRegTestFirst" && m.LastName == $"{textContextIdentifier}-MemRegTestLast");
        }
示例#3
0
        public async Task CanSubmitNewEvacuation()
        {
            var registrant            = (await GetRegistrantByUserId("CHRIS-TEST")).RegistrantProfile;
            var textContextIdentifier = DateTime.Now.ToShortTimeString();
            var needsAssessment       = new NeedsAssessment
            {
                HouseholdMembers = new[]
                {
                    new HouseholdMember
                    {
                        Id = null,

                        FirstName   = $"MemRegTestFirst-{textContextIdentifier}",
                        LastName    = $"MemRegTestLast-{textContextIdentifier}",
                        Gender      = "X",
                        DateOfBirth = "2010-01-01"
                    }
                },
                HaveMedication                  = false,
                Insurance                       = InsuranceOption.Yes,
                HaveSpecialDiet                 = true,
                SpecialDietDetails              = "Gluten Free",
                HasPetsFood                     = true,
                CanEvacueeProvideClothing       = false,
                CanEvacueeProvideFood           = true,
                CanEvacueeProvideIncidentals    = null,
                CanEvacueeProvideLodging        = false,
                CanEvacueeProvideTransportation = true,
                Pets = new[]
                {
                    new Pet {
                        Type = $"dog{textContextIdentifier}", Quantity = "4"
                    }
                }
            };
            var cmd = new SubmitEvacuationFileCommand
            {
                File = new EvacuationFile
                {
                    Id = null,
                    EvacuatedFromAddress = new Address
                    {
                        AddressLine1  = $"addr1-{textContextIdentifier}",
                        Country       = "CAN",
                        Community     = "226adfaf-9f97-ea11-b813-005056830319",
                        StateProvince = "BC",
                        PostalCode    = "v1v 1v1"
                    },
                    EvacuationDate      = DateTime.Now,
                    NeedsAssessments    = new[] { needsAssessment },
                    PrimaryRegistrantId = registrant.Id
                },
            };

            var fileId = await manager.Handle(cmd);

            fileId.ShouldNotBeNull();

            var file = (await GetRegistrantFilesByPrimaryRegistrantId(registrant.Id)).Where(f => f.Id == fileId).ShouldHaveSingleItem();

            file.PrimaryRegistrantId.ShouldBe(registrant.Id);
        }
示例#4
0
        private EvacuationFile CreateTestFile(Contact primaryContact)
        {
            var now = DateTime.UtcNow;
            var uniqueSignature = TestData.TestPrefix + "-" + Guid.NewGuid().ToString().Substring(0, 4);
            var file = new EvacuationFile()
            {
                PrimaryRegistrantId = primaryContact.Id ?? null!,
                EvacuationDate = now,
                TaskId = TestData.ActiveTaskId,
                SecurityPhrase = "secret123",
                SecurityPhraseChanged = true,
                RegistrationLocation = $"{uniqueSignature}_testlocation",

                NeedsAssessment = new NeedsAssessment
                {
                    CompletedOn = now,
                    EvacuatedFrom = new EvacuationAddress()
                    {
                        AddressLine1 = $"{uniqueSignature}_3738 Main St",
                        AddressLine2 = "Suite 3",
                        CommunityCode = TestData.RandomCommunity,
                        PostalCode = "V8V 2W3"
                    },
                    Type = NeedsAssessmentType.Preliminary,
                    TakeMedication = false,
                    HaveMedicalSupplies = false,
                    Insurance = InsuranceOption.Yes,
                    HaveSpecialDiet = true,
                    SpecialDietDetails = "Shellfish allergy",
                    HavePetsFood = true,
                    CanProvideClothing = true,
                    CanProvideFood = true,
                    CanProvideIncidentals = true,
                    CanProvideLodging = true,
                    CanProvideTransportation = true,
                    HouseholdMembers = new[]
                        {
                            new HouseholdMember
                            {
                                FirstName = primaryContact.FirstName,
                                LastName = primaryContact.LastName,
                                Initials = primaryContact.Initials,
                                Gender = primaryContact.Gender,
                                DateOfBirth = primaryContact.DateOfBirth,
                                IsUnder19 = false,
                                IsPrimaryRegistrant = true,
                                LinkedRegistrantId = primaryContact.Id,
                                HasAccessRestriction = false,
                                IsVerifiedRegistrant = true
                            },
                            new HouseholdMember
                            {
                                FirstName = $"{uniqueSignature}_hm1",
                                LastName = "hm1",
                                Initials = $"{uniqueSignature}_1",
                                Gender = "Female",
                                DateOfBirth = "03/11/2000",
                                IsUnder19 = false,
                                IsPrimaryRegistrant = false
                            },
                             new HouseholdMember
                            {
                                FirstName = $"{uniqueSignature}_hm2",
                                LastName = "hm2",
                                Initials = $"{uniqueSignature}_2",
                                Gender = "Male",
                                DateOfBirth = "03/12/2010",
                                IsUnder19 = true,
                                IsPrimaryRegistrant = false
                            }
                        },
                    Pets = new[]
                        {
                            new Pet{ Type = $"{uniqueSignature}_Cat", Quantity = "1" }
                        }
                }
            };
            return file;
        }
    }