public void CreateReceiveLocationTwoWay()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var visitor = new BindingInfoBuilder();
            var binding = visitor.CreateReceiveLocation(new TwoWayReceiveLocation());

            binding.Name.Should().Be(nameof(TwoWayReceiveLocation));
            binding.Enable.Should().BeFalse();
            binding.Address.Should().Be(@"c:\file\drops\*.xml");
            binding.Description.Should().Be("Some Useless Two-Way Test Receive Location");

            binding.TransportType.Should().BeEquivalentTo(new ProtocolType {
                Name = "Test Dummy"
            });
            binding.TransportTypeData.Should().Be("<CustomProps />");
            binding.ReceiveHandler.Name.Should().Be("Receive Host Name");
            binding.ReceiveHandler.TransportType.Name.Should().Be("Test Dummy");

            binding.ReceivePipeline.Name.Should().Be(typeof(PassThruReceive).FullName);
            binding.ReceivePipeline.FullyQualifiedName.Should().Be(typeof(PassThruReceive).AssemblyQualifiedName);
            binding.ReceivePipeline.TrackingOption.Should().Be(PipelineTrackingTypes.None);
            binding.ReceivePipeline.Type.Should().Be(PipelineRef.ReceivePipelineRef().Type);
            binding.ReceivePipelineData.Should().BeEmpty();

            binding.SendPipeline.Name.Should().Be(typeof(PassThruTransmit).FullName);
            binding.SendPipeline.FullyQualifiedName.Should().Be(typeof(PassThruTransmit).AssemblyQualifiedName);
            binding.SendPipeline.TrackingOption.Should().Be(PipelineTrackingTypes.None);
            binding.SendPipeline.Type.Should().Be(PipelineRef.TransmitPipelineRef().Type);
            binding.SendPipelineData.Should().NotBeNullOrEmpty();

            binding.ScheduleTimeZone.Should().BeNull();
            binding.ScheduleAutoAdjustToDaylightSaving.Should().BeFalse();
            binding.StartDate.Should().Be(Schedule.None.StartDate);
            binding.StartDateEnabled.Should().BeFalse();
            binding.EndDate.Should().Be(Schedule.None.StopDate);
            binding.EndDateEnabled.Should().BeFalse();

            binding.ServiceWindowEnabled.Should().BeFalse();
            binding.FromTime.Should().Be(ServiceWindow.None.StartTime);
            binding.ToTime.Should().Be(ServiceWindow.None.StopTime);

            binding.ScheduleRecurrenceType.Should().Be(RecurrenceType.None);
            binding.ScheduleRecurFrom.Should().Be(new DailyServiceWindow().From);
            binding.ScheduleRecurInterval.Should().Be(1);
            binding.ScheduleDaysOfWeek.Should().Be(BtsDayOfWeek.None);
            binding.ScheduleMonths.Should().Be(Month.None);
            binding.ScheduleMonthDays.Should().Be(MonthDay.None);
            binding.ScheduleLastDayOfMonth.Should().BeFalse();
            binding.ScheduleOrdinalDayOfWeek.Should().Be(BtsDayOfWeek.None);
            binding.ScheduleOrdinalType.Should().Be(OrdinalType.None);
            binding.ScheduleIsOrdinal.Should().BeFalse();
        }
        public void CreateReceiveLocationWithWeeklyServiceWindow()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var receiveLocation = new ReceiveLocation(
                rl => {
                rl.Name = "Dummy Receive Location";
                rl.Transport.Adapter  = new DummyAdapter();
                rl.Transport.Host     = "Receive Host Name";
                rl.Transport.Schedule = new() {
                    TimeZone = TimeZoneInfo.FindSystemTimeZoneById("Atlantic Standard Time"),
                    AutomaticallyAdjustForDaylightSavingTime = false,
                    StartDate     = new(2020, 1, 30),
                    StopDate      = new(2020, 3, 13),
                    ServiceWindow = new WeeklyServiceWindow {
                        StartTime = new(19, 19, 19),
                        StopTime  = new(9, 9, 9),
                        From      = new(2020, 2, 14),
                        Interval  = 10,
                        WeekDays  = BtsDayOfWeek.Friday | BtsDayOfWeek.Saturday
                    }
                };
                rl.ReceivePipeline = new ReceivePipeline <PassThruReceive>();
            });
            var visitor = new BindingInfoBuilder();

            var binding = visitor.CreateReceiveLocation(receiveLocation);

            binding.ScheduleTimeZone.Should().Be("Atlantic Standard Time");
            binding.ScheduleAutoAdjustToDaylightSaving.Should().BeFalse();
            binding.StartDate.Should().Be(new(2020, 1, 30));
            binding.StartDateEnabled.Should().BeTrue();
            binding.EndDate.Should().Be(new(2020, 3, 13));
            binding.EndDateEnabled.Should().BeTrue();

            binding.ServiceWindowEnabled.Should().BeTrue();
            binding.FromTime.TimeOfDay.Should().Be(((DateTime) new Time(19, 19, 19)).TimeOfDay);
            binding.ToTime.TimeOfDay.Should().Be(((DateTime) new Time(9, 9, 9)).TimeOfDay);

            binding.ScheduleRecurrenceType.Should().Be(RecurrenceType.Week);
            binding.ScheduleRecurFrom.Should().Be(new(2020, 2, 14));
            binding.ScheduleRecurInterval.Should().Be(10);

            binding.ScheduleDaysOfWeek.Should().Be(BtsDayOfWeek.Friday | BtsDayOfWeek.Saturday);

            binding.ScheduleMonths.Should().Be(Month.None);
            binding.ScheduleMonthDays.Should().Be(MonthDay.None);
            binding.ScheduleLastDayOfMonth.Should().BeFalse();
            binding.ScheduleOrdinalDayOfWeek.Should().Be(BtsDayOfWeek.None);
            binding.ScheduleOrdinalType.Should().Be(OrdinalType.None);
            binding.ScheduleIsOrdinal.Should().BeFalse();
        }
        public void CreateReceiveLocationWithCalendricalMonthlyServiceWindow()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var receiveLocation = new ReceiveLocation(
                rl => {
                rl.Name = "Dummy Receive Location";
                rl.Transport.Adapter  = new DummyAdapter();
                rl.Transport.Host     = "Receive Host Name";
                rl.Transport.Schedule = new() {
                    TimeZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"),
                    AutomaticallyAdjustForDaylightSavingTime = false,
                    StartDate     = new(2020, 1, 30),
                    StopDate      = new(2020, 3, 13),
                    ServiceWindow = new CalendricalMonthlyServiceWindow {
                        StartTime = new(19, 19, 19),
                        StopTime  = new(9, 9, 9),
                        Months    = Month.January | Month.Feburary | Month.March,
                        Days      = MonthDay.Day31 | MonthDay.Day14 | MonthDay.Day15,
                        OnLastDay = true
                    }
                };
                rl.ReceivePipeline = new ReceivePipeline <PassThruReceive>();
            });
            var visitor = new BindingInfoBuilder();

            var binding = visitor.CreateReceiveLocation(receiveLocation);

            binding.ScheduleTimeZone.Should().Be("Pacific Standard Time");
            binding.ScheduleAutoAdjustToDaylightSaving.Should().BeFalse();
            binding.StartDate.Should().Be(new(2020, 1, 30));
            binding.StartDateEnabled.Should().BeTrue();
            binding.EndDate.Should().Be(new(2020, 3, 13));
            binding.EndDateEnabled.Should().BeTrue();

            binding.ServiceWindowEnabled.Should().BeTrue();
            binding.FromTime.TimeOfDay.Should().Be(((DateTime) new Time(19, 19, 19)).TimeOfDay);
            binding.ToTime.TimeOfDay.Should().Be(((DateTime) new Time(9, 9, 9)).TimeOfDay);

            binding.ScheduleRecurrenceType.Should().Be(RecurrenceType.Month);
            binding.ScheduleRecurFrom.Should().Be(new DailyServiceWindow().From);
            binding.ScheduleRecurInterval.Should().Be(1);

            binding.ScheduleDaysOfWeek.Should().Be(BtsDayOfWeek.None);

            binding.ScheduleMonths.Should().Be(Month.January | Month.Feburary | Month.March);
            binding.ScheduleMonthDays.Should().Be(MonthDay.Day31 | MonthDay.Day14 | MonthDay.Day15);
            binding.ScheduleLastDayOfMonth.Should().BeTrue();
            binding.ScheduleOrdinalDayOfWeek.Should().Be(BtsDayOfWeek.None);
            binding.ScheduleOrdinalType.Should().Be(OrdinalType.None);
            binding.ScheduleIsOrdinal.Should().BeFalse();
        }
        public void CreateReceiveLocationWithoutSchedule()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var receiveLocation = new ReceiveLocation(
                rl => {
                rl.Name = "Dummy Receive Location";
                rl.Transport.Adapter = new DummyAdapter();
                rl.Transport.Host    = "Receive Host Name";
                rl.ReceivePipeline   = new ReceivePipeline <PassThruReceive>();
            });
            var visitor = new BindingInfoBuilder();

            var binding = visitor.CreateReceiveLocation(receiveLocation);

            binding.ScheduleTimeZone.Should().BeNull();
            binding.ScheduleAutoAdjustToDaylightSaving.Should().BeFalse();
            binding.StartDate.Should().Be(Schedule.None.StartDate);
            binding.StartDateEnabled.Should().BeFalse();
            binding.EndDate.Should().Be(Schedule.None.StopDate);
            binding.EndDateEnabled.Should().BeFalse();

            binding.ServiceWindowEnabled.Should().BeFalse();
            binding.FromTime.Should().Be(ServiceWindow.None.StartTime);
            binding.ToTime.Should().Be(ServiceWindow.None.StopTime);

            binding.ScheduleRecurrenceType.Should().Be(RecurrenceType.None);
            binding.ScheduleRecurFrom.Should().Be(new DailyServiceWindow().From);
            binding.ScheduleRecurInterval.Should().Be(1);

            binding.ScheduleDaysOfWeek.Should().Be(BtsDayOfWeek.None);

            binding.ScheduleMonths.Should().Be(Month.None);
            binding.ScheduleMonthDays.Should().Be(MonthDay.None);
            binding.ScheduleLastDayOfMonth.Should().BeFalse();
            binding.ScheduleOrdinalDayOfWeek.Should().Be(BtsDayOfWeek.None);
            binding.ScheduleOrdinalType.Should().Be(OrdinalType.None);
            binding.ScheduleIsOrdinal.Should().BeFalse();
        }