Ejemplo n.º 1
0
        protected override void Context()
        {
            base.Context();

            _calculationMethodCache1 = new CalculationMethodCache();
            _calculationMethodCache2 = new CalculationMethodCache();

            _calculationMethodCat1Item1 = new CalculationMethod {
                Category = "Cat1", Name = "Item1", DisplayName = "Item1"
            };
            _calculationMethodCat1Item2 = new CalculationMethod {
                Category = "Cat1", Name = "Item2", DisplayName = "Item2"
            };
            _calculationMethodCat2Item3 = new CalculationMethod {
                Category = "Cat2", Name = "Item3", DisplayName = "Item3"
            };
            _calculationMethodCat2Item4 = new CalculationMethod {
                Category = "Cat2", Name = "Item4", DisplayName = "Item4"
            };
            _calculationMethodCat3Item5 = new CalculationMethod {
                Category = "Cat3", Name = "Item5", DisplayName = "Item5"
            };

            _calculationMethodCache1.AddCalculationMethod(_calculationMethodCat1Item1);
            _calculationMethodCache1.AddCalculationMethod(_calculationMethodCat2Item3);
            _calculationMethodCache1.AddCalculationMethod(_calculationMethodCat3Item5);
            _calculationMethodCache2.AddCalculationMethod(_calculationMethodCat1Item2);
            _calculationMethodCache2.AddCalculationMethod(_calculationMethodCat2Item4);

            _object1 = _calculationMethodCache1;
            _object2 = _calculationMethodCache2;
        }
Ejemplo n.º 2
0
        protected override Task Context()
        {
            _calculationMethodRepository         = A.Fake <ICalculationMethodRepository>();
            _calculationMethodCategoryRepository = A.Fake <ICalculationMethodCategoryRepository>();
            _logger = A.Fake <IOSPSuiteLogger>();

            sut             = new CalculationMethodCacheMapper(_calculationMethodRepository, _calculationMethodCategoryRepository, _logger);
            _singleCategory = new CalculationMethodCategory {
                Name = "Multiple"
            };
            _multipleCategory = new CalculationMethodCategory {
                Name = "Single"
            };


            _calculationMethodWithMultipleOptions = new CalculationMethod
            {
                Name        = "CM1",
                DisplayName = "CM1",
                Category    = _multipleCategory.Name
            };

            _calculationMethodWithSingleOption = new CalculationMethod
            {
                Name        = "CM2",
                DisplayName = "CM2",
                Category    = _singleCategory.Name
            };

            _anotherCalculationMethodInMultipleOptions = new CalculationMethod
            {
                Name     = "Another CM",
                Category = _multipleCategory.Name
            };

            A.CallTo(() => _calculationMethodRepository.All()).Returns(new[] { _calculationMethodWithMultipleOptions, _anotherCalculationMethodInMultipleOptions, _calculationMethodWithSingleOption, });

            _singleCategory.Add(_calculationMethodWithSingleOption);
            _multipleCategory.Add(_calculationMethodWithMultipleOptions);
            _multipleCategory.Add(_anotherCalculationMethodInMultipleOptions);

            _calculationMethodCache = new CalculationMethodCache();
            _calculationMethodCache.AddCalculationMethod(_calculationMethodWithMultipleOptions);
            _calculationMethodCache.AddCalculationMethod(_calculationMethodWithSingleOption);

            A.CallTo(() => _calculationMethodCategoryRepository.FindBy(_singleCategory.Name)).Returns(_singleCategory);
            A.CallTo(() => _calculationMethodCategoryRepository.FindBy(_multipleCategory.Name)).Returns(_multipleCategory);

            return(Task.FromResult(true));
        }
Ejemplo n.º 3
0
        protected override ParameterIdentificationRunMode CreateRunMode()
        {
            var calculationMethodRepository = IoC.Resolve <ICompoundCalculationMethodRepository>();

            _categorialRunMode = new CategorialParameterIdentificationRunMode {
                AllTheSame = false
            };
            _calculationMethod1      = calculationMethodRepository.All().ElementAt(0);
            _calculationMethod2      = calculationMethodRepository.All().ElementAt(1);
            _calculationMethodCache1 = new CalculationMethodCache();
            _calculationMethodCache2 = new CalculationMethodCache();
            _calculationMethodCache1.AddCalculationMethod(_calculationMethod1);
            _calculationMethodCache1.AddCalculationMethod(_calculationMethod2);
            _calculationMethodCache2.AddCalculationMethod(_calculationMethod2);
            _categorialRunMode.CalculationMethodsCache.Add("Drug1", _calculationMethodCache1);
            _categorialRunMode.CalculationMethodsCache.Add("Drug2", _calculationMethodCache2);

            return(_categorialRunMode);
        }
        protected override void Context()
        {
            base.Context();
            sut.AllTheSame = false;
            var cacheComp1 = new CalculationMethodCache();

            cacheComp1.AddCalculationMethod(_calculationMethod1);
            cacheComp1.AddCalculationMethod(_calculationMethod2);

            var cacheComp2 = new CalculationMethodCache();

            cacheComp2.AddCalculationMethod(_calculationMethod3);
            cacheComp2.AddCalculationMethod(_calculationMethod2);

            sut.CalculationMethodsCache["Comp1"] = cacheComp1;
            sut.CalculationMethodsCache["Comp2"] = cacheComp2;
            sut.AllTheSameSelection.AddCalculationMethod(_calculationMethod1);
            sut.AllTheSameSelection.AddCalculationMethod(_calculationMethod2);
            sut.AllTheSameSelection.AddCalculationMethod(_calculationMethod3);
        }