예제 #1
0
        public void GetConfQualityRuleChinese()
        {
            WSConnection _connection3 = new WSConnection()
            {
                Url      = "http://dash-aed-tomcat:8585/CAST-Health-Engineering/rest/",
                Login    = "******",
                Password = "******",
                IsActive = true,
                Name     = "Default"
            };

            TestUtility.SetCulture("zh-CN");
            ICastRepsitory ccontext = new CastRepository(_connection3, null);

            if ("ABD".Equals(Environment.UserName))
            {
                const string cdomainHref = "AAD/quality-indicators/7126/snapshots/1";
                var          result      = ccontext.GetConfBusinessCriteria(cdomainHref);
                Assert.AreEqual("避免工件的已注释掉代码行/代码行的比率过高", result.Name);

                TestUtility.SetCulture("en-US");
                ICastRepsitory ccontext2    = new CastRepository(_connection3, null);
                const string   cdomainHref2 = "AAD/quality-indicators/7126/snapshots/1";
                var            result2      = ccontext2.GetConfBusinessCriteria(cdomainHref2);
                Assert.AreEqual("Avoid Artifacts with high Commented-out Code Lines/Code Lines ratio", result2.Name);
                return;
            }

            bool valid = ccontext.IsServiceValid();

            Assert.IsTrue(valid);
        }
예제 #2
0
 public void GetApplicationTest()
 {
     ICastRepsitory context = new CastRepository(_Connection);
     string appilcationId = "ADG705/applications/3";
     Application result = context.GetApplication(appilcationId);
     Assert.IsNotNull(result);
 }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        protected ICastRepsitory GetRepository()
        {
            CastRepository repo = new CastRepository(Connection, Client);

            Client = repo.GetClient();
            return(repo);
        }
예제 #4
0
        protected static ICastRepsitory GetRepository(WSConnection connection, bool dropCookie = false)
        {
            CastRepository repo = dropCookie ? new CastRepository(connection, null) : new CastRepository(connection, Client);

            Client = repo.GetClient();
            return(repo);
        }
예제 #5
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 static public bool CheckService(WSConnection connection)
 {
     using (ICastRepsitory castRepsitory = new CastRepository(connection))
     {
         return(castRepsitory.IsServiceValid());
     }
 }
예제 #6
0
        public Cast FindCast(string _link)
        {
            var  castRepository = new CastRepository();
            Cast selectedCast   = new Cast();

            selectedCast = castRepository.FindWithLink(x => x.castLink == _link);
            return(selectedCast);
        }
예제 #7
0
        public void GetApplicationTest()
        {
            ICastRepsitory context       = new CastRepository(_connection);
            string         appilcationId = "AED1/applications/3";
            Application    result        = context.GetApplication(appilcationId);

            Assert.IsNotNull(result);
        }
예제 #8
0
        public void GetSnapshotTest()
        {
            ICastRepsitory context    = new CastRepository(_connection);
            string         snapshotId = "AED1/applications/3/snapshots/2";
            Snapshot       result     = context.GetSnapshot(snapshotId);

            Assert.IsNotNull(result);
        }
예제 #9
0
        public void GetModuleTest()
        {
            ICastRepsitory context  = new CastRepository(_connection);
            string         moduleId = "AED1/modules/4";
            Module         result   = context.GetModule(moduleId);

            Assert.IsNotNull(result);
        }
예제 #10
0
        public void IsServiceValidTest()
        {
            ICastRepsitory context = new CastRepository(_connection);

            bool result = context.IsServiceValid();

            Assert.IsTrue(result);
        }
예제 #11
0
        public void GetDomainsTest()
        {
            ICastRepsitory           context = new CastRepository(_connection);
            IEnumerable <CastDomain> result  = context.GetDomains();

            Assert.IsNotNull(result);
            Assert.AreNotEqual(result.Count(), 0);
        }
예제 #12
0
        public void GetApplicationsByDomainTest()
        {
            string domainHref = "ADG705";

            ICastRepsitory context = new CastRepository(_Connection);
            IEnumerable<Application> result = context.GetApplicationsByDomain(domainHref);
            Assert.IsNotNull(result);
        }
예제 #13
0
        static void Main(string[] args)
        {
            //Prepare for importing movies
            var movieDatabase = new MovieDatabase();

            _castRepository  = new CastRepository(movieDatabase);
            _movieRepository = new MovieRepository(movieDatabase);
            _genreRepository = new GenreRepository(movieDatabase);

            //import movies from json file: importedmovies.json in folder: User\Documents\Project\Movies\Movies\bin\Debug
            GetImportedMovies();

            //Menu options to run methods
            var menuOption = MainMenu();

            while (menuOption < 7)
            {
                switch (menuOption)
                {
                case 1:
                    GetAllMovies();
                    break;

                case 2:
                    GetAllCasts();
                    break;

                case 3:
                    GetAllGenres();
                    break;

                case 4:
                    AddMovie();
                    break;

                case 5:
                    AddCast();
                    break;

                case 6:
                    AddGenre();
                    break;

                case 7:
                    break;

                default:
                    Console.WriteLine("You chose an invalid option.");
                    Clear();
                    break;
                }

                if (menuOption != 7)
                {
                    menuOption = MainMenu();
                }
            }
        }
예제 #14
0
        public async Task PrintAllAsync()
        {
            var castCollection = await CastRepository.GetAllAsync();

            foreach (var i in castCollection)
            {
                Console.WriteLine(i.Id + " \t " + i.id);
            }
        }
예제 #15
0
        public void GetSnapshotsByApplicationTest()
        {
            ICastRepsitory context       = new CastRepository(_connection, null);
            string         appilcationId = "AED1/applications/3";
            var            result        = context.GetSnapshotsByApplication(appilcationId);

            Assert.IsNotNull(result);
            Assert.AreNotEqual(result.Count(), 0);
        }
예제 #16
0
        public void GetApplicationsByDomainTest()
        {
            string domainHref = "AED1";

            ICastRepsitory            context = new CastRepository(_connection);
            IEnumerable <Application> result  = context.GetApplicationsByDomain(domainHref);

            Assert.IsNotNull(result);
        }
예제 #17
0
        public void GetModulesBySnapshotTest()
        {
            ICastRepsitory context       = new CastRepository(_connection);
            string         appilcationId = "AED1/applications/3/snapshots/2";
            var            result        = context.GetModules(appilcationId);

            Assert.IsNotNull(result);
            Assert.AreNotEqual(result.Count(), 0);
        }
예제 #18
0
        public void GetConfBusinessCriteria()
        {
            ICastRepsitory context    = new CastRepository(_connection);
            const string   domainHref = "AED1/quality-indicators/61001/snapshots/2";

            var result = context.GetConfBusinessCriteria(domainHref);

            Assert.IsNotNull(result);
        }
예제 #19
0
        public void GetModulesByApplicationTest()
        {
            ICastRepsitory context       = new CastRepository(_Connection);
            string         appilcationId = "ADG705/applications/3";
            var            result        = context.GetModules(appilcationId);

            Assert.IsNotNull(result);
            Assert.AreNotEqual(result.Count(), 0);
        }
예제 #20
0
        public int CastGenerateCastId(Director _director)
        {
            Cast castForInsert = new Cast();

            castForInsert.castLink    = _director.directorLink;
            castForInsert.nameSurname = _director.NameSurname;
            var castRepository = new CastRepository();

            castRepository.Insert(castForInsert);
            return(castForInsert.castId);
        }
예제 #21
0
        public int CastGenerateCastId(Writer _writer)
        {
            Cast castForInsert = new Cast();

            castForInsert.castLink    = _writer.writerLink;
            castForInsert.nameSurname = _writer.NameSurname;
            var castRepository = new CastRepository();

            castRepository.Insert(castForInsert);
            return(castForInsert.castId);
        }
예제 #22
0
        public int CastGenerateCastId(Star _star)
        {
            Cast castForInsert = new Cast();

            castForInsert.castLink    = _star.starLink;
            castForInsert.nameSurname = _star.NameSurname;
            var castRepository = new CastRepository();

            castRepository.Insert(castForInsert);
            return(castForInsert.castId);
        }
예제 #23
0
        public void GetConfBusinessCriteriaBySnapshot()
        {
            ICastRepsitory context    = new CastRepository(_connection);
            const string   domainHref = "AED1";
            const int      snapshotId = 1;

            var result = context.GetConfBusinessCriteriaBySnapshot(domainHref, snapshotId);

            Assert.IsNotNull(result);
            Assert.AreNotEqual(result.Count(), 0);
        }
예제 #24
0
        public void IsHttpsTlsv12ServiceValidTest()
        {
            // Ignored on jenkins machine, because the certificat tomcat.cer is not installed, and test failed
            if (Environment.MachineName != "ABDLAP2")
            {
                return;
            }
            ICastRepsitory context2 = new CastRepository(_connection2);
            bool           result   = context2.IsServiceValid();

            Assert.IsTrue(result);
        }
        public void CreateAsync_ShowIsNull()
        {
            // Given
            Cast cast = null;

            using (var context = new DatabaseContext(options))
            {
                var castRepository = new CastRepository(context);

                Assert.ThrowsAsync <ArgumentNullException>(async() => await castRepository.CreateCastAsync(cast));
            }
        }
예제 #26
0
        public void GetSizingMeasuresByApplicationTest()
        {
            ICastRepsitory context     = new CastRepository(_Connection);
            string         snapshotRef = "ADG705/applications/5";

            Int32[] sizingMeasures    = (Int32[])Enum.GetValues(typeof(Constants.SizingInformations));
            string  strSizingMeasures = string.Join(",", sizingMeasures);

            var result = context.GetResultsSizingMeasures(snapshotRef, strSizingMeasures, "$all", String.Empty, String.Empty);

            Assert.IsNotNull(result);
            Assert.AreNotEqual(result.Count(), 0);
            Assert.AreNotEqual(result.First().ApplicationResults.Count(), 0);
            Assert.AreNotEqual(result.First().ApplicationResults[0].TechnologyResult.Count(), 0);
        }
예제 #27
0
        public void GetQualityIndicatorsByApplicationTest()
        {
            ICastRepsitory context        = new CastRepository(_Connection);
            string         appilcationRef = "ADG705/applications/3";

            Int32[] businessCriterias    = (Int32[])Enum.GetValues(typeof(Constants.BusinessCriteria));
            string  strBusinessCriterias = string.Join(",", businessCriterias);

            var result = context.GetResultsQualityIndicators(appilcationRef, strBusinessCriterias, "$all", string.Empty, string.Empty, string.Empty);


            Assert.IsNotNull(result);
            Assert.AreNotEqual(result.Count(), 0);
            Assert.AreNotEqual(result.First().ApplicationResults.Count(), 0);
        }
예제 #28
0
        public void GetSizingMeasuresByApplicationTest()
        {
            ICastRepsitory context     = new CastRepository(_connection);
            const string   snapshotRef = "AED1/applications/3";

            int[]  sizingMeasures    = (int[])Enum.GetValues(typeof(Constants.SizingInformations));
            string strSizingMeasures = string.Join(",", sizingMeasures);

            var result = context.GetResultsSizingMeasures(snapshotRef, strSizingMeasures, "$all", "$all", "$all");

            Assert.IsNotNull(result);
            var _enumerable = result as IList <Result> ?? result.ToList();

            Assert.AreNotEqual(_enumerable.Count, 0);
            Assert.AreNotEqual(_enumerable.First().ApplicationResults.Length, 0);
            Assert.AreNotEqual(_enumerable.First().ApplicationResults[0].TechnologyResult.Length, 0);
        }
예제 #29
0
        public void GetQualityIndicatorsByApplicationTest()
        {
            ICastRepsitory context        = new CastRepository(_connection);
            const string   appilcationRef = "AED1/applications/3";

            int[]  businessCriterias    = (int[])Enum.GetValues(typeof(Constants.BusinessCriteria));
            string strBusinessCriterias = string.Join(",", businessCriterias);

            var result = context.GetResultsQualityIndicators(appilcationRef, strBusinessCriterias, "$all", string.Empty, string.Empty);


            Assert.IsNotNull(result);
            var _enumerable = result as IList <Result> ?? result.ToList();

            Assert.AreNotEqual(_enumerable.Count, 0);
            Assert.AreNotEqual(_enumerable.First().ApplicationResults.Length, 0);
        }
예제 #30
0
        public CastRepositoryTests()
        {
            SetupData();

            _mockedContext = new Mock <PlayScraperContext>();
            _mockedCast    = new Mock <DbSet <Cast> >();

            _mockedCast.As <IQueryable <Cast> >().Setup(m => m.Provider).Returns(_castMembers.Provider);
            _mockedCast.As <IQueryable <Cast> >().Setup(m => m.Expression).Returns(_castMembers.Expression);
            _mockedCast.As <IQueryable <Cast> >().Setup(m => m.ElementType).Returns(_castMembers.ElementType);
            _mockedCast.As <IQueryable <Cast> >().Setup(m => m.GetEnumerator()).Returns(_castMembers.GetEnumerator());

            _mockedContext.Setup(x => x.Cast).Returns(_mockedCast.Object);
            _mockedContext.Setup(x => x.Cast.AddRangeAsync(_castMembers, It.IsAny <CancellationToken>())).Returns(Task.FromResult(_mockedCast.Object));
            _mockedContext.Setup(x => x.SaveChangesAsync(It.IsAny <CancellationToken>())).Verifiable();

            _repository = new CastRepository(_mockedContext.Object);
        }
예제 #31
0
        public void GetConfQualityRuleChinese()
        {
            WSConnection _connection3 = new WSConnection()
            {
                Url      = "http://dash-aed-tomcat:8888/Dashboard-Noc-170/rest/",
                Login    = "******",
                Password = "******",
                IsActive = true,
                Name     = "Default"
            };

            TestUtility.SetCulture("zh-CN");
            ICastRepsitory ccontext = new CastRepository(_connection3);

            if (Environment.UserName != "abd")
            {
                if (ccontext == null)
                {
                    return;
                }
                if (!ccontext.IsServiceValid())
                {
                    return;
                }
            }
            const string cdomainHref = "ADG83/quality-indicators/7126/snapshots/1";
            var          result      = ccontext.GetConfBusinessCriteria(cdomainHref);

            Assert.AreEqual("避免工件的已注释掉代码行/代码行的比率过高", result.Name);

            TestUtility.SetCulture("en-US");
            ICastRepsitory ccontext2    = new CastRepository(_connection3);
            const string   cdomainHref2 = "ADG83/quality-indicators/7126/snapshots/1";
            var            result2      = ccontext2.GetConfBusinessCriteria(cdomainHref2);

            Assert.AreEqual("Avoid Artifacts with high Commented-out Code Lines/Code Lines ratio", result2.Name);
        }
예제 #32
0
 public void GetModuleTest()
 {
     ICastRepsitory context = new CastRepository(_Connection);
     string moduleId = "ADG705/modules/4";
     Module result = context.GetModule(moduleId);
     Assert.IsNotNull(result);
 }
예제 #33
0
        public void GetDomainsTest()
        {
            ICastRepsitory context = new CastRepository(_Connection);
            IEnumerable<CastDomain> result = context.GetDomains();

            Assert.IsNotNull(result);
            Assert.AreNotEqual(result.Count(),0);
        }
예제 #34
0
        public void GetConfBusinessCriteriaBySnapshot()
        {
            ICastRepsitory context = new CastRepository(_Connection);
            string domainHref = "ADG705";
            Int64 snapshotId = 1;

            var result = context.GetConfBusinessCriteriaBySnapshot(domainHref, snapshotId);

            Assert.IsNotNull(result);
            Assert.AreNotEqual(result.Count(), 0);
        }
예제 #35
0
        public void IsServiceValidTest()
        {
            ICastRepsitory context = new CastRepository(_Connection);

            bool result = context.IsServiceValid();

            Assert.IsTrue( result);
        }
예제 #36
0
        public void GetQualityIndicatorsBySnapshotTest()
        {
            ICastRepsitory context = new CastRepository(_Connection);
            string snapshotRef = "ADG705/applications/5/snapshots/137";

            Int32[] businessCriterias = (Int32[])Enum.GetValues(typeof(Constants.BusinessCriteria));
            string strBusinessCriterias = string.Join(",", businessCriterias);

            var result = context.GetResultsQualityIndicators(snapshotRef, strBusinessCriterias, string.Empty, "$all", "$all", "$all");

            Assert.IsNotNull(result);
            Assert.AreNotEqual(result.Count(), 0);
            Assert.AreNotEqual(result.First().ApplicationResults.Count(), 0);
            Assert.AreNotEqual(result.First().ApplicationResults[0].ModulesResult.Count(), 0);
        }
예제 #37
0
 public void GetSnapshotTest()
 {
     ICastRepsitory context = new CastRepository(_Connection);
     string snapshotId = "ADG705/applications/3/snapshots/138";
     Snapshot result = context.GetSnapshot(snapshotId);
     Assert.IsNotNull(result);
 }
예제 #38
0
        public void GetSizingMeasuresBySnapshotTest()
        {
            ICastRepsitory context = new CastRepository(_Connection);
            string snapshotRef = "ADG705/applications/5/snapshots/137";

            Int32[] sizingMeasures = (Int32[])Enum.GetValues(typeof(Constants.SizingInformations));
            string strSizingMeasures = string.Join(",", sizingMeasures);

            var result = context.GetResultsSizingMeasures(snapshotRef, strSizingMeasures, string.Empty, "$all", "$all");

            Assert.IsNotNull(result);
            Assert.AreNotEqual(result.Count(), 0);
            Assert.AreNotEqual(result.First().ApplicationResults.Count(), 0);
            Assert.AreNotEqual(result.First().ApplicationResults[0].TechnologyResult.Count(), 0);
        }
예제 #39
0
        public void GetConfBusinessCriteria()
        {
            ICastRepsitory context = new CastRepository(_Connection);
            string domainHref = "ADG710/quality-indicators/61001/snapshots/14";

            var result = context.GetConfBusinessCriteria(domainHref);

            Assert.IsNotNull(result);
        }
예제 #40
0
 public CastService()
 {
     _castRepository = new CastRepository(new MovieShopDbContext());
 }
예제 #41
0
 public void GetSnapshotsByApplicationTest()
 {
     ICastRepsitory context = new CastRepository(_Connection);
     string appilcationId = "ADG705/applications/3";
     var result = context.GetSnapshotsByApplication(appilcationId);
     Assert.IsNotNull(result);
     Assert.AreNotEqual(result.Count(), 0);
 }