示例#1
0
        public void should_download_cambiavalute_page()
        {
            var page   = _sut.DownloadPage();
            var result = page.GetChangeValue();

            result.Should().BeGreaterThan(0);
        }
示例#2
0
        static void Main(string[] args)
        {
            var path     = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var filename = Path.Combine(path, "change.csv");

            if (!File.Exists(filename))
            {
                IEnumerable <string> lines = new List <string>()
                {
                    "CAMBIO CHF/EUR",
                    "\"Giorno e ora\";\"cambio\""
                };
                File.AppendAllLines(filename, lines);
            }


            var _sut = new PageDownloader();

            var page   = _sut.DownloadPage();
            var result = page.GetChangeValue();


            File.AppendAllLines(filename, new [] { $"\"{DateTime.Now.ToString("s", CultureInfo.InvariantCulture)}\";\"{result.ToString(CultureInfo.InvariantCulture)}\"" });
        }