示例#1
0
        public void ConvertToCsv_OuputFile_GuardClause_Returns_Error()
        {
            IImportItem item = new ImportItem() { InputFile = "teststring" };

            ReturnObject ret = item.ConvertToCsv();

            NUnit.Framework.Assert.AreEqual("Output file cannot be null", ret.ErrorMessage);
        }
示例#2
0
        public void ConvertToCsvReturnsOK()
        {
            var mockWriter = new Mock<ICsvFileWriter>();
            var table = new DataTable();
            IImportItem item = new ImportItem(table, mockWriter.Object);
            item.InputFile = string.Empty;
            item.OutputFile = string.Empty;

            ReturnObject ret = item.ConvertToCsv();

            mockWriter.Object.WriteAsync(table, "hhh");
            mockWriter.Verify(x => x.WriteAsync(table, "hhh"), Times.Exactly(1));
            NUnit.Framework.Assert.AreEqual(0, ret.ErrorNumber);
            NUnit.Framework.Assert.AreEqual("", ret.ErrorMessage);
        }