Exemplo n.º 1
0
        public void DecimalTest()
        {
            using (var container = new RhetosTestContainer())
            {
                container.Resolve <ISqlExecuter>().ExecuteSql("DELETE FROM TestTypes.Simple");
                var repository = container.Resolve <Common.DomRepository>();

                // Decimal(28,10) allows 18 digits before the decimal point and 10 digits after.
                var s = new TestTypes.Simple {
                    Length = 123456789012345678.0123456789m
                };
                Assert.AreEqual("123456789012345678.0123456789", s.Length.Value.ToString(System.Globalization.CultureInfo.InvariantCulture));
                repository.TestTypes.Simple.Insert(s);

                var loaded = repository.TestTypes.Reader.Load().Single();
                Assert.AreEqual(s.Length, loaded.Length);
            }
        }
Exemplo n.º 2
0
        public void DateTimeTest()
        {
            using (var container = new RhetosTestContainer())
            {
                container.Resolve <ISqlExecuter>().ExecuteSql("DELETE FROM TestTypes.Simple");
                var repository = container.Resolve <Common.DomRepository>();

                for (int i = 0; i < 7; i++)
                {
                    DateTime testTime = new DateTime(2013, 10, 27, 10, 45, 54, i * 1000 / 7);

                    var item = new TestTypes.Simple {
                        Start = testTime
                    };
                    repository.TestTypes.Simple.Insert(item);

                    var loaded = repository.TestTypes.Reader.Load().Single();
                    AssertIsNear(testTime, loaded.Start.Value);

                    repository.TestTypes.Simple.Delete(item);
                }
            }
        }
Exemplo n.º 3
0
        public void DecimalSizeTest()
        {
            using (var container = new RhetosTestContainer())
            {
                container.Resolve<ISqlExecuter>().ExecuteSql(new[] { "DELETE FROM TestTypes.Simple" });
                var repository = container.Resolve<Common.DomRepository>();

                var s = new TestTypes.Simple { Length = 1234567890123456789012345678m };
                Assert.AreEqual("1234567890123456789012345678", s.Length.Value.ToString());
                Assert.Inconclusive("NHibernate's limit");
                repository.TestTypes.Simple.Insert(new[] { s });

                var loaded = repository.TestTypes.Reader.All().Single();
                Assert.AreEqual(s.Length, loaded.Length);
            }
        }
Exemplo n.º 4
0
        public void DateTimeTest()
        {
            using (var container = new RhetosTestContainer())
            {
                container.Resolve<ISqlExecuter>().ExecuteSql(new[] { "DELETE FROM TestTypes.Simple" });
                var repository = container.Resolve<Common.DomRepository>();

                for (int i = 0; i < 7; i++)
                {
                    DateTime testTime = new DateTime(2013, 10, 27, 10, 45, 54, i * 1000 / 7);

                    var item = new TestTypes.Simple { Start = testTime };
                    repository.TestTypes.Simple.Insert(new[] { item });

                    var loaded = repository.TestTypes.Reader.All().Single();
                    AssertIsNear(testTime, loaded.Start.Value);

                    repository.TestTypes.Simple.Delete(new[] { item });
                }
            }
        }
Exemplo n.º 5
0
        public void DecimalPrecisionTest()
        {
            using (var container = new RhetosTestContainer())
            {
                container.Resolve<ISqlExecuter>().ExecuteSql(new[] { "DELETE FROM TestTypes.Simple" });
                var repository = container.Resolve<Common.DomRepository>();

                var s = new TestTypes.Simple { Length = 0.0123456789m };
                Assert.AreEqual("0.0123456789", s.Length.Value.ToString("F10", System.Globalization.CultureInfo.InvariantCulture));
                repository.TestTypes.Simple.Insert(new[] { s });

                var loaded = repository.TestTypes.Reader.All().Single();
                Assert.AreEqual(s.Length, loaded.Length);
            }
        }
Exemplo n.º 6
0
        public void DecimalTest()
        {
            using (var container = new RhetosTestContainer())
            {
                container.Resolve<ISqlExecuter>().ExecuteSql(new[] { "DELETE FROM TestTypes.Simple" });
                var repository = container.Resolve<Common.DomRepository>();

                // Decimal(28,10) allows 18 digits before the decimal point and 10 digits after.
                var s = new TestTypes.Simple { Length = 123456789012345678.0123456789m };
                Assert.AreEqual("123456789012345678.0123456789", s.Length.Value.ToString(System.Globalization.CultureInfo.InvariantCulture));
                repository.TestTypes.Simple.Insert(new[] { s });

                var loaded = repository.TestTypes.Reader.Load().Single();
                Assert.AreEqual(s.Length, loaded.Length);
            }
        }
Exemplo n.º 7
0
        public void DateTimeTest()
        {
            using (var executionContext = new CommonTestExecutionContext())
            {
                executionContext.SqlExecuter.ExecuteSql(new[] { "DELETE FROM TestTypes.Simple" });
                var repository = new Common.DomRepository(executionContext);

                for (int i = 0; i < 7; i++)
                {
                    DateTime testTime = new DateTime(2013, 10, 27, 10, 45, 54, i * 1000 / 7);

                    var item = new TestTypes.Simple { Start = testTime };
                    repository.TestTypes.Simple.Insert(new[] { item });

                    var loaded = repository.TestTypes.Reader.All().Single();
                    AssertIsNear(testTime, loaded.Start.Value);

                    repository.TestTypes.Simple.Delete(new[] { item });
                }
            }
        }
Exemplo n.º 8
0
        public void DecimalSizeTest()
        {
            using (var executionContext = new CommonTestExecutionContext())
            {
                executionContext.SqlExecuter.ExecuteSql(new[] { "DELETE FROM TestTypes.Simple" });
                var repository = new Common.DomRepository(executionContext);

                var s = new TestTypes.Simple { Length = 1234567890123456789012345678m };
                Assert.AreEqual("1234567890123456789012345678", s.Length.Value.ToString());
                Assert.Inconclusive("NHibernate's limit");
                repository.TestTypes.Simple.Insert(new[] { s });

                var loaded = repository.TestTypes.Reader.All().Single();
                Assert.AreEqual(s.Length, loaded.Length);
            }
        }
Exemplo n.º 9
0
        public void DecimalPrecisionTest()
        {
            using (var executionContext = new CommonTestExecutionContext())
            {
                executionContext.SqlExecuter.ExecuteSql(new[] { "DELETE FROM TestTypes.Simple" });
                var repository = new Common.DomRepository(executionContext);

                var s = new TestTypes.Simple { Length = 0.0123456789m };
                Assert.AreEqual("0.0123456789", s.Length.Value.ToString("F10", System.Globalization.CultureInfo.InvariantCulture));
                repository.TestTypes.Simple.Insert(new[] { s });

                var loaded = repository.TestTypes.Reader.All().Single();
                Assert.AreEqual(s.Length, loaded.Length);
            }
        }