Exemplo n.º 1
0
        private static PassSalesAreaPriority ConvertToPassSalesAreaPriority(PassSalesAreaPriority source)
        {
            if (source == null)
            {
                return(source);
            }
            DateTime?nullableDateTime = null;

            source.StartDate = source.StartDate.HasValue ? source.StartDate.Value.Date : nullableDateTime;
            source.EndDate   = source.EndDate.HasValue ? source.EndDate.Value.Date : nullableDateTime;
            return(source);
        }
Exemplo n.º 2
0
 public void Init()
 {
     _dummyScenarioList                  = RunsValidationsDummyData.GetScenarios();
     _dummyScenario                      = RunsValidationsDummyData.GetScenario();
     _dummyCampaignPassPriorityList      = RunsValidationsDummyData.GetCampaignPassPriorities();
     _dummyPassReferenceList             = RunsValidationsDummyData.GetPassReferences();
     _dummyTenantSettings                = RunsValidationsDummyData.GetTenantSettings();
     _dummyPassSalesAreaPriorityAllTrue  = RunsValidationsDummyData.GetPassSalesAreaPriorityWithFlagsTrue();
     _dummyPassSalesAreaPriorityAllFalse = RunsValidationsDummyData.GetPassSalesAreaPriorityWithFlagsFalse();
     _dummyRun  = RunsValidationsDummyData.GetRun();
     _dummyPass = RunsValidationsDummyData.GetPass();
     _dummyRunSalesAreasPriority = RunsValidationsDummyData.GetRunSalesAreaPriorities();
     _dummySalesAreas            = RunsValidationsDummyData.GetSalesAreas();
     _dummyNotExcludedSalesAreas = _dummyRunSalesAreasPriority
                                   .Where(o => o.Priority != SalesAreaPriorityType.Exclude)
                                   .Select(o => o.SalesArea)
                                   .ToList();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Creates some number of passes
        /// </summary>
        /// <param name="count"></param>
        /// <param name="isLibraried">Should be true when is not linked to any scenario, otherwise false</param>
        /// <returns></returns>
        public IEnumerable <Pass> BuildPasses(int count, bool isLibraried)
        {
            #region Set General, Weightings, Tolerances, Rules, PassSalesAreaPriorities

            var general = new List <GeneralModel>()
            {
                new GeneralModel
                {
                    RuleId       = 1,
                    InternalType = "Defaults",
                    Description  = "Minimum Efficiency",
                    Value        = "11",
                    Type         = "general"
                }
            };

            var weightings = new List <WeightingModel>()
            {
                new WeightingModel
                {
                    RuleId       = 1,
                    InternalType = "Weightings",
                    Description  = "Campaign",
                    Value        = "1",
                    Type         = "weightings"
                }
            };

            var tolerances = new List <ToleranceModel>()
            {
                new ToleranceModel
                {
                    RuleId         = 1,
                    InternalType   = "Campaign",
                    Description    = "Campaign",
                    Value          = null,
                    Under          = 0,
                    Over           = 10,
                    Ignore         = true,
                    ForceOverUnder = ForceOverUnder.Over,
                    Type           = "tolerances"
                }
            };

            var rules = new List <RuleModel>()
            {
                new RuleModel
                {
                    RuleId       = 1,
                    InternalType = "Slotting Controls",
                    Description  = "Max Spots Per Day",
                    Value        = "15",
                    PeakValue    = null,
                    Type         = "rules"
                }
            };

            var passSalesAreaPriorities = new PassSalesAreaPriority()
            {
                SalesAreaPriorities = new List <SalesAreaPriorityModel>(),
                StartDate           = null,
                EndDate             = null,
                StartTime           = null,
                EndTime             = null,
                DaysOfWeek          = null
            };

            #endregion

            return(_fixture.Build <Pass>()
                   .Without(p => p.Id)
                   .With(p => p.General, general)
                   .With(p => p.Weightings, weightings)
                   .With(p => p.Tolerances, tolerances)
                   .With(p => p.Rules, rules)
                   .With(p => p.PassSalesAreaPriorities, passSalesAreaPriorities)
                   .With(p => p.BreakExclusions, new List <BreakExclusionModel>())
                   .With(p => p.ProgrammeRepetitions, new List <ProgrammeRepetitionModel>())
                   .With(p => p.SlottingLimits, new List <SlottingLimitModel>())
                   .With(p => p.DateCreated, DateTime.UtcNow)
                   .With(p => p.DateModified, DateTime.UtcNow)
                   .With(p => p.IsLibraried, isLibraried)
                   .CreateMany(count));
        }