예제 #1
0
        /// <summary>
        /// Determines the type of Agreement to asign to an Enrollee.
        /// May return null if no automatic Agreement Type could be determined.
        /// </summary>
        public static AgreementType?DetermineAgreementType(AgreementEngineDto dto)
        {
            if (dto.Certifications == null || dto.Certifications.Any(c => c.License == null))
            {
                throw new ArgumentException($"Certifications must have Licences loaded.", nameof(dto));
            }

            var certDigest     = CertificationDigest.Create(dto.Certifications);
            var settingsDigest = new SettingsDigest(dto.CareSettingCodes);

            return(certDigest.ResolveWith(settingsDigest));
        }
        public void TestDetermineAgreementType_NoCerts_OneCareSetting(CareSettingType careSetting, AgreementType expectedType)
        {
            // Arrange
            var dto = new AgreementEngineDto
            {
                Certifications   = new CertificationDto[] { },
                CareSettingCodes = new[] { (int)careSetting }
            };

            // Act
            var determinedType = AgreementEngine.DetermineAgreementType(dto);

            // Assert
            Assert.Equal(expectedType, determinedType);
        }