public async void TestAllowableChangesRule_Jobs(bool isObo, bool expected) { Enrollee enrollee = TestUtils.EnrolleeFaker.Generate(); if (isObo) { enrollee.Certifications.Clear(); } else { enrollee.Certifications = new Certification[] { new Certification() }; } // New job EnrolleeUpdateModel profile = enrollee.ToUpdateModel(); profile.Jobs.Add(new Job { Title = "Snake sweater knitter" }); await AssertAllowableChanges(expected, enrollee, profile); // Edit job profile = enrollee.ToUpdateModel(); profile.Jobs.First().Title = "Bespoke lifehack crafter"; await AssertAllowableChanges(expected, enrollee, profile); // Remove job profile = enrollee.ToUpdateModel(); profile.Jobs = profile.Jobs.Skip(1).ToList(); await AssertAllowableChanges(expected, enrollee, profile); }
public async void TestAllowableChangesRule_SimpleDissallowedChange_SimpleProperty() { Enrollee enrollee = TestUtils.EnrolleeFaker.Generate(); EnrolleeUpdateModel profile = enrollee.ToUpdateModel(); profile.PreferredFirstName = "BIG CHANGES"; await AssertAllowableChanges(false, enrollee, profile); }
public async void TestAllowableChangesRule_SimpleDissallowedChange_AddChildObject() { Enrollee enrollee = TestUtils.EnrolleeFaker.Generate(); EnrolleeUpdateModel profile = enrollee.ToUpdateModel(); enrollee.MailingAddress = null; await AssertAllowableChanges(false, enrollee, profile); }
public async void TestAllowableChangesRule_SimpleDissallowedChange_PropertyOnChildObject() { Enrollee enrollee = TestUtils.EnrolleeFaker.Generate(); EnrolleeUpdateModel profile = enrollee.ToUpdateModel(); profile.MailingAddress.City = "Flavortown, USA"; await AssertAllowableChanges(false, enrollee, profile); }
public async void TestAllowableChangesRule_AllowedUpdates() { Enrollee enrollee = TestUtils.EnrolleeFaker.Generate(); EnrolleeUpdateModel profile = enrollee.ToUpdateModel(); profile.Email += "change"; profile.SmsPhone += "change"; profile.Phone += "change"; profile.PhoneExtension += "change"; await AssertAllowableChanges(true, enrollee, profile); }
public async void TestAllowableChangesRule_EnrolleeCareSettings() { Enrollee enrollee = TestUtils.EnrolleeFaker.Generate(); // New org EnrolleeUpdateModel profile = enrollee.ToUpdateModel(); profile.EnrolleeCareSettings.Add(new EnrolleeCareSetting { CareSettingCode = 1 }); await AssertAllowableChanges(false, enrollee, profile); // Edit org profile = enrollee.ToUpdateModel(); profile.EnrolleeCareSettings.First().CareSettingCode++; await AssertAllowableChanges(false, enrollee, profile); // Remove org profile = enrollee.ToUpdateModel(); profile.EnrolleeCareSettings = profile.EnrolleeCareSettings.Skip(1).ToList(); await AssertAllowableChanges(false, enrollee, profile); }
public async void TestAllowableChangesRule_Certifications() { Enrollee enrollee = TestUtils.EnrolleeFaker.Generate(); // New cert EnrolleeUpdateModel profile = enrollee.ToUpdateModel(); profile.Certifications.Add(new Certification { CollegeCode = 1 }); await AssertAllowableChanges(false, enrollee, profile); // Edit cert profile = enrollee.ToUpdateModel(); profile.Certifications.First().LicenseNumber += "6"; await AssertAllowableChanges(false, enrollee, profile); // Remove cert profile = enrollee.ToUpdateModel(); profile.Certifications = profile.Certifications.Skip(1).ToList(); await AssertAllowableChanges(false, enrollee, profile); }
public async void TestAllowableChangesRule_SelfDeclarations_ModifySingle(SelfDeclarationType declarationType) { Enrollee enrollee = TestUtils.EnrolleeFaker.Generate(); var declaration = new SelfDeclaration { SelfDeclarationType = declarationType, SelfDeclarationTypeCode = declarationType.Code, SelfDeclarationDetails = "I did a thing" }; enrollee.SelfDeclarations = new[] { declaration }; // New declaration EnrolleeUpdateModel profile = enrollee.ToUpdateModel(); profile.SelfDeclarations.Add(new SelfDeclaration { SelfDeclarationTypeCode = (declaration.SelfDeclarationTypeCode % 4) + 1 // Pick a different code that exists }); await AssertAllowableChanges(false, enrollee, profile); // Edit declaration profile = enrollee.ToUpdateModel(); profile.SelfDeclarations.Single().SelfDeclarationDetails += "and another thing..."; await AssertAllowableChanges(false, enrollee, profile); // Remove declaration profile = enrollee.ToUpdateModel(); profile.SelfDeclarations.Clear(); await AssertAllowableChanges(false, enrollee, profile); // Any document GUID in a self declaration update should be considered a change (even if it somehow matches an existing document) declaration.DocumentGuids = new[] { new Guid() }; profile = enrollee.ToUpdateModel(); await AssertAllowableChanges(false, enrollee, profile); }
public async void TestAllowableChangesRule_SelfDeclarations_AddToEmpty(SelfDeclarationType declarationType) { Enrollee enrollee = TestUtils.EnrolleeFaker.Generate(); enrollee.SelfDeclarations = new List <SelfDeclaration>(); EnrolleeUpdateModel profile = enrollee.ToUpdateModel(); profile.SelfDeclarations.Add(new SelfDeclaration { SelfDeclarationTypeCode = declarationType.Code, SelfDeclarationDetails = "I did stuffs" }); await AssertAllowableChanges(false, enrollee, profile); }