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); }
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); }