示例#1
0
 private string objectNameFrom(DiffItem diffItem)
 {
     return
         (displayIf <IFormula>(diffItem, x => ancestorDisplayName(diffItem)) ??
          displayIf <IReactionPartner>(diffItem, x => x.Partner.Name) ??
          displayIf <IReactionPartnerBuilder>(diffItem, x => x.MoleculeName) ??
          displayIf <UsedCalculationMethod>(diffItem, x => x.Category) ??
          displayIf <IObjectPath>(diffItem, x => ancestorDisplayName(diffItem)) ??
          displayIf <ValuePoint>(diffItem, x => ancestorDisplayName(diffItem)) ??
          _displayNameProvider.DisplayNameFor(diffItem.Object1));
 }
示例#2
0
        private string displayValueFor(ValuePoint valuePoint, IComparison <TableFormula> comparison)
        {
            var formulaOwnerName = _displayNameProvider.DisplayNameFor(comparison.CommonAncestor);
            var tableFormula     = comparison.Object1.DowncastTo <TableFormula>();

            return(Captions.Comparisons.ValuePointAt(tableFormula.Name, formulaOwnerName, tableFormula.XDisplayValueFor(valuePoint.X)));
        }
示例#3
0
        private CategoryDTO mapFrom(IGrouping <string, CalculationMethod> group)
        {
            var categoryName = group.Key;
            var category     = new Category <CalculationMethod> {
                Name = categoryName
            };

            return(new CategoryDTO
            {
                Name = categoryName,
                DisplayName = _displayNameProvider.DisplayNameFor(category),
                Methods = group.All().ToList()
            });
        }
        public void Handle(ObjectConvertedEvent eventToHandle)
        {
            var objectName  = _displayNameProvider.DisplayNameFor(eventToHandle.ConvertedObject);
            var objectType  = _context.TypeFor(eventToHandle.ConvertedObject);
            var fromVersion = eventToHandle.FromVersion;

            var command = new OSPSuiteInfoCommand
            {
                ObjectType  = _context.TypeFor(eventToHandle.ConvertedObject),
                Description = AppConstants.Commands.ObjectConvertedCommand(objectName, objectType, fromVersion.VersionDisplay, _applicationConfiguration.Version),
            };

            command.Run(_context);
            _context.AddToHistory(command);
        }
        protected override void Context()
        {
            _pathToPathElementMapper = A.Fake <IPathToPathElementsMapper>();
            _displayNameProvider     = A.Fake <IDisplayNameProvider>();
            _container    = new Container().WithName("ROOT");
            _pathElements = new PathElements();
            sut           = new DiffItemToDiffItemDTOMapper(_pathToPathElementMapper, _displayNameProvider);

            A.CallTo(() => _pathToPathElementMapper.MapFrom(_container)).Returns(_pathElements);
            A.CallTo(() => _displayNameProvider.DisplayNameFor(A <object> ._)).ReturnsLazily(x =>
            {
                var obj = x.GetArgument <object>(0);
                return(obj != null ? obj.ToString() : string.Empty);
            });
        }
示例#6
0
        protected override void Context()
        {
            _runMode = new CategorialParameterIdentificationRunMode();
            _calculationMethodWithCompoundNames = new List <CalculationMethodWithCompoundName>
            {
                new CalculationMethodWithCompoundName(new CalculationMethod {
                    Category = "category1", DisplayName = "method1"
                }, "compound1"),
                new CalculationMethodWithCompoundName(new CalculationMethod {
                    Category = "category2", DisplayName = "method2"
                }, "compound1")
            };
            _aCombination = new CalculationMethodCombination(_calculationMethodWithCompoundNames);

            _displayNameProvider = A.Fake <IDisplayNameProvider>();
            sut = new CategorialParameterIdentificationDescriptionCreator(_displayNameProvider);
            A.CallTo(() => _displayNameProvider.DisplayNameFor(A <Category <CalculationMethod> > ._)).ReturnsLazily((object category) => category.DowncastTo <Category <CalculationMethod> >().Name);
        }
        private DiffItem missingItem <TMissing>(object object1, object object2, TMissing missingObjectFromObject1,
                                                TMissing missingObjectFromObject2, string missingObjectType, string missingObjectName, string presentObjectDetails) where TMissing : class
        {
            var containerType = _objectTypeResolver.TypeFor(object1);
            var containerName = _displayNameProvider.DisplayNameFor(object1);

            return(new MissingDiffItem
            {
                Object1 = object1,
                Object2 = object2,
                MissingObject1 = missingObjectFromObject1,
                MissingObject2 = missingObjectFromObject2,
                MissingObjectName = missingObjectName,
                MissingObjectType = missingObjectType,
                Description = Captions.Diff.ObjectMissing(containerType, containerName, missingObjectType, missingObjectName),
                PresentObjectDetails = presentObjectDetails,
                CommonAncestor = object1
            });
        }
示例#8
0
 private string getDisplayNameForCategory(CalculationMethodWithCompoundName cm)
 {
     return(_displayNameProvider.DisplayNameFor(new Category <CalculationMethod> {
         Name = cm.CalculationMethod.Category
     }));
 }