コード例 #1
0
        public void ExcelToJsonFileConverter_Convert_ThrowsnUnsupportted(string srcEx, string destExt)
        {
            //not supported
            var e2jc = new ExcelToJsonFileConverter();

            Should.Throw <NotSupportedException>(() => e2jc.Convert(srcEx, destExt, new byte[] { 1, 0, 0, 1 }, null));
        }
コード例 #2
0
        public void ExcelToJsonFileConverter_Converts_EmptyFile(string fileName)
        {
            var path      = Path.Combine(ResourceFolder, fileName);
            var extension = Path.GetExtension(fileName).Replace(".", "");
            var bytes     = File.ReadAllBytes(path);
            var e2jc      = new ExcelToJsonFileConverter();

            e2jc.Convert(extension, JsonExtension, bytes, null).Count().ShouldBe(0);
        }
コード例 #3
0
        public void ExcelToJsonFileConverter_Converts(string fileName)
        {
            var path       = Path.Combine(ResourceFolder, fileName);
            var extension  = Path.GetExtension(fileName).Replace(".", "");
            var bytes      = File.ReadAllBytes(path);
            var e2jc       = new ExcelToJsonFileConverter();
            var converted  = e2jc.Convert(extension, JsonExtension, bytes, null);
            var actualJson = Encoding.UTF8.GetString(converted);

            actualJson.ShouldBe(SomeDataExpectedJson);
        }
コード例 #4
0
        public void ExcelToJsonFileConverter_Convert_ThrowsnOnNullByteArray(string srcExt)
        {
            var e2jc = new ExcelToJsonFileConverter();

            Should.Throw <NullReferenceException>(() => e2jc.Convert(srcExt, JsonExtension, null, null));
        }