public static void WriteSyncTest(MapTreeOpenStatusData outputData, string outputFileName)
        {
            var dir = Path.GetDirectoryName(outputFileName);

            dir.CreateDirectoryIfNeed();

            var writer = new MapTreeOpenStatusDataFileWriter(outputFileName);

            var isSuccess    = false;
            var errorMessage = "";

            try
            {
                writer.WriteSync(outputData);
                isSuccess = true;
            }
            catch (Exception e)
            {
                errorMessage = e.Message;
            }

            // 出力成功すること
            if (!isSuccess)
            {
                throw new InvalidOperationException(
                          $"Error message: {errorMessage}");
            }

            Assert.True(true);
        }
Пример #2
0
        public static void File1Test()
        {
            const string inputFileName  = @"Dir1\MapTreeOpenStatus.dat";
            const string outputFileName = @"OutputDir1\MapTreeOpenStatus.dat";

            var inputDir = Path.GetDirectoryName($@"{MapTreeDataFileItemGenerator.TestWorkRootDir}\{inputFileName}");

            inputDir.CreateDirectoryIfNeed();
            var outputDir = Path.GetDirectoryName($@"{MapTreeDataFileItemGenerator.TestWorkRootDir}\{outputFileName}");

            outputDir.CreateDirectoryIfNeed();

            var reader =
                new MapTreeOpenStatusDataFileReader(
                    $@"{MapTreeOpenStatusDataFileItemGenerator.TestWorkRootDir}\{inputFileName}");
            MapTreeOpenStatusData data = null;
            var isSuccessRead          = false;

            try
            {
                data          = reader.ReadSync();
                isSuccessRead = true;
            }
            catch (Exception ex)
            {
                logger.Exception(ex);
            }

            Assert.IsTrue(isSuccessRead);

            var writer = new MapTreeOpenStatusDataFileWriter(
                $@"{MapTreeOpenStatusDataFileItemGenerator.TestWorkRootDir}\{outputFileName}");
            var isSuccessWrite = false;

            try
            {
                writer.WriteSync(data);
                isSuccessWrite = true;
            }
            catch (Exception ex)
            {
                logger.Exception(ex);
            }

            Assert.IsTrue(isSuccessWrite);
        }