public void CreateMedicalVendorInvoiceReturnsMedicalVendorInvoice()
        {
            var medicalVendorInvoiceItemEntities = new EntityCollection <PhysicianInvoiceItemEntity>();

            Expect.Call(_medicalVendorInvoiceItemFactory.CreateMedicalVendorInvoiceItems(medicalVendorInvoiceItemEntities))
            .Return(new List <MedicalVendorInvoiceItem>());
            Expect.Call(() => _medicalVendorInvoiceBaseFactory.SetMedicalVendorInvoiceBaseFields(null, null)).IgnoreArguments();

            _mocks.ReplayAll();
            PhysicianInvoice medicalVendorInvoice = _medicalVendorInvoiceFactory.CreateMedicalVendorInvoice
                                                        (new PhysicianInvoiceEntity(), medicalVendorInvoiceItemEntities);

            _mocks.VerifyAll();

            Assert.IsNotNull(medicalVendorInvoice);
        }
        public PhysicianInvoice CreateMedicalVendorInvoice(PhysicianInvoiceEntity medicalVendorInvoiceEntity,
                                                           List <MedicalVendorInvoiceItem> medicalVendorInvoiceItems)
        {
            if (medicalVendorInvoiceEntity == null)
            {
                throw new ArgumentNullException("medicalVendorInvoiceEntity", "The given MedicalVendorInvoiceEntity cannot be null.");
            }
            if (medicalVendorInvoiceItems == null)
            {
                throw new ArgumentNullException("medicalVendorInvoiceEntity", "The given list of MedicalVendorInvoiceItems cannot be null.");
            }
            var medicalVendorInvoice = new PhysicianInvoice(medicalVendorInvoiceEntity.PhysicianInvoiceId)
            {
                MedicalVendorInvoiceItems = medicalVendorInvoiceItems
            };

            _medicalVendorInvoiceBaseFactory.SetMedicalVendorInvoiceBaseFields(medicalVendorInvoice, medicalVendorInvoiceEntity);
            return(medicalVendorInvoice);
        }
Exemple #3
0
        public MedicalVendorInvoiceStatistic CreateMedicalVendorInvoiceStatistic(PhysicianInvoiceEntity medicalVendorInvoiceEntity,
                                                                                 DataRow invoiceItemStatisticsForInvoice)
        {
            if (medicalVendorInvoiceEntity == null)
            {
                throw new ArgumentNullException("medicalVendorInvoiceEntity");
            }
            var invoiceAmount           = invoiceItemStatisticsForInvoice.Field <decimal>("InvoiceAmount");
            var numberOfEvaluations     = invoiceItemStatisticsForInvoice.Field <int>("NumberOfEvaluations");
            var evaluationStartTime     = invoiceItemStatisticsForInvoice.Field <DateTime?>("EvaluationStartTime");
            var evaluationEndTime       = invoiceItemStatisticsForInvoice.Field <DateTime?>("EvaluationEndTime");
            var evaluationTimeInMinutes = (evaluationStartTime.HasValue && evaluationEndTime.HasValue) ?
                                          (decimal)(evaluationEndTime.Value - evaluationStartTime.Value).TotalMinutes : 0;
            var averageHourlyRate             = evaluationTimeInMinutes != 0 ? invoiceAmount / evaluationTimeInMinutes : 0;
            var medicalVendorInvoiceStatistic = new MedicalVendorInvoiceStatistic(medicalVendorInvoiceEntity.PhysicianInvoiceId, invoiceAmount,
                                                                                  numberOfEvaluations, averageHourlyRate);

            _medicalVendorInvoiceBaseFactory.SetMedicalVendorInvoiceBaseFields(medicalVendorInvoiceStatistic, medicalVendorInvoiceEntity);
            return(medicalVendorInvoiceStatistic);
        }