コード例 #1
0
        public void Version1ToLogBookWithRefreshTest()
        {
            // Setup
            const string xmlString =
                @"<?xml version=""1.0"" encoding=""utf-8""?>
<logbook version=""1"">
  <log Guid=""00299e35-d8b8-4357-9e84-5d5a9e472e01"" EditTime=""2021-12-30T19:45:46.4050000-05:00"" StartTime=""2021-12-30T19:27:18.7370000-05:00"" EndTime=""2021-12-30T19:45:15.1720000-05:00"" Comments=""Okay session after being back on vacation."" Technique=""Focus on Breath"" Latitude="""" Longitude="""" />
</logbook>
";
            var log0 = new Log
            {
                Guid     = Guid.Parse("00299e35-d8b8-4357-9e84-5d5a9e472e01"),
                Comments = "Okay session after being back on vacation.",
                // XML is in local time, but when it goes into our database and we refresh, we expect
                // it to be in universal time, like the rest of the backend.
                EditTime  = new DateTime(2021, 12, 30, 19, 45, 46, 405, DateTimeKind.Local).ToUniversalTime(),
                EndTime   = new DateTime(2021, 12, 30, 19, 45, 15, 172, DateTimeKind.Local).ToUniversalTime(),
                StartTime = new DateTime(2021, 12, 30, 19, 27, 18, 737, DateTimeKind.Local).ToUniversalTime(),
                Latitude  = null,
                Longitude = null,
                Technique = "Focus on Breath"
            };

            const string fileName = $"{nameof( Version1ToLogBookWithRefreshTest )}.db";

            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }

            try
            {
                // Act
                IList <Log> logs = LogBookXmlLoader.ParseLogbookXmlString(xmlString);
                using (LogBook logbook = new LogBook(fileName))
                {
                    foreach (Log log in logs)
                    {
                        logbook.ImportLog(log);
                    }

                    logbook.Refresh();

                    // Check
                    Assert.AreEqual(1, logbook.Count);
                    Assert.AreEqual(log0, logbook[log0.Guid]);
                }
            }
            finally
            {
                if (File.Exists(fileName))
                {
                    File.Delete(fileName);
                }
            }
        }
コード例 #2
0
 public void SetNickname(string name)        // function to allow players to change the nickname of the colors.
 {
     if (logbookScript.currentColor != null) // if there is a current color
     {
         print("I'm going to change the name of this monster.");
         logbookScript.currentColor.hasNickname = true;// Change the boolean that tracks whether or not a color has a nickname to true.
         logbookScript.currentColor.nickname    = name;
         logbookScript.Refresh();
         inputText.SetActive(false);
     }
 }