示例#1
0
        public async Task TestExportSampleCsv()
        {
            _container.Tests = new TestSheet();

            var testRow = new TestSheet.Row {
                Id      = "TestId",
                Content = "TestContent"
            };

            _container.Tests.Add(testRow);

            _container.PostLoad();

            var result = await _container.Store(_converter);

            _fileSystem.VerifyTestData(Path.Combine("testdata", "Tests.csv"), "Id,Content\nTestId,TestContent\n");
        }
示例#2
0
        public void TestNullReference()
        {
            _container.Tests  = new TestSheet();
            _container.Refers = new TestReferenceSheet();

            var referRow = new TestReferenceSheet.Row();

            referRow.Id          = "Refer";
            referRow.ReferColumn = new TestSheet.Reference(null);

            _container.Refers.Add(referRow);

            var testRow = new TestSheet.Row();

            testRow.Id = "Test";

            _container.Tests.Add(testRow);

            _container.PostLoad();

            Assert.Null(_container.Refers["Refer"].ReferColumn.Ref);
        }
示例#3
0
        public void TestNestedReference()
        {
            _container.Tests  = new TestSheet();
            _container.Refers = new TestReferenceSheet();

            var referRow = new TestReferenceSheet.Row();

            referRow.Id          = "Refer";
            referRow.ReferColumn = new TestSheet.Reference("Test1");

            _container.Refers.Add(referRow);

            var referElem = new TestReferenceSheet.Elem();

            referElem.NestedReferColumn = new TestSheet.Reference("Test2");

            referRow.Arr.Add(referElem);

            var testRow1 = new TestSheet.Row();

            testRow1.Id      = "Test1";
            testRow1.Content = "Content1";

            _container.Tests.Add(testRow1);

            var testRow2 = new TestSheet.Row();

            testRow2.Id      = "Test2";
            testRow2.Content = "Content2";

            _container.Tests.Add(testRow2);

            _container.PostLoad();

            Assert.Equal("Content1", _container.Refers["Refer"].ReferColumn.Ref.Content);
            Assert.Equal("Content2", _container.Refers["Refer"][0].NestedReferColumn.Ref.Content);
        }