示例#1
0
        public void provide_custom_strategies()
        {
            var thisAssembly = typeof(ExampleTests).GetTypeInfo().Assembly;
            var customWorkingDayCultureInfo = new WorkingDayCultureInfo("CustomTest")
            {
                LocateHolidayStrategy = (name, region) =>
                                        LocaleImplementationLocator.FindImplementationOf <IHolidayStrategy>(name, region, thisAssembly) ??
                                        new DefaultHolidayStrategy(),
                LocateWorkingDayOfWeekStrategy = (name, region) =>
                                                 LocaleImplementationLocator.FindImplementationOf <IWorkingDayOfWeekStrategy>(name, region, thisAssembly) ??
                                                 new DefaultWorkingDayOfWeekStrategy()
            };


            Assert.IsTrue(DateTime.Today.IsWorkingDay(customWorkingDayCultureInfo) == false);
            Assert.IsTrue(DateTime.Today.AddDays(1).IsWorkingDay(customWorkingDayCultureInfo) == true);
        }
 public void get_all_implemented_locales()
 {
     string[] locales = LocaleImplementationLocator.FindImplemetedLocales <IHolidayStrategy>();
     Assert.Contains("ko-KR", locales);
 }
 public EmployeeStaffingHolidayStrategy(StaffingParameters parameters)
 {
     _parameters = parameters;
     //TODO: There should be a better way to extend without needed to use the LocaleImplemetationLocator manually
     _innerHolidayStrategy = LocaleImplementationLocator.FindImplementationOf <IHolidayStrategy>(_parameters.Locale);
 }