Пример #1
0
        public void SimpleVersionIntersectionTest()
        {
            var pkg = new Package("Self.Library", new Version(2, 0, 0, 501));

            pkg.Dependencies.Add(new PackageDependency("Company.Logging", "3.0"));
            pkg.Dependencies.Add(new PackageDependency("log4net", "1.2.8"));

            var dr     = new DependencyResolution(pkg, new[] { _repo });
            var result = dr.Resolve();
            VersionResolutionTable   table    = result.Item1;
            IEnumerable <PackageKey> packages = table.GetPackages();

            Assert.IsFalse(table.HasConflicts);
            Assert.AreEqual(2, packages.Count());
            Assert.AreEqual(new Version(3, 0, 0, 4863), packages.ElementAt(0).Version);
            //Assert.AreEqual(new Version(2, 0, 0, 501), packages.ElementAt(0).Version);
            Assert.AreEqual(new Version(1, 2, 8, 0), packages.ElementAt(1).Version);
        }
Пример #2
0
        public void TrivialTreeTest()
        {
            Package pkg = new Package("Self.Library", new Version(1, 3, 0, 500));

            pkg.Dependencies.Add(new PackageDependency("Company.Logging", "3.0"));
            pkg.Dependencies.Add(new PackageDependency("log4net", "1.2.10"));

            DependencyResolution dr     = new DependencyResolution(pkg, new[] { _repo });
            DependencyNode       result = dr.Resolve().Item2;

            Assert.AreEqual(2, result.Children.Count());
            DependencyNode node1 = result.Children.ElementAt(0);
            DependencyNode node2 = result.Children.ElementAt(1);

            Assert.AreEqual(new Version(3, 0, 0, 4863), node1.ActiveVersion);
            Assert.AreEqual(new Version(1, 2, 10, 0), node2.ActiveVersion);
            Assert.AreEqual(1, node1.Children.Count());
            Assert.AreEqual(new Version(1, 2, 10, 0), node1.Children.First().ActiveVersion);
        }
Пример #3
0
        public void TrivialTest()
        {
            Package pkg = new Package("Self.Library", new Version(1, 2, 0, 0));

            pkg.Dependencies.Add(new PackageDependency("log4net", "1.2"));

            DependencyResolution dr   = new DependencyResolution(pkg, new[] { _repo });
            DependencyNode       node = dr.Resolve().Item2;

            Assert.IsNotNull(node);
            Assert.IsTrue(node.HasVersions);
            Assert.IsTrue(node.HasManifest);
            Assert.AreEqual(1, node.Children.Count());

            DependencyNode log4net = node.Children.FirstOrDefault();

            Assert.IsNotNull(log4net);
            Assert.IsTrue(log4net.HasVersions);
            Assert.IsTrue(log4net.HasManifest);
        }
        static void Main(string[] args)
        {
            DependencyResolution.ConstructContainer();
            var reader           = DependencyResolution.GetDJExcelFileReader();
            var result           = reader.GetData();
            var serializer       = DependencyResolution.GetFICOSerializer();
            var serializedResult = serializer.Serialize(result);
            var writer           = DependencyResolution.GetFICOFileWriter(@"C:\Users\jyp1510\Documents\TestData\TestOutput.csv",
                                                                          "INSTITUTE|" +
                                                                          "CUSTNO|" +
                                                                          "FIRST_NAME|" +
                                                                          "LASTNAME_COMPANYNAME|" +
                                                                          "STREET|" +
                                                                          "ZIP|" +
                                                                          "TOWN|" +
                                                                          "H_COUNTRY|" +
                                                                          "CUSY|" +
                                                                          "FK_CSMNO|" +
                                                                          "PROFESSION|" +
                                                                          "BRANCH|" +
                                                                          "BIRTHDATE|" +
                                                                          "CUSTCONTACT|" +
                                                                          "EXEMPTIONFLAG|" +
                                                                          "EXEMPTIONAMOUNT|" +
                                                                          "ASYLSYN|" +
                                                                          "SALARY|" +
                                                                          "SALARYDATE|" +
                                                                          "NAT_COUNTRY|" +
                                                                          "TOT_WEALTH|" +
                                                                          "CUST_TYPE|" +
                                                                          "CUST_FLAG_01|" +
                                                                          "PASS_NO|" +
                                                                          "BIRTH_COUNTRY|" +
                                                                          "BIRTH_PLACE|" +
                                                                          "BORROWEYN|" +
                                                                          "DIRECT_DEBITYN|" +
                                                                          "GENDER|" +
                                                                          "RISK_CLASS");

            writer.Write(serializedResult);
        }
Пример #5
0
        static void Main(string[] args)
        {
            var dr = new DependencyResolution();

            //var calculator = dr.GetInsertCalculator("[StatAI].[dbo].[CustByTypes]", "[StatAI].[dbo].[CustByTypesTest]",
            //    6,
            //    @"data source=JYP1510;initial catalog=StatAI;integrated security=True;MultipleActiveResultSets=true;",
            //    "0|1|2|3|4|5",true);

            //Starts at 0
            Console.WriteLine("Type {file} for file.");
            var result = Console.ReadLine();

            if (result == "file")
            {
                var calculator = dr.GetFileInsertCalculator(true, @"D:\Lifestyle_Data\contract_Claim_2.txt",
                                                            "[StatAI].[data].[ClaimsDataLifeStyle]",
                                                            7,
                                                            @"Data Source=(DESCRIPTION =(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
                    (HOST =cmpidevlz1)(PORT = 1529)))(CONNECT_DATA =(SERVICE_NAME =LPBDEV)));User ID=interface;Password=milktart;",
                                                            "", false);

                var insertStatements = calculator.Calculate();
                var writer           = dr.GetGeneralDataWriter(@"data source=JYP1510;initial catalog=StatAI;integrated security=True;MultipleActiveResultSets=true;");
                writer.WriteData(insertStatements);
            }
            else
            {
                var calculator = dr.GetORACLEInsertCalculator("COMPASS.CASE_DATA",
                                                              "[StatAI].[stg].[MAY_HAVE_CLAIMED_BY_PRODUCT_TYPE]",
                                                              5,
                                                              @"Data Source=(DESCRIPTION =(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
                    (HOST =cmpidevlz1)(PORT = 1529)))(CONNECT_DATA =(SERVICE_NAME =LPBDEV)));User ID=interface;Password=milktart;",
                                                              "0|3|4", false);

                var insertStatements = calculator.Calculate();
                var writer           = dr.GetGeneralDataWriter(@"data source=JYP1510;initial catalog=StatAI;integrated security=True;MultipleActiveResultSets=true;");
                writer.WriteData(insertStatements);
            }
        }
Пример #6
0
        static void Main(string[] args)
        {
            var readDirectory  = ConfigurationManager.AppSettings["Directory"];
            var writeDirectory = ConfigurationManager.AppSettings["WriteDirectory"];

            var personSourceFile    = FileMatch.GetFullFileName(readDirectory, ConfigurationManager.AppSettings["GESOURCEFILEPERSON"]);
            var personWorksheetName = ConfigurationManager.AppSettings["PersonWorksheetName"];

            var entitySourceFile    = FileMatch.GetFullFileName(readDirectory, ConfigurationManager.AppSettings["GESOURCEFILEENTITY"]);
            var entityWorksheetName = ConfigurationManager.AppSettings["EntityWorksheetName"];

            var headings = ConfigurationManager.AppSettings["Headings"];

            DependencyResolution.ConstructContainer();
            var reader = DependencyResolution.GetGEFileReader();

            var personResult = reader.GetData(readDirectory + personSourceFile, personWorksheetName, 4);
            var entityResult = reader.GetData(readDirectory + entitySourceFile, entityWorksheetName, 2);


            var serializer       = DependencyResolution.GetFICOSerializer();
            var serializedResult = serializer.Serialize(personResult, entityResult);

            var LibFin_Customer    = ConfigurationManager.AppSettings["LibFin_Customer"];
            var LibFin_Ext         = ConfigurationManager.AppSettings["LibFin_Ext"];
            var LibFinRelationship = ConfigurationManager.AppSettings["LibFinRelationship"];
            var UnUsed             = ConfigurationManager.AppSettings["UnUsed"];


            var writer = DependencyResolution.GetFICOFileWriter(writeDirectory + LibFin_Customer,
                                                                writeDirectory + LibFin_Ext, headings);

            writer.Write(serializedResult.OutputAndExtension, "");

            var relationWriter = DependencyResolution.GetGERelationshipWriter(writeDirectory + LibFinRelationship,
                                                                              UnUsed, "INSTITUTE|CUSTNO|REL_CUSTNO|REL_TYPE|REL_SHARE|REL_FLAG1|REL_FLAG2|REL_FLAG3|REL_COMMENT|PROCESSFLAG");

            relationWriter.Write(serializedResult.RelationshipList, "|");
        }
Пример #7
0
        public void SimpleConflictTest()
        {
            var pkg = new Package("Self.Library", new Version(2, 0, 0, 501));

            pkg.Dependencies.Add(new PackageDependency("Company.Logging", "3.0"));
            pkg.Dependencies.Add(new PackageDependency("log4net", "1.1"));

            var dr     = new DependencyResolution(pkg, new[] { _repo });
            var result = dr.Resolve();
            VersionResolutionTable table = result.Item1;

            Assert.IsTrue(table.HasConflicts);
            Assert.AreEqual(1, table.ConflictCount);

            var resolved   = table.GetPackages();
            var unresolved = table.GetConflictedPackages();

            Assert.AreEqual(1, resolved.Count());
            Assert.AreEqual(1, unresolved.Count());

            string cd = dr.DescribeConflict(result.Item2, unresolved.First());
        }
Пример #8
0
 private static void InitializeContainer(Container container)
 {
     DependencyResolution.Register(container);
 }
Пример #9
0
            public void CreateInstance_WhenComponentHasRequiredDependencyWithNoParameterValueAndItIsNotSatisfied_Throws()
            {
                var dependencyResolver = MockRepository.GenerateMock <IObjectDependencyResolver>();
                var objectFactory      = new ObjectFactory(dependencyResolver, typeof(ComponentWithRequiredDependencyOnService), new PropertySet());

                dependencyResolver.Expect(x => x.ResolveDependency("service", typeof(IService), null)).Return(DependencyResolution.Unsatisfied());

                var ex = Assert.Throws <RuntimeException>(() => objectFactory.CreateInstance());

                Assert.AreEqual(string.Format("Could not resolve required dependency 'service' of type '{0}'.", typeof(IService)), ex.Message);

                dependencyResolver.VerifyAllExpectations();
            }
Пример #10
0
            public void CreateInstance_WhenComponentHasRequiredDependencyWithNoParameterValueAndItIsSatisfied_BuildsTheObjectWithTheResolvedDependency()
            {
                var dependencyResolver = MockRepository.GenerateMock <IObjectDependencyResolver>();
                var objectFactory      = new ObjectFactory(dependencyResolver, typeof(ComponentWithRequiredDependencyOnService), new PropertySet());
                var service            = MockRepository.GenerateStub <IService>();

                dependencyResolver.Expect(x => x.ResolveDependency("service", typeof(IService), null)).Return(DependencyResolution.Satisfied(service));

                var component = (ComponentWithRequiredDependencyOnService)objectFactory.CreateInstance();

                Assert.AreSame(service, component.Service);

                dependencyResolver.VerifyAllExpectations();
            }
Пример #11
0
            public void CreateInstance_WhenComponentHasMultipleConstructors_UsesPublicConstructorWithMostParameters()
            {
                var dependencyResolver = MockRepository.GenerateMock <IObjectDependencyResolver>();
                var objectFactory      = new ObjectFactory(dependencyResolver, typeof(ComponentWithMultipleConstructors), new PropertySet()
                {
                    { "prOpERtY", "value" }
                });
                var service = MockRepository.GenerateStub <IService>();

                dependencyResolver.Expect(x => x.ResolveDependency("service", typeof(IService), null)).Return(DependencyResolution.Satisfied(service));
                dependencyResolver.Expect(x => x.ResolveDependency("property", typeof(string), "value")).Return(DependencyResolution.Satisfied("value"));

                var component = (ComponentWithMultipleConstructors)objectFactory.CreateInstance();

                Assert.AreSame(service, component.Service);
                Assert.AreEqual("value", component.Property);

                dependencyResolver.VerifyAllExpectations();
            }
Пример #12
0
            public void CreateInstance_WhenComponentHasRequiredDependencyWithAParameterValueAndItIsSatisfied_BuildsTheObjectWithTheResolvedDependency()
            {
                var dependencyResolver = MockRepository.GenerateMock <IObjectDependencyResolver>();
                var objectFactory      = new ObjectFactory(dependencyResolver, typeof(ComponentWithRequiredDependencyOnProperty), new PropertySet()
                {
                    { "prOpERtY", "value" }
                });

                dependencyResolver.Expect(x => x.ResolveDependency("property", typeof(string), "value")).Return(DependencyResolution.Satisfied("value"));

                var component = (ComponentWithRequiredDependencyOnProperty)objectFactory.CreateInstance();

                Assert.AreEqual("value", component.Property);

                dependencyResolver.VerifyAllExpectations();
            }
Пример #13
0
            public void CreateInstance_WhenComponentHasOptionalDependencyWithNoParameterValueAndItIsNotSatisfied_BuildsTheObjectWithoutTheResolvedDependency()
            {
                var dependencyResolver = MockRepository.GenerateMock <IObjectDependencyResolver>();
                var objectFactory      = new ObjectFactory(dependencyResolver, typeof(ComponentWithOptionalDependencyOnService), new PropertySet());

                dependencyResolver.Expect(x => x.ResolveDependency("Service", typeof(IService), null)).Return(DependencyResolution.Unsatisfied());

                var component = (ComponentWithOptionalDependencyOnService)objectFactory.CreateInstance();

                Assert.IsNull(component.Service);

                dependencyResolver.VerifyAllExpectations();
            }