コード例 #1
0
 private void Compare(string args, Type[] commandsTypes, string funcName, bool removeFile = true)
 {
     try
     {
         var test   = this.GetTestData(args, commandsTypes);
         var result = TestHelper.CompareObjects <TestAppHistory>(test, null, funcName);
         Assert.True(result);
     }
     catch
     {
         throw;
     }
     finally
     {
         var fileManager = new JsonFileManager();
         fileManager.SaveInRootFolderWhenIsDebug = false;
         fileManager.Remove(ArgsHistoryCommand.FILE_NAME);
     }
 }
コード例 #2
0
        public void Test_HistorySave_WithSaveAndLoad_SaveAndLoad()
        {
            var strWriter     = new StringWriter();
            var commandsTypes = GetCmds(
                new Common.Commands.T31.Command1(),
                new Common.Commands.T31.Command2(),
                new Common.Commands.T31.Command3()
                );

            try
            {
                var list = new List <TestData>();
                list.Add(this.GetTestData("--prop1 value history-save key1", commandsTypes));
                list.Add(this.GetTestData("--prop1 \"TWO \\\"quote\\\"\" save 1 save 2 history-save key2", commandsTypes));
                list.Add(this.GetTestData("--prop2 0.1099 history-save key1", commandsTypes));
                list.Add(this.GetTestData("history-list", commandsTypes));
                list.Add(this.GetTestData("save history-list", commandsTypes));
                list.Add(this.GetTestData("history-load key2", commandsTypes));
                list.Add(this.GetTestData("save 1 history-load key2", commandsTypes));
                list.Add(this.GetTestData("history-load key1 history-load key2", commandsTypes));
                list.Add(this.GetTestData("history-delete key2", commandsTypes));
                list.Add(this.GetTestData("history-list", commandsTypes));

                var result = TestHelper.CompareObjects <TestAppHistory>(list, null, TestHelper.GetCurrentMethodName());
                Assert.True(result);
            }
            catch
            {
                throw;
            }
            finally
            {
                var fileManager = new JsonFileManager();
                fileManager.SaveInRootFolderWhenIsDebug = false;
                fileManager.Remove(ArgsHistoryCommand.FILE_NAME);
            }
        }