public void returns_timespans_for_provider_location()
        {
            //setup
            var request = new ListProviderOrgUnitScheduleRequest();
            request.ProviderOrgUnitId = _idWith5Schedules;
            var handler = CreateHandler();

            //act
            var response = HandleRequest<ListProviderOrgUnitScheduleResponse>(handler, request);

            //assert
            Assert.IsTrue(response.ScheduleTimeSpans.Count() == 5);
        }
        public void includes_provider_and_location_name_in_response()
        {
            //setup
            var request = new ListProviderOrgUnitScheduleRequest();
            request.ProviderOrgUnitId = _idWith0Schedules;
            var handler = CreateHandler();

            //act
            var response = HandleRequest<ListProviderOrgUnitScheduleResponse>(handler, request);

            //assert
            Assert.AreEqual(_providerName, response.ProviderName);
            Assert.AreEqual("Third Location Published", response.OrgUnitName);
        }
        private static SubEntity BuildHoursSubEntity(ProviderAdminDetailView parent, ProviderOrgUnitDto providerOrgUnit)
        {
            var subEntity = new SubEntity() { EntityName = _hoursSubEntity, DisplayName = "Hours", CanCreateNew = true, CanDelete = true };

            var scheduleRequest = new ListProviderOrgUnitScheduleRequest()
            {
                ProviderOrgUnitId = providerOrgUnit.Id
            };
            var schedules = parent.ProcessRequest<ListProviderOrgUnitScheduleResponse>(scheduleRequest).ScheduleTimeSpans;

            //Existing Records
            foreach (var schedule in schedules)
            {
                var record = new SubEntityRecord();

                record.Fields.Add(new Field(_id, _id, FieldTypes.Hidden, schedule.Id));
                record.Fields.Add(new Field(_providerOrgUnitId, _providerOrgUnitId, FieldTypes.Hidden, providerOrgUnit.Id));
                record.Fields.Add(new Field("Description", schedule.Day, FieldTypes.Label, schedule.Open + " - " + schedule.Close));

                subEntity.Records.Add(record);
            }

            //New Record Template
            subEntity.NewRecordTemplate.Fields.Add(new Field(_providerOrgUnitId, _providerOrgUnitId, FieldTypes.Hidden, providerOrgUnit.Id));
            subEntity.NewRecordTemplate.Fields.Add(CommonUtils.CreateDayDropDownField());
            subEntity.NewRecordTemplate.Fields.Add(new Field("OpenTime", "Open Time", FieldTypes.Text, "8:00 AM"));
            subEntity.NewRecordTemplate.Fields.Add(new Field("CloseTime", "Close Time", FieldTypes.Text, "5:00 PM"));

            return subEntity;
        }