Ejemplo n.º 1
0
        public Dictionary <string, string> GetDataFileSettings()
        {
            JSonFilesHandler jsonFileHandler      = new JSonFilesHandler();
            string           separator            = Path.DirectorySeparatorChar.ToString();
            string           projectDirectoryPath = "ELCV.Infrastructure";
            string           dataFolderName       = "Data";
            string           fileName             = "dataconfig.json";
            string           fileFullPath         = Directory.GetParent(Directory.GetCurrentDirectory()).FullName
                                                    + separator + projectDirectoryPath + separator + dataFolderName;
            Dictionary <string, string> DataFileSettings = jsonFileHandler.GetJsonFileData(fileFullPath, fileName);

            return(DataFileSettings);
        }
Ejemplo n.º 2
0
        public void GetJsonFileDataTest()
        {
            string folderSeparator = Path.DirectorySeparatorChar.ToString();

            string fileDirectoryPath           = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName + folderSeparator + "Infrastructure" + folderSeparator + "Data";
            string fileName                    = "dataconfig.json";
            Dictionary <string, string> result = Handler.GetJsonFileData(fileDirectoryPath, fileName);

            //Has to be the same Content of dataconfig.json
            var expected = new Dictionary <string, string>()
            {
                { "ConfigFileName", "appsettings.json" }, { "ProjectDirectoryPath", "ELCV.UI" }, { "DBConnectionStringName", "ELCVConnectionString" }
            };

            CollectionAssert.AreEquivalent(expected, result);
        }