Пример #1
0
        public void TestGetDependencies( )
        {
            long testSolutionId = Entity.GetIdFromUpgradeId(_testSolutionUpgradeId);

            var applicationDependencies = SolutionHelper.GetApplicationDependencies(testSolutionId);

            Assert.IsTrue(applicationDependencies.Count > 0, "No application dependencies found");
        }
Пример #2
0
        public HttpResponseMessage GetDependencies(long vid)
        {
            IEnumerable <Solution> solutions = SolutionHelper.GetApplicationDependencies(vid).Select(ad => ad.DependencyApplication);

            List <DependentAppData> data = new List <DependentAppData>( );

            foreach (Solution solution in solutions)
            {
                data.Add(new DependentAppData(solution.Id, solution.Name, solution.SolutionVersionString));
            }

            var response = new HttpResponseMessage <IList <DependentAppData> >(data, HttpStatusCode.OK);

            return(response);
        }
Пример #3
0
        public void TestGetApplicationDependencies(long applicationId, bool immediateOnly, int expectedCount = 0, IEnumerable <Guid> expectedResults = null)
        {
            IList <ApplicationDependency> results = SolutionHelper.GetApplicationDependencies(applicationId, immediateOnly);

            Assert.IsNotNull(results);
            Assert.AreEqual(expectedCount, results.Count);

            if (expectedResults != null)
            {
                List <Guid> dependencies = results.Select(r => Entity.GetUpgradeId(r.DependencyApplication.Id)).ToList( );

                foreach (Guid expectedResult in expectedResults)
                {
                    Assert.Contains(expectedResult, dependencies);
                }
            }
        }
Пример #4
0
        public void TestGetApplicationDependencies( )
        {
            Solution appA = new Solution
            {
                Name = "appA"
            };
            Solution appB = new Solution
            {
                Name = "appB"
            };
            Solution appC = new Solution
            {
                Name = "appC"
            };
            Solution appD = new Solution
            {
                Name = "appD"
            };
            Solution appE = new Solution
            {
                Name = "appE"
            };

            ApplicationDependency aDependsOnB = new ApplicationDependency
            {
                Name = "appA depends on appB",
                DependentApplication  = appA,
                DependencyApplication = appB
            };

            appA.DependentApplicationDetails.Add(aDependsOnB);

            ApplicationDependency aDependsOnC = new ApplicationDependency
            {
                Name = "appA depends on appC",
                DependentApplication  = appA,
                DependencyApplication = appC
            };

            appA.DependentApplicationDetails.Add(aDependsOnC);

            appA.Save( );

            ApplicationDependency bDependsOnD = new ApplicationDependency
            {
                Name = "appB depends on appD",
                DependentApplication  = appB,
                DependencyApplication = appD
            };

            appB.DependentApplicationDetails.Add(bDependsOnD);

            appB.Save( );

            ApplicationDependency cDependsOnE = new ApplicationDependency
            {
                Name = "appC depends on appE",
                DependentApplication  = appC,
                DependencyApplication = appE
            };

            appC.DependentApplicationDetails.Add(cDependsOnE);

            appC.Save( );

            IList <ApplicationDependency> results = SolutionHelper.GetApplicationDependencies(appA.Id, true);

            Assert.IsNotNull(results);
            Assert.AreEqual(2, results.Count);

            List <long> dependencies = results.Select(r => r.DependencyApplication.Id).ToList( );

            Assert.Contains(appB.Id, dependencies);
            Assert.Contains(appC.Id, dependencies);

            results = SolutionHelper.GetApplicationDependencies(appA.Id);

            Assert.IsNotNull(results);
            Assert.AreEqual(4, results.Count);

            dependencies = results.Select(r => r.DependencyApplication.Id).ToList( );

            Assert.Contains(appB.Id, dependencies);
            Assert.Contains(appC.Id, dependencies);
            Assert.Contains(appD.Id, dependencies);
            Assert.Contains(appE.Id, dependencies);
        }