public void LoadsAndStartsTracking()
        {
            var pm  = CreatePersistenceManager();
            var fsc = new FakeSubsystemComponent();
            var fs  = new FakeSubsystem(fsc);

            pm.LoadAndStartTracking(fs);

            AssertAllAreDefault(fs);
        }
        public void GivenReturnExisting_WhenExisiting_ReturnsExisting()
        {
            var pm  = CreatePersistenceManager();
            var fsc = new FakeSubsystemComponent();
            var fs  = new FakeSubsystem(fsc);

            pm.LoadAndStartTracking(fs);

            var newFs = new FakeSubsystem(new FakeSubsystemComponent());

            var o = pm.LoadAndStartTracking(newFs, returnExistingInsteadOfException: true);

            Expect(o, EqualTo(fs));
        }
        public void WhenPending_SavesAll()
        {
            {
                var pm  = CreatePersistenceManager();
                var fsc = new FakeSubsystemComponent();
                var fs  = new FakeSubsystem(fsc);

                pm.LoadAndStartTracking(fs);

                ChangeAll(fs);
                fs.PersistibleChangesPending = true;
                pm.SavePending();
            }

            {
                var pm  = CreatePersistenceManager();
                var fsc = new FakeSubsystemComponent();
                var fs  = new FakeSubsystem(fsc);

                pm.LoadAndStartTracking(fs);

                AssertAllChangedAfterReload(fs);
            }
        }
        public void WhenNotPending_DoesNotSave()
        {
            {
                var pm  = CreatePersistenceManager();
                var fsc = new FakeSubsystemComponent();
                var fs  = new FakeSubsystem(fsc);

                pm.LoadAndStartTracking(fs);

                ChangeAll(fs);

                pm.SavePending();
            }

            {
                var pm  = CreatePersistenceManager();
                var fsc = new FakeSubsystemComponent();
                var fs  = new FakeSubsystem(fsc);

                pm.LoadAndStartTracking(fs);

                AssertAllAreDefault(fs);
            }
        }