Exemplo n.º 1
0
        public void TestDAssemblageConseiller()
        {
            UtilisateurGraphRepository utulisateurGraphRepository;
            Conseiller  conseiller;
            Utilisateur utilisateur;

            DirectoryInfo extractedDirectory;
            string        gabaritDirectoryPath = @"..\\..\\..\\Gabarits";

            try
            {
                CVGenerator generator = new CVGenerator();
                utulisateurGraphRepository = new UtilisateurGraphRepository("Graphe_Essay", "graph_cv");

                extractedDirectory = new DirectoryInfo($"{gabaritDirectoryPath}\\Modele_a_generer");
                if (extractedDirectory.Exists)
                {
                    extractedDirectory.Delete(true);
                }

                extractedDirectory = null;

                utulisateurGraphRepository.DeleteAllDocs();
                generator.ProcessCV(gabaritDirectoryPath);

                utilisateur = utulisateurGraphRepository.GetAll().First();
                conseiller  = utilisateur.Conseiller;

                Assert.IsNotNull(utilisateur);

                Assert.AreEqual(2, conseiller.FormationsScolaires.Count);

                Assert.AreEqual(1, conseiller.Associations.Count);

                Assert.AreEqual(9, conseiller.Formations.Count);

                Assert.IsNotNull(conseiller.Fonction);

                Assert.AreEqual(7, conseiller.DomaineDInterventions.Count);

                Assert.AreEqual(1, conseiller.Technologies.Count);

                Assert.AreEqual(2, conseiller.Employeurs.Count);
            }
            finally
            {
                FileInfo fileInfo = new FileInfo($"{gabaritDirectoryPath}\\Modele_a_generer.xml");
                if (fileInfo.Exists)
                {
                    fileInfo.Delete();
                }
            }
        }
Exemplo n.º 2
0
        public void TestDeGeneration()
        {
            DirectoryInfo extractedDirectory;
            Stream        stream;
            string        gabaritDirectoryPath = @"..\\..\\..\\Gabarits";

            try
            {
                CVGenerator generator = new CVGenerator();

                extractedDirectory = new DirectoryInfo($"{gabaritDirectoryPath}\\Modele_a_generer");
                if (extractedDirectory.Exists)
                {
                    extractedDirectory.Delete(true);
                }

                extractedDirectory = null;

                generator.ProcessCV(gabaritDirectoryPath);

                var    md5 = System.Security.Cryptography.MD5.Create();
                byte[] byteMd5Modele, byteMd5Essay;

                string hashModele = string.Empty, hashEssay = string.Empty;

                using (stream = new FileStream($"{gabaritDirectoryPath}\\Modele_de_CV.xml", FileMode.Open, FileAccess.Read, FileShare.None))
                {
                    byteMd5Modele = md5.ComputeHash((Stream)stream);
                }

                using (stream = new FileStream($"{gabaritDirectoryPath}\\Modele_a_generer.xml", FileMode.Open, FileAccess.Read, FileShare.None))
                {
                    byteMd5Essay = md5.ComputeHash((Stream)stream);
                }

                hashModele = Encoding.ASCII.GetString(byteMd5Modele);
                hashEssay  = Encoding.ASCII.GetString(byteMd5Essay);

                Assert.AreEqual(hashModele, hashEssay);
            }
            finally
            {
                FileInfo fileInfo = new FileInfo($"{gabaritDirectoryPath}\\Modele_a_generer.xml");
                if (fileInfo.Exists)
                {
                    fileInfo.Delete();
                }
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            IConfiguration config     = new ConfigurationBuilder().AddJsonFile("appsettings.json", true, true).Build();
            var            endpoint   = config["GraphConnectionEndPoint"];
            var            primaryKey = config["GraphConnectionPrimaryKey"];
            var            database   = config["GraphConnectionDatabase"];
            var            collection = config["GraphConnectionCollection"];

            GraphConfig.SetGraphDataBaseConnection(endpoint, primaryKey, database, collection);
            CVGenerator generator = new CVGenerator();

            generator.ProcessCV(args[0]);


            Console.WriteLine("Convertion finalisée");
            Console.WriteLine("Appuyer sur un bouton pour sortir");
            Console.ReadKey();
        }
Exemplo n.º 4
0
        public void TestDAssemblageMandat()
        {
            ConseillerGraphRepository conseillerGraphRepository;
            Conseiller conseiller;

            DirectoryInfo extractedDirectory;
            string        gabaritDirectoryPath = @"..\\..\\..\\Gabarits";

            try
            {
                CVGenerator generator = new CVGenerator();
                conseillerGraphRepository = new ConseillerGraphRepository("Graphe_Essay", "graph_cv");

                extractedDirectory = new DirectoryInfo($"{gabaritDirectoryPath}\\Modele_a_generer");
                if (extractedDirectory.Exists)
                {
                    extractedDirectory.Delete(true);
                }

                extractedDirectory = null;

                conseillerGraphRepository.DeleteAllDocs();
                generator.ProcessCV(gabaritDirectoryPath);

                conseiller = conseillerGraphRepository.GetAll().First();

                foreach (Mandat mandat in conseiller.Mandats)
                {
                    Assert.IsNotNull(mandat.Projet);
                    Assert.AreEqual(7, mandat.Projet.Technologies.Count);
                    Assert.IsNotNull(mandat.Projet.Client);
                    Assert.IsNotNull(mandat.Projet.SocieteDeConseil);
                }
            }
            finally
            {
                FileInfo fileInfo = new FileInfo($"{gabaritDirectoryPath}\\Modele_a_generer.xml");
                if (fileInfo.Exists)
                {
                    fileInfo.Delete();
                }
            }
        }