public void ShouldDetermineIfIsFirstLoad()
        {
            var stub = new Stub(IsolatedStorageType.Application) { AutoSave = false };
            stub.Clear();
            stub.Store.Save();

            stub.IsFirstLoad.ShouldBe(true);
            stub = new Stub(IsolatedStorageType.Application) { AutoSave = false };
            stub.IsFirstLoad.ShouldBe(true);

            stub.Save();
            stub.IsFirstLoad.ShouldBe(false);
        }
        public void ShouldClearInIsolatedStoreWhenNotSerializing()
        {
            var stub1 = new Stub(IsolatedStorageType.Application, "Stub") { AutoSave = false, MyString = "value" };
            stub1.MyString.ShouldBe("value");
            stub1.Save();

            stub1 = new Stub(IsolatedStorageType.Application, "Stub") { AutoSave = false };
            stub1.MyString.ShouldBe("value");

            stub1.Clear();
            stub1.Save();

            stub1 = new Stub(IsolatedStorageType.Application, "Stub") { AutoSave = false };
            stub1.MyString.ShouldBe(null);
        }
 public void ShouldAllowClearToBeCalledMultipleTimes()
 {
     var stub1 = new Stub(IsolatedStorageType.Application, "Stub") { AutoSave = false, MyString = "value" };
     stub1.Clear();
     stub1.Clear();
     stub1.Clear();
     stub1.MyString.ShouldBe(null);
 }
        public void ShouldClearOnlySpecificStubInMemory()
        {
            var stub1 = new Stub(IsolatedStorageType.Application, "Stub") {AutoSave = false, MyString = "value"};
            var stub2 = new Stub(IsolatedStorageType.Application, "Stub/1") { AutoSave = false, MyString = "value" };
            var stub3 = new Stub(IsolatedStorageType.Application, "Stub.MyString") { AutoSave = false, MyString = "value" };

            stub1.Save();
            stub2.Save();
            stub3.Save();

            var store = stub1.Store;
            store.Keys.ShouldContain(stub1.Id);
            store.Keys.ShouldContain(stub2.Id);
            store.Keys.ShouldContain(stub3.Id);

            // ---

            stub1.Store.ShouldBe(stub2.Store);

            stub1.Clear();
            store.Keys.ShouldNotContain(stub1.Id);
            store.Keys.ShouldContain(stub2.Id);
            store.Keys.ShouldContain(stub3.Id);
        }