Ejemplo n.º 1
0
 public IComponentMetadata Add(IComponentMetadata metadata)
 {
     _parent.Add(metadata);
     _myComponents.Add(metadata.Component);
     OnComponentAdded(metadata);
     return(metadata);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns a <see cref="ExportedStandardValue"/> for the metadata.
 /// </summary>
 /// <param name="metadata"></param>
 /// <returns></returns>
 public static StandardValue AsStandardValue(this IComponentMetadata metadata)
 {
     return(new ExportedStandardValue(
                string.IsNullOrEmpty(metadata.DisplayName) ? metadata.Id : metadata.DisplayName,
                metadata.Id,
                metadata.ExportingType,
                metadata.Description,
                metadata.Category));
 }
        public static IProducer <T> GetStaticProducer <T>(this IComponentMetadata componentMetadata, object instance, PortConfiguration portConfiguration)
        {
            var portMetadata = componentMetadata.FindPortMetadata(portConfiguration);

            Debug.Assert(portMetadata.Direction == PortDirection.Output);
            Debug.Assert(portMetadata is StaticPortMetadata);
            var portStaticMetadata = (StaticPortMetadata)portMetadata;

            return(portStaticMetadata.GetStaticProducer <T>(portConfiguration, instance));
        }
Ejemplo n.º 4
0
        public bool Remove(IComponentMetadata metadata)
        {
            var name  = metadata.Component.Name;
            var found = _components.ContainsKey(name);

            if (found)
            {
                _pendingRemovals.Add(name, metadata);
            }
            return(found);
        }
        public void Initialise()
        {
           this.plugin = new ExcessAndDeductibleDataSetValidationPlugin();
           this.componentMetadata = MockRepository.GenerateStub<IComponentMetadata>();
          // var headerVersionBuilder = new BusinessComponentBuilder<HeaderVersion>().Build();
          // var sdvBuilder = new BusinessComponentBuilder<SectionDetailVersion>().Build();
          // var coverageBuilder = new BusinessComponentBuilder<CoverageVersion>().Build();
            var hdr = new BusinessComponentBuilder<Header>()
                .Add(new BusinessComponentBuilder<HeaderVersion>()
                    .SetProperty(a => a.IsLatestVersion = true))
                .Add(new BusinessComponentBuilder<Section>()
                    .Add(new BusinessComponentBuilder<SectionVersion>()
                        .SetProperty(a => a.IsLatestVersion = true))
                    .Add(new BusinessComponentBuilder<SectionDetail>()
                        .Add(new BusinessComponentBuilder<SectionDetailVersion>()
                            .SetProperty(a => a.IsLatestVersion = true))
                        .Add(new BusinessComponentBuilder<Coverage>()
                            .Add(new BusinessComponentBuilder<CoverageVersion>()
                                .SetProperty(a => a.IsLatestVersion = true))))).Build();

            this.componentMetadata = MockRepository.GenerateStub<IComponentMetadata>();
            var genericDataTypeVersion = new ProductBuilder<GenericDataTypeVersion>(this.componentMetadata).Build();
            genericDataTypeVersion.GenericDataTypeComponent = new GenericDataType { Code = "AND2" };

            this.header = hdr;
            this.headerVersion = this.header.HeaderVersions[0];
            this.headerVersion.CreateGenericDataSet();
            this.sectionDetailVersion = this.header.Sections[0].SectionDetails[0].SectionDetailVersions[0];
            this.sectionDetailVersion.CreateGenericDataSet();
            this.coverageVersion = this.header.Sections[0].SectionDetails[0].Coverages[0].CoverageVersions[0];
            this.coverageVersion.CreateGenericDataSet();

            this.businessTransaction = MockRepository.GenerateStub<IBusinessTransaction>();
            this.businessTransaction.Component = hdr;

            var metadata = MockRepository.GenerateStub<IMetadataQuery>();
            metadata.Stub(a => a.GetGenericDataTypeVersion(0, DateTime.Now)).IgnoreArguments().Return(new GenericDataTypeVersion { GenericDataTypeVersionID = 0 });
            var container = new UnityContainer();
            container.RegisterInstance<IMetadataQuery>(metadata);
            container.RegisterInstance<IComponentMetadata>(this.componentMetadata);
            container.RegisterInstance<IMessageService>(new MockMessagingService());
            ObjectFactory.Instance = new ObjectFactory(container);
        }
        public void TestInitialize()
        {
            this.container = new UnityContainer();
            this.container.RegisterType<IMessageService, MessageService>();
            this.componentMetadata = MockRepository.GenerateStub<IComponentMetadata>();
            this.container.RegisterInstance<IXiapCache>(MockRepository.GenerateStub<IXiapCache>());
            this.container.RegisterInstance<IComponentMetadata>(this.componentMetadata);
            var metadataMock = MockRepository.GenerateStub<IMetadataQuery>();
            container.RegisterInstance<IMetadataQuery>(metadataMock);
            List<ValueSetCacheName> codes = new List<ValueSetCacheName>();
            codes.Add(new ValueSetCacheName() { Code = "DummyCode", LanguageID = 1, LongDescription = "Description", ShortDescription = "Description" });
            IQueryable<ValueSetCacheName> codeNames = codes.AsQueryable<ValueSetCacheName>();
            metadataMock.Stub(md => md.QueryValueSetNames(Arg<SystemValueSetCodeEnum>.Is.Anything, Arg<int>.Is.Equal(1))).Return(codeNames);
            BusinessComponentKey key = new BusinessComponentKey("TEST");
            key.Add(new BusinessComponentKeyMember("TEST", "1"));
            this.componentMetadata.Stub(a => a.FieldExists("ClaimHeaderAnalysisCode02")).Return(true);
            this.componentMetadata.Stub(a => a.GetField("ClaimHeaderAnalysisCode02")).Return(new Field() { Title = "ClaimHeaderAnalysisCode02", LookupDefinitionKey = key, LookupParameters = new LookupParameters { Code = "TEST" } });

            this.decisionTableHelper = MockRepository.GenerateStub<IDecisionTableHelper>();
            this.container.RegisterInstance<IDecisionTableHelper>(this.decisionTableHelper);
            this.decisionTableComponent = new DecisionTableComponent { Context = new TransactionContext(string.Empty, string.Empty, string.Empty) };

            this.decisionTableHelper.Stub(s => s.Call(Arg<string>.Is.Anything, Arg<DateTime>.Is.Anything, Arg<object[]>.Is.Anything)).Return(this.decisionTableComponent);
            this.claimHeader = new ClaimHeader();

            ILookupDefinitionCache lookupDefinitionCache = MockRepository.GenerateStub<ILookupDefinitionCache>();
            ILookupDefinition lookupDefinition = MockRepository.GenerateStub<ILookupDefinition>();
            lookupDefinitionCache.Stub(a => a.GetLookupDefinition(string.Empty, 0)).IgnoreArguments().Return(lookupDefinition);
            this.container.RegisterInstance<ILookupDefinitionCache>(lookupDefinitionCache);
            lookupDefinition.Stub(a => a.RetrieveValues(Arg<LookupParameters>.Is.Anything,
                                  Arg<short>.Is.Equal((short)1),
                                  Arg<int>.Is.Anything,
                                  Arg<int?>.Is.Anything,
                                  Arg<LookupOptions>.Is.Equal(LookupOptions.None),
                                  out Arg<int>.Out(new int()).Dummy)).Return((new CodeRow[] { new CodeRow() { Code = "ClaimHeaderAnalysisCode02", Description = "ClaimHeaderAnalysisCode02", LanguageId = 1 } }));
            this.container.RegisterInstance<ILookupDefinition>(lookupDefinition);

            this.mockIUnderwritingService = MockRepository.GenerateStub<IUnderwritingService>();
            container.RegisterInstance<IUnderwritingService>(this.mockIUnderwritingService);
            ObjectFactory.Instance = new ObjectFactory(this.container);
            this.processResultsCollection = new ProcessResultsCollection();
        }
Ejemplo n.º 7
0
 private void OnComponentAdded(IComponentMetadata metadata)
 {
     ComponentAdded?.Invoke(this, new TreeUpdatedEventArgs(metadata));
 }
Ejemplo n.º 8
0
 public IComponentMetadata Add(IComponentMetadata metadata)
 {
     _pendingAdds.Add(metadata.Component.Name, metadata);
     return(metadata);
 }
Ejemplo n.º 9
0
 private void OnComponentRemoved(IComponentMetadata metadata)
 {
     ClearViewport(metadata.Component.Viewport);
     ComponentRemoved?.Invoke(this, new TreeUpdatedEventArgs(metadata));
 }
Ejemplo n.º 10
0
 bool IComponentTree.Remove(IComponentMetadata metadata) => ((IComponentTree)this).Remove(metadata.Component);
Ejemplo n.º 11
0
 IComponentMetadata IComponentTree.Add(IComponentMetadata metadata) => ((IComponentTree)this).Add(metadata.Component);
Ejemplo n.º 12
0
 public TreeUpdatedEventArgs(IComponentMetadata metadata)
 {
     ComponentMetadata = metadata;
 }
Ejemplo n.º 13
0
 public bool Remove(IComponentMetadata metadata) => Remove(metadata.Component);
 public static IPortMetadata FindPortMetadata(this IComponentMetadata componentMetadata, PortConfiguration port)
 {
     return(componentMetadata.Ports.Single(p => Equals(p.Identifier, port.Identifier)));
 }
 public static IEnumerable <IPortMetadata> OutputPorts(this IComponentMetadata componentMetadata)
 {
     return(componentMetadata.Ports.Where(p => p.Direction == PortDirection.Output));
 }