Beispiel #1
0
        public async Task TestWithFakeStream()
        {
            var fakeData = "{ \"list\": [" +

                           "{ \"id\": \"1\"," +
                           "\"firstname\": \"Philip\"," +
                           "\"lastname\": \"Norton\"," +
                           "\"email\": \"[email protected]\"," +
                           "\"mobile\": \"+46705251120\"" +
                           "}," +
                           "{" +
                           "\"id\": \"2\"," +
                           "\"firstname\": \"Philip\"," +
                           "\"lastname\": \"Norton\"," +
                           "\"email\": \"[email protected]\"," +
                           "\"mobile\": \"+46705251121\"" +
                           "}]}";

            byte[]       byteArray = Encoding.ASCII.GetBytes(fakeData);
            MemoryStream stream    = new MemoryStream(byteArray);
            var          source    = new AwesomeCorpDatasource();
            var          list      = await source.GetDeserilizedAsync(stream);

            Assert.IsTrue(list.List.ElementAt(0).Email == "*****@*****.**");
        }
Beispiel #2
0
        public async Task WriteFileTo(DirectoryInfo directoryInfo, string filename)
        {
            PropertyLister.Load();

            var datasource = await AwesomeCorpDatasource.GetSubscribers();

            using (var excel = ExcelListWriter.Write(datasource.List))
            {
                var path = Path.Combine(directoryInfo.FullName, filename);
                Logger.LogDebug("Saving excel document in " + path);
                excel.SaveAs(path);
            }
        }