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(); }
public void TestInitialize() { // target = new AXANameTransferValidation(); this.component = new AXANameTransferValidation(); this.container = new UnityContainer(); ObjectFactory.Instance = new ObjectFactory(this.container); IComponentMetadata metadata = MockRepository.GenerateStub<IComponentMetadata>(); this.decisionTableHelper = MockRepository.GenerateStub<IDecisionTableHelper>(); this.decisionTableComponent1 = MockRepository.GenerateStub<IDecisionTableComponent>(); this.decisionTableComponent2 = MockRepository.GenerateStub<IDecisionTableComponent>(); this.container.RegisterInstance<IDecisionTableHelper>(this.decisionTableHelper); this.container.RegisterInstance<IComponentMetadata>(metadata); var metadataMock = MockRepository.GenerateStub<IMetadataQuery>(); this.container.RegisterInstance<IMetadataQuery>(metadataMock); var validation = MockRepository.GenerateStub<ICopyValidation>(); this.container.RegisterInstance<ICopyValidation>(validation); NameUsageType nst = new NameUsageType() { Code = "CMH" }; metadata.Stub(m => m.GetDefinitionComponent<NameUsageType>()).Return(nst); // this.container.RegisterInstance<IDecisionTableComponent>(this.decisionTableComponent1); // this.container.RegisterInstance<IDecisionTableComponent>(this.decisionTableComponent2); this.container.RegisterType<ObjectContext, MetadataEntities>("MetadataEntities", new InjectionConstructor[] { new InjectionConstructor(new object[] { }) }); this.container.RegisterType<MetadataEntities>("MetadataEntities", new InjectionConstructor[] { new InjectionConstructor(new object[] { }) }); IConfigurationManager configurationManager = MockRepository.GenerateStub<IConfigurationManager>(); configurationManager.Stub(m => m.AppSettings).Return(new System.Collections.Specialized.NameValueCollection()); this.container.RegisterInstance<IConfigurationManager>(configurationManager); this.container.RegisterType<ObjectContext, InsuranceDirectoryEntities>("InsuranceDirectoryEntities", new InjectionConstructor[] { new InjectionConstructor(new object[] { }) }); }