public void CanPersistACallToSetChild()
 {
     var s = Guid.NewGuid().ToString();
     var cup = new SourceryDb().Get<Cup>(s).Proxy();
     cup.Egg = new Egg();
     var sourcerer2 = new SourceryDb().Get<Cup>(s);
     Assert.True(sourcerer2.ReadModel.Egg != null);
 }
Esempio n. 2
0
 public void WontRunConstructorWhenCreatingProxy()
 {
     var s = Guid.NewGuid().ToString();
     var db = new SourceryDb().Get<Registry>(s);
     var model = db.ReadModel;
     Registry.throwError = true;
     var proxy = db.Proxy();
 }
 public void CanPersistACallToAnEnumerable()
 {
     var s = Guid.NewGuid().ToString();
     var basket = new SourceryDb().Get<Basket>(s).Proxy();
     var enumerator = basket.Eggs.GetEnumerator();
     enumerator.MoveNext();
     enumerator.Current.CrackIt();
     var sourcerer2 = new SourceryDb().Get<Basket>(s);
     Assert.True(sourcerer2.ReadModel.Eggs.First().IsCracked);
 }
        public void CanPersistACallToAChildRetreivedViaAMethodCall()
        {
            var db = new SourceryDb();
            var cup = db.Get<CupWithEgg>("Cup123").Proxy();
            Assert.False(cup.Egg.IsCracked);
            cup.GetTheEgg().IsCracked = true;
            Assert.True(cup.Egg.IsCracked);

            var sourcerer2 = new SourceryDb().Get<CupWithEgg>("Cup123");
            Assert.True(sourcerer2.ReadModel.Egg.IsCracked);
        }
Esempio n. 5
0
        public void CanUseGatewayInProxy()
        {
            var s = Guid.NewGuid().ToString();
            var db = new SourceryDb().Get<Thing>(s);
            var model = db.ReadModel;
            var proxy = db.Proxy();
            proxy.MethodThatGetsTime();

            var db2 = new SourceryDb().Get<Thing>(s);
            var model2 = db2.ReadModel;
            Assert.NotNull(model2.Then);
        }
        public void CanPersistASetProperty()
        {
            var db = new SourceryDb();
            var objectid = Guid.NewGuid().ToString();
            var egg = db.Get<Egg>(objectid).Proxy();

            Assert.False(egg.IsCracked);
            egg.IsCracked = true;
            Assert.True(egg.IsCracked);

            var sourcerer2 = new SourceryDb().Get<Egg>(objectid);
            Assert.True(sourcerer2.ReadModel.IsCracked);
        }
        public void CanPersistACallToAChild()
        {
            var objectid = Guid.NewGuid().ToString();
            var cup = new SourceryDb()
                .Get<CupWithEgg>(objectid)
                .Proxy();
            Assert.False(cup.Egg.IsCracked);
            cup.Egg.IsCracked = true;
            Assert.True(cup.Egg.IsCracked);

            var sourcerer2 = new SourceryDb().Get<CupWithEgg>(objectid);
            Assert.True(sourcerer2.ReadModel.Egg.IsCracked);
        }