예제 #1
0
        /// <summary>
        /// Determines if the values are equal.
        /// </summary>
        /// <param name="patientAccountPhone">
        /// The other object.
        /// </param>
        /// <returns>
        /// A boolean denoting equality of the values.
        /// </returns>
        public virtual bool ValuesEqual(PatientAccountPhone patientAccountPhone)
        {
            if (patientAccountPhone == null)
            {
                return(false);
            }

            var valuesEqual =
                Equals(PatientAccountPhoneType.Key, patientAccountPhone.PatientAccountPhoneType.Key) &&
                Equals(Phone, patientAccountPhone.Phone);

            return(valuesEqual);
        }
        /// <summary>
        /// Translates the specified patient phone.
        /// </summary>
        /// <param name="patientPhone">The patient phone.</param>
        /// <returns>A PatientAccountPhone.</returns>
        public PatientAccountPhone Translate(PatientPhone patientPhone)
        {
            if (patientPhone == null)
            {
                return null;
            }

            var patientAccountPhoneTypeWellKnownName = WellKnownNames.PatientAccountModule.PatientAccountPhoneType.Home;

            if (patientPhone.PatientPhoneType.WellKnownName == WellKnownNames.PatientModule.PatientPhoneType.Cell)
            {
                patientAccountPhoneTypeWellKnownName = WellKnownNames.PatientAccountModule.PatientAccountPhoneType.Cell;
            }

            var patientAccountPhoneType = _lookupValueRepository.GetLookupByWellKnownName<PatientAccountPhoneType>(patientAccountPhoneTypeWellKnownName);

            var patientAccountPhone = new PatientAccountPhone(patientAccountPhoneType, new Phone(patientPhone.PhoneNumber, patientPhone.PhoneExtensionNumber));

            return patientAccountPhone;
        }
예제 #3
0
        /// <summary>
        /// Determines if the values are equal.
        /// </summary>
        /// <param name="patientAccountPhone">
        /// The other object.
        /// </param>
        /// <returns>
        /// A boolean denoting equality of the values.
        /// </returns>            
        public virtual bool ValuesEqual(PatientAccountPhone patientAccountPhone)
        {
            if (patientAccountPhone == null)
            {
                return false;
            }

            var valuesEqual =
                Equals ( PatientAccountPhoneType.Key, patientAccountPhone.PatientAccountPhoneType.Key ) &&
                Equals ( Phone, patientAccountPhone.Phone );

            return valuesEqual;
        }
예제 #4
0
        public void RevisePhones_GivenAPhoneListAndPatientAccountHasPhones_RevisesPhonesCorrectly()
        {
            // Setup
            var fixture = new Fixture().Customize(new AutoMoqCustomization());
            var address = new Address (
                fixture.CreateAnonymous<string> (),
                fixture.CreateAnonymous<string> (),
                fixture.CreateAnonymous<string> (),
                new Mock<CountyArea> ().Object,
                new Mock<StateProvince> ().Object,
                new Mock<Country> ().Object,
                new PostalCode ( "21046" ) );
            var patientAccount = new PatientAccount (
                new Mock<BillingOffice> ().Object,
                fixture.CreateAnonymous<long> (),
                fixture.CreateAnonymous<PersonName> (),
                fixture.CreateAnonymous<DateTime> (),
                address,
                new Mock<AdministrativeGender> ().Object );

            var patientAccountPhoneType1 = new Mock<PatientAccountPhoneType> ();
            patientAccountPhoneType1.SetupGet ( p => p.Key ).Returns ( fixture.CreateAnonymous<long> () );

            var patientAccountPhoneType2 = new Mock<PatientAccountPhoneType> ();
            patientAccountPhoneType2.SetupGet ( p => p.Key ).Returns ( fixture.CreateAnonymous<long> () );

            var patientAccountPhoneType3 = new Mock<PatientAccountPhoneType> ();
            patientAccountPhoneType3.SetupGet ( p => p.Key ).Returns ( fixture.CreateAnonymous<long> () );

            var phone = fixture.CreateAnonymous<Phone> ();

            var patientAccountPhone1 = new PatientAccountPhone ( patientAccountPhoneType1.Object, phone );
            var sameAsPatientAccountPhone1 = new PatientAccountPhone(patientAccountPhoneType1.Object, phone);

            var patientAccountPhone2 = new PatientAccountPhone(patientAccountPhoneType2.Object, phone);

            var patientAccountPhone3 = new PatientAccountPhone(patientAccountPhoneType3.Object, phone);

            var initialPhoneList = new List<PatientAccountPhone> { patientAccountPhone1, patientAccountPhone2 };
            patientAccount.RevisePhones(initialPhoneList);

            var inputPhoneList = new List<PatientAccountPhone> { sameAsPatientAccountPhone1, patientAccountPhone3 };

            // Exercise
            patientAccount.RevisePhones(inputPhoneList);

            // Verify
            Assert.AreEqual(2, patientAccount.Phones.Count());
            Assert.IsTrue(patientAccount.Phones.Contains(patientAccountPhone1));
            Assert.IsFalse(patientAccount.Phones.Contains(patientAccountPhone2));
            Assert.IsTrue(patientAccount.Phones.Contains(patientAccountPhone3));
        }