private void UpdateSelfDeclaration(Enrollee enrollee, SelfDeclaration bitmask = SelfDeclaration.NONE) { // update all self-declaration questions enrollee.HasConviction = (bitmask & SelfDeclaration.CONVICTION) == SelfDeclaration.CONVICTION; enrollee.HasDisciplinaryAction = (bitmask & SelfDeclaration.DISCIPLINARY) == SelfDeclaration.DISCIPLINARY; enrollee.HasPharmaNetSuspended = (bitmask & SelfDeclaration.PHARMANET_SUSPENDED) == SelfDeclaration.PHARMANET_SUSPENDED; enrollee.HasRegistrationSuspended = (bitmask & SelfDeclaration.REGISTRATION_SUSPENDED) == SelfDeclaration.REGISTRATION_SUSPENDED; }
private SelfDeclaration GenerateSelfDeclaration(Enrollee enrollee, int selfDeclarationTypeCode) { var decl = new SelfDeclaration { Enrollee = enrollee, EnrolleeId = enrollee.Id, SelfDeclarationTypeCode = selfDeclarationTypeCode, SelfDeclarationDetails = "", }; return(decl); }
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); }