public static void ConstructorTest(string path, bool isError)
        {
            UserDatabaseProjectFilePath instance = null;

            var errorOccured = false;

            try
            {
                instance = new UserDatabaseProjectFilePath(path);
            }
            catch (Exception ex)
            {
                logger.Exception(ex);
                errorOccured = true;
            }

            // エラーフラグが一致すること
            Assert.AreEqual(errorOccured, isError);

            if (errorOccured)
            {
                return;
            }

            // 内容が一致すること
            Assert.AreEqual((string)instance, path);
        }
예제 #2
0
        public static void Database1ProjectIOTest()
        {
            UserDatabaseProjectFilePath inputFileName =
                $@"{DatabaseProjectFileTestItemGenerator.TestWorkRootDir}\Database1.project";
            UserDatabaseProjectFilePath outputFileName =
                $@"{DatabaseProjectFileTestItemGenerator.TestWorkRootDir}\OutputDatabase1.project";

            var reader =
                new DatabaseProjectFileReader(
                    inputFileName,
                    DBKind.User);
            DatabaseProject data          = null;
            var             isSuccessRead = false;

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

            Assert.IsTrue(isSuccessRead);

            var writer         = new DatabaseProjectFileWriter(outputFileName);
            var isSuccessWrite = false;

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

            Assert.IsTrue(isSuccessWrite);

            Console.WriteLine(
                $"Written FilePath : {outputFileName}");
        }