Beispiel #1
0
        public void GetTabStreamStringsShort()
        {
            /* Arrange */
            var sut_TabFile  = TestConstants.GetSUT_INPUT_FileInfo(TAB_FILE_NAME);
            var sut_JsonFile = TestConstants.GetSUT_OUTPUT_FileInfo(JSON_FILE_NAME);

            if (sut_JsonFile.Exists)
            {
                sut_JsonFile.Delete();
            }
            var tr = new TabReader();

            /* Act */
            var gotHeader = tr.ReadLineTabJsonStrings(TAB_HEADER_SHORT);

            using var inputStream  = sut_TabFile.OpenRead();
            using var outputStream = sut_JsonFile.OpenWrite();

            var tsr = new TabStreamReader(inputStream);

            tsr.WriteToSimpleJsonStream(gotHeader, outputStream);

            //Utf8JsonWriter writer = WriteJsonToStream(gotHeader, inputStream, outputStream);


            sut_JsonFile.Refresh();

            /* Assert */
            Assert.True(sut_JsonFile.Exists);
            Assert.True(sut_JsonFile.Length > 0);
        }
Beispiel #2
0
        public void GetTabStreamStringsWithIEnumerablePropertyNames()
        {
            /* Arrange */
            var sut_TabFile  = TestConstants.GetSUT_INPUT_FileInfo(TAB_FILE_NAME);
            var sut_JsonFile = TestConstants.GetSUT_OUTPUT_FileInfo(JSON_FILE_NAME);

            if (sut_JsonFile.Exists)
            {
                sut_JsonFile.Delete();
            }


            /* Act */
            var gotHeader = new[]
            {
                "country code",
                "postal code",
                "place name",
                "admin name1",
                "admin code1",
                "admin name2",
                "admin code2",
                "admin name3",
                "admin code3",
                "latitude",
                "longitude",
                "accuracy"
            };

            using var inputStream  = sut_TabFile.OpenRead();
            using var outputStream = sut_JsonFile.OpenWrite();

            var tsr = new TabStreamReader(inputStream);

            tsr.WriteToSimpleJsonStream(gotHeader, outputStream);

            //Utf8JsonWriter writer = WriteJsonToStream(gotHeader, inputStream, outputStream);


            sut_JsonFile.Refresh();

            /* Assert */
            Assert.True(sut_JsonFile.Exists);
            Assert.True(sut_JsonFile.Length > 0);
        }