public void SaveRestoreTest_UsersOnly()
        {
            CampfireState target = CampfireState.Instance;

            target.AddUser(1, "Peter", "*****@*****.**", null);
            target.AddUser(2, "Jake", "*****@*****.**", "*****@*****.**");

            Assert.AreEqual(2, target.Users.Count);
            Assert.AreEqual(0, target.Rooms.Count);

            CampfireState newCampfireInfo = CampfireState_Accessor.Restore(BackingStorePath);

            Match(target, newCampfireInfo);
        }
        public void SaveRestoreTest_UsersOnly_WithDelay()
        {
            CampfireState target = CampfireState.Instance;

            target.AddUser(2, "Jake", "*****@*****.**", "*****@*****.**");

            Assert.AreEqual(1, target.Users.Count);
            Assert.AreEqual(0, target.Rooms.Count);

            target.UpdateUser(2, 4);
            CampfireState.UserInfo ui = target.Users.FirstOrDefault(u => u.Id == 2);
            Assert.AreEqual(4, ui.DelayInMinutes);

            target.AddUser(1, "Peter", "*****@*****.**", null);

            CampfireState newCampfireInfo = CampfireState_Accessor.Restore(BackingStorePath);

            Match(target, newCampfireInfo);

            ui = newCampfireInfo.Users.FirstOrDefault(u => u.Id == 2);
            Assert.AreEqual(4, ui.DelayInMinutes);
            ui = newCampfireInfo.Users.FirstOrDefault(u => u.Id == 1);
            Assert.AreEqual(-1, ui.DelayInMinutes);
        }
        public void Work_ScanForUserChangesTest()
        {
            CampfireState   campInfo = CampfireState.Instance;
            MockCampfireAPI api      = new MockCampfireAPI();

            // initialize known state with 1 user
            int changedUserId = 12;

            campInfo.AddUser(changedUserId, "Peter", "*****@*****.**", "1234");

            // Now change the data assoc with that user (at the API level)
            api.FakeUsers.Add(new User("Jake", "*****@*****.**", changedUserId));

            // The process step should now pick up the change and incorporate into campfileState
            MessageProcessor_Accessor.Work_ScanForUserChanges(campInfo, api);
            Assert.AreEqual(1, campInfo.Users.Count);
            Assert.IsTrue(campInfo.Users.Any(u => u.Id == changedUserId && u.Name == "Jake" && u.EmailAddress == "*****@*****.**"));
        }