Ejemplo n.º 1
0
		public void ReadWriteBaseValue()
		{
			var basic = new DateClass { DateValue = new DateTime(1899,1,1) };
			object savedId;
			using (ISession s = OpenSession())
			{
				savedId = s.Save(basic);
				s.Flush();
			}
			using (ISession s = OpenSession())
			{
				basic = s.Get<DateClass>(savedId);
				basic.DateValue.HasValue.Should().Be.False();
				s.Delete(basic);
				s.Flush();
			}
		}
Ejemplo n.º 2
0
		public void ReadWriteNormal()
		{
			var expected = DateTime.Today.Date;

			var basic = new DateClass { DateValue = expected.AddHours(1) };
			object savedId;
			using (ISession s = OpenSession())
			{
				savedId = s.Save(basic);
				s.Flush();
			}
			using (ISession s = OpenSession())
			{
				basic = s.Get<DateClass>(savedId);
				basic.DateValue.Should().Be(expected);
				s.Delete(basic);
				s.Flush();
			}
		}
Ejemplo n.º 3
0
        public void ReadWriteBaseValue()
        {
            var basic = new DateClass {
                DateValue = new DateTime(1899, 1, 1)
            };
            object savedId;

            using (ISession s = OpenSession())
            {
                savedId = s.Save(basic);
                s.Flush();
            }
            using (ISession s = OpenSession())
            {
                basic = s.Get <DateClass>(savedId);
                Assert.That(basic.DateValue.HasValue, Is.False);
                s.Delete(basic);
                s.Flush();
            }
        }
Ejemplo n.º 4
0
        private void ReadWrite(DateTime expected)
        {
            // Add an hour to check it is correctly ignored once read back from db.
            var basic = new DateClass {
                DateValue = expected.AddHours(1)
            };
            object savedId;

            using (var s = OpenSession())
            {
                savedId = s.Save(basic);
                s.Flush();
            }
            using (var s = OpenSession())
            {
                basic = s.Get <DateClass>(savedId);
                Assert.That(basic.DateValue, Is.EqualTo(expected));
                s.Delete(basic);
                s.Flush();
            }
        }
Ejemplo n.º 5
0
        private async Task ReadWriteAsync(DateTime expected, CancellationToken cancellationToken = default(CancellationToken))
        {
            // Add an hour to check it is correctly ignored once read back from db.
            var basic = new DateClass {
                DateValue = expected.AddHours(1)
            };
            object savedId;

            using (var s = OpenSession())
            {
                savedId = await(s.SaveAsync(basic, cancellationToken));
                await(s.FlushAsync(cancellationToken));
            }
            using (var s = OpenSession())
            {
                basic = await(s.GetAsync <DateClass>(savedId, cancellationToken));
                Assert.That(basic.DateValue, Is.EqualTo(expected));
                await(s.DeleteAsync(basic, cancellationToken));
                await(s.FlushAsync(cancellationToken));
            }
        }
Ejemplo n.º 6
0
        public void ReadWriteNormal()
        {
            var expected = DateTime.Today.Date;

            var basic = new DateClass {
                DateValue = expected.AddHours(1)
            };
            object savedId;

            using (ISession s = OpenSession())
            {
                savedId = s.Save(basic);
                s.Flush();
            }
            using (ISession s = OpenSession())
            {
                basic = s.Get <DateClass>(savedId);
                Assert.That(basic.DateValue, Is.EqualTo(expected));
                s.Delete(basic);
                s.Flush();
            }
        }