예제 #1
0
파일: Fixture.cs 프로젝트: jrauber/GH1429
        public async Task ReplaceValueTypeComponentWithSameValueDoesNotMakeItDirtyAsync()
        {
            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    Person  p = new Person("Jimmy Hendrix");
                    Address a = new Address();
                    a.Street  = "Some Street";
                    a.City    = "Some City";
                    p.Address = a;

                    await(s.SaveAsync(p));
                    await(tx.CommitAsync());
                }

            InterceptorStub interceptor = new InterceptorStub();

            using (ISession s = OpenSession(interceptor))
                using (ITransaction tx = s.BeginTransaction())
                {
                    Person jimmy = await(s.GetAsync <Person>("Jimmy Hendrix"));
                    interceptor.entityToCheck = jimmy;

                    Address a = new Address();
                    a.Street      = "Some Street";
                    a.City        = "Some City";
                    jimmy.Address = a;
                    Assert.AreNotSame(jimmy.Address, a);

                    await(tx.CommitAsync());
                }
            Assert.IsFalse(interceptor.entityWasDeemedDirty);
        }
예제 #2
0
		public void ReplaceValueTypeComponentWithSameValueDoesNotMakeItDirty()
		{
			using (ISession s = OpenSession())
			using (ITransaction tx = s.BeginTransaction())
			{
				Person p = new Person("Jimmy Hendrix");
				Address a = new Address();
				a.Street = "Some Street";
				a.City = "Some City";
				p.Address = a;

				s.Save(p);
				tx.Commit();
			}

			InterceptorStub interceptor = new InterceptorStub();
			using (ISession s = OpenSession(interceptor))
			using (ITransaction tx = s.BeginTransaction())
			{
				Person jimmy = s.Get<Person>("Jimmy Hendrix");
				interceptor.entityToCheck = jimmy;

				Address a = new Address();
				a.Street = "Some Street";
				a.City = "Some City";
				jimmy.Address = a;
				Assert.AreNotSame(jimmy.Address, a);

				tx.Commit();
			}
			Assert.IsFalse(interceptor.entityWasDeemedDirty);
		}
예제 #3
0
파일: Fixture.cs 프로젝트: jrauber/GH1429
        public async Task EmptyValueTypeComponentAsync()
        {
            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    Person p = new Person("Jimmy Hendrix");
                    await(s.SaveAsync(p));
                    await(tx.CommitAsync());
                }

            InterceptorStub interceptor = new InterceptorStub();

            using (ISession s = OpenSession(interceptor))
                using (ITransaction tx = s.BeginTransaction())
                {
                    Person jimmy = await(s.GetAsync <Person>("Jimmy Hendrix"));
                    interceptor.entityToCheck = jimmy;
                    await(tx.CommitAsync());
                }
            Assert.IsFalse(interceptor.entityWasDeemedDirty);

            InterceptorStub interceptor2 = new InterceptorStub();

            using (ISession s = OpenSession(interceptor2))
                using (ITransaction tx = s.BeginTransaction())
                {
                    Person jimmy = await(s.GetAsync <Person>("Jimmy Hendrix"));
                    jimmy.Address             = new Address();
                    interceptor.entityToCheck = jimmy;
                    await(tx.CommitAsync());
                }
            Assert.IsFalse(interceptor2.entityWasDeemedDirty);
        }
예제 #4
0
		public void EmptyValueTypeComponent()
		{
			using (ISession s = OpenSession())
			using (ITransaction tx = s.BeginTransaction())
			{
				Person p = new Person("Jimmy Hendrix");
				s.Save(p);
				tx.Commit();
			}

			InterceptorStub interceptor = new InterceptorStub();
			using (ISession s = OpenSession(interceptor))
			using (ITransaction tx = s.BeginTransaction())
			{
				Person jimmy = s.Get<Person>("Jimmy Hendrix");
				interceptor.entityToCheck = jimmy;
				tx.Commit();
			}
			Assert.IsFalse(interceptor.entityWasDeemedDirty);

			InterceptorStub interceptor2 = new InterceptorStub();
			using (ISession s = OpenSession(interceptor2))
			using (ITransaction tx = s.BeginTransaction())
			{
				Person jimmy = s.Get<Person>("Jimmy Hendrix");
				jimmy.Address = new Address();
				interceptor.entityToCheck = jimmy;
				tx.Commit();
			}
			Assert.IsFalse(interceptor2.entityWasDeemedDirty);
		}