Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
0
        public void ShouldWriteHeader()
        {
            var datasoure      = new List <Subscriber> {
            };
            var excelRowWriter = Mock.Of <IExcelRowWriter <Subscriber> >();
            var headerWriter   = Mock.Of <IExcelHeaderWriter <Subscriber> >();
            var t = new ExcelListWriter <Subscriber>(headerWriter, excelRowWriter);

            var excel = t.Write(datasoure);

            Mock.Get(headerWriter).Verify(x =>
                                          x.WriteHeader(It.IsAny <IXLWorksheet>()), Times.Once);
            Assert.Pass();
        }
Exemplo n.º 3
0
        public void ShouldWriteTwoRows()
        {
            var datasoure = new List <Subscriber> {
                new Subscriber
                {
                },
                new Subscriber
                {
                }
            };
            var excelRowWriter = Mock.Of <IExcelRowWriter <Subscriber> >();
            var headerWriter   = Mock.Of <IExcelHeaderWriter <Subscriber> >();
            var t = new ExcelListWriter <Subscriber>(headerWriter, excelRowWriter);

            var excel = t.Write(datasoure);

            Mock.Get(excelRowWriter).Verify(x =>
                                            x.WriteRow(It.IsAny <IXLWorksheet>(), It.IsAny <Subscriber>(), It.IsAny <int>()), Times.Exactly(2));

            Assert.Pass();
        }