コード例 #1
0
        public void ReadFromFile_Ok()
        {
            var validPath = Environment.CurrentDirectory + "\\Rates.json";

            IFileReader fileReader = new GNB_EduardoMenaCiudad.FileReaders.FileReader();
            var         result     = fileReader.ReadFileAsync(validPath);
        }
コード例 #2
0
        public void ReadFromFile_Fail()
        {
            var notExistentPath = "";

            IFileReader fileReader = new GNB_EduardoMenaCiudad.FileReaders.FileReader();

            Assert.ThrowsAsync <System.IO.FileNotFoundException>(() => fileReader.ReadFileAsync(notExistentPath));
        }
コード例 #3
0
        public async void WriteFile_Ok()
        {
            var validPath = "C:\\Users\\CTA\\Desktop\\GNB\\GNB_EduardoMenaCiudad\\GNB_EduardoMenaCiudad\\Rates.json";

            IFileReader fileReader = new GNB_EduardoMenaCiudad.FileReaders.FileReader();

            var content = System.IO.File.ReadAllText(validPath);

            await fileReader.WriteFileAsync(validPath, content);

            var retrievedContent = System.IO.File.ReadAllText(validPath);

            Assert.Equal(content, retrievedContent);
        }