Exemplo n.º 1
0
 private EvacuationFile CreateNewTestEvacuationFile(RegistrantProfile registrant) => TestHelper.CreateNewTestEvacuationFile(registrant);
Exemplo n.º 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");
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
0
 public EvacuationFileTests(ITestOutputHelper output, DynamicsWebAppFixture fixture) : base(output, fixture)
 {
     manager    = Services.GetRequiredService <EventsManager>();
     registrant = GetTestRegistrant().GetAwaiter().GetResult().ShouldNotBeNull();
 }
Exemplo n.º 5
0
 private EvacuationFile CreateNewTestEvacuationFile(RegistrantProfile registrant) => TestHelper.CreateNewTestEvacuationFile(TestData.TestPrefix, registrant);
Exemplo n.º 6
0
 public static async Task <string> SaveRegistrant(EventsManager manager, RegistrantProfile registrantProfile) =>
 await manager.Handle(new SaveRegistrantCommand { Profile = registrantProfile });
Exemplo n.º 7
0
        public static EvacuationFile CreateNewTestEvacuationFile(RegistrantProfile registrant)
        {
            var uniqueSignature = Guid.NewGuid().ToString().Substring(0, 4);
            var file            = new EvacuationFile()
            {
                PrimaryRegistrantId   = registrant.Id,
                SecurityPhrase        = "SecretPhrase",
                SecurityPhraseChanged = true,
                RelatedTask           = new IncidentTask {
                    Id = "0001"
                },
                EvacuatedFromAddress = new Address()
                {
                    AddressLine1  = $"{uniqueSignature}-3738 Main St",
                    AddressLine2  = "Suite 3",
                    Community     = "9e6adfaf-9f97-ea11-b813-005056830319",
                    StateProvince = "BC",
                    Country       = "CAN",
                    PostalCode    = "V8V 2W3"
                },
                NeedsAssessment =
                    new NeedsAssessment
                {
                    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           = registrant.FirstName,
                            LastName            = registrant.LastName,
                            Initials            = registrant.Initials,
                            Gender              = registrant.Gender,
                            DateOfBirth         = registrant.DateOfBirth,
                            IsPrimaryRegistrant = true,
                            LinkedRegistrantId  = registrant.Id
                        },
                        new HouseholdMember
                        {
                            FirstName           = $"{uniqueSignature}-hm1first",
                            LastName            = $"{uniqueSignature}-hm1last",
                            Initials            = $"{uniqueSignature}-1",
                            Gender              = "X",
                            DateOfBirth         = "03/15/2000",
                            IsUnder19           = false,
                            IsPrimaryRegistrant = false
                        },
                        new HouseholdMember
                        {
                            FirstName           = $"{uniqueSignature}-hm2first",
                            LastName            = $"{uniqueSignature}-hm2last",
                            Initials            = $"{uniqueSignature}-2",
                            Gender              = "M",
                            DateOfBirth         = "03/16/2010",
                            IsUnder19           = true,
                            IsPrimaryRegistrant = false
                        }
                    },
                    Pets = new[]
                    {
                        new Pet {
                            Type = $"{uniqueSignature}_Cat", Quantity = "1"
                        },
                        new Pet {
                            Type = $"{uniqueSignature}_Dog", Quantity = "4"
                        }
                    },
                    Notes = new[]
                    {
                        new Note {
                            Type = NoteType.EvacuationImpact, Content = "evac"
                        },
                        new Note {
                            Type = NoteType.EvacuationExternalReferrals, Content = "refer"
                        },
                        new Note {
                            Type = NoteType.PetCarePlans, Content = "pat plans"
                        },
                        new Note {
                            Type = NoteType.RecoveryPlan, Content = "recovery"
                        },
                    }
                }
            };

            return(file);
        }
Exemplo n.º 8
0
        private static RegistrantProfile[] InitializeRegistrants()
        {
            RegistrantProfile[] ret = new RegistrantProfile[3];
            ret[0] = new RegistrantProfile
            {
                SecurityQuestions = InitializeSecurityQuestions(),
                RestrictedAccess  = false,
                MailingAddress    = new Address
                {
                    AddressLine1  = "123 fake st",
                    AddressLine2  = "",
                    Community     = "community 1",
                    StateProvince = "BC",
                    Country       = "CAN",
                    PostalCode    = "v2v 2v2"
                },
                PrimaryAddress = new Address
                {
                    AddressLine1  = "100 Test Rd",
                    AddressLine2  = "",
                    Community     = "community",
                    StateProvince = "BC",
                    Country       = "CAN",
                    PostalCode    = "V2V2V2"
                },
                Phone             = "6049877897",
                Email             = "*****@*****.**",
                DateOfBirth       = "1985-08-22",
                Gender            = "Male",
                PreferredName     = "",
                Initials          = "",
                LastName          = "Smith",
                FirstName         = "John",
                UserId            = "Test-1",
                Id                = "123-abc",
                AuthenticatedUser = true,
                VerifiedUser      = true
            };
            ret[1] = new RegistrantProfile
            {
                SecurityQuestions = InitializeSecurityQuestions(),
                RestrictedAccess  = false,
                MailingAddress    = new Address
                {
                    AddressLine1  = "1234 fake st",
                    AddressLine2  = "",
                    Community     = "community 1",
                    StateProvince = "BC",
                    Country       = "CAN",
                    PostalCode    = "v2v 2v2"
                },
                PrimaryAddress = new Address
                {
                    AddressLine1  = "1001 Test Rd",
                    AddressLine2  = "",
                    Community     = "community",
                    StateProvince = "BC",
                    Country       = "CAN",
                    PostalCode    = "V2V2V2"
                },
                Phone             = "7789877897",
                Email             = "*****@*****.**",
                DateOfBirth       = "1992-08-22",
                Gender            = "Female",
                PreferredName     = "",
                Initials          = "",
                LastName          = "Doe",
                FirstName         = "Jane",
                UserId            = "Test-2",
                Id                = "222-bcd",
                AuthenticatedUser = true,
                VerifiedUser      = true
            };
            ret[2] = new RegistrantProfile
            {
                SecurityQuestions = InitializeSecurityQuestions(),
                RestrictedAccess  = false,
                MailingAddress    = new Address
                {
                    AddressLine1  = "455 fake st",
                    AddressLine2  = "",
                    Community     = "community 1",
                    StateProvince = "BC",
                    Country       = "CAN",
                    PostalCode    = "v2v 2v2"
                },
                PrimaryAddress = new Address
                {
                    AddressLine1  = "455 Test Rd",
                    AddressLine2  = "",
                    Community     = "community",
                    StateProvince = "BC",
                    Country       = "CAN",
                    PostalCode    = "V2V2V2"
                },
                Phone             = "5559877897",
                Email             = "*****@*****.**",
                DateOfBirth       = "1999-08-22",
                Gender            = "X",
                PreferredName     = "",
                Initials          = "",
                LastName          = "Jones",
                FirstName         = "Jack",
                UserId            = "Test-3",
                Id                = "321-zyx",
                AuthenticatedUser = true,
                VerifiedUser      = true
            };

            return(ret);
        }