예제 #1
0
        public void TestWriteToLog()
        {
            //Arrange
            var init = new OlcSideScrollingConsoleGame.Core.ReadWrite();

            //Act
            init.WriteToLog("Unit test write to log");
            //Assert
        }
예제 #2
0
        public void TestReadJson()
        {
            //Arrange
            var    init          = new OlcSideScrollingConsoleGame.Core.ReadWrite();
            string Path          = "\\Resources\\Settings";
            string FileName      = "\\settings";
            string FileExtension = ".json";

            //Act
            var returnObj = init.ReadJson <SettingsObj>(Path, FileName, FileExtension);

            //Assert
            Assert.IsNotNull(returnObj);
            Assert.IsTrue(returnObj is SettingsObj);
            //Assert.IsNotNull(returnObj.misc);
            //Assert.IsTrue(returnObj.misc == "Unit test");
        }
예제 #3
0
        public void TestWriteJson()
        {
            //Arrange
            var    rw            = new OlcSideScrollingConsoleGame.Core.ReadWrite();
            string Path          = "\\Resources\\Settings";
            string FileName      = "\\settings";
            string FileExtension = ".json";

            // highscore

            var HSO = new HighScoreObj()
            {
                //Id = 1,
                Handle = "AAA",
                //Hours = 0,
                //Minutes = 5,
                //Seconds = 2,
                //Time = "00:05:02:123"
            };
            var HSOList = new List <HighScoreObj>();

            HSOList.Add(HSO);

            var testObj = new SettingsObj()
            {
                //misc = "Unit test",
                //AttributeIndex = new int[3] { 1, 2, 4 }
                //HighScoreList = HSOList
            };

            //Act
            var success = rw.WriteJson <SettingsObj>(Path, FileName, FileExtension, testObj);

            //Assert
            Assert.IsTrue(success);
        }