コード例 #1
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);
        }
コード例 #2
0
 public bool SaveHighScoreList()
 {
     return(ReadWrite.WriteJson <List <HighScoreObj> >(PathSettings, @"\highscore", ".json", HighScoreList));
 }
コード例 #3
0
 public bool SaveSettings()
 {
     return(ReadWrite.WriteJson <SettingsObj>(PathSettings, @"\settings", ".json", Settings));
 }