Exemplo n.º 1
0
        public void CoreTestNullableTypes()
        {
            var source = ClassWithNullableTypes.Create();

            Run(source, x => new DTO.ClassWithNullableTypes(x));

            var DTO = new DTO.ClassWithNullableTypes()
            {
                Int1 = 5
            };
            var manual = new DTO.ClassWithNullableTypes(source);

            Mapper.Fill(source, DTO);
            Assert.Equal(DTO, manual);
        }
Exemplo n.º 2
0
        public void It_should_store_object_with_all_nullable_fields_set_to_null()
        {
            var classWithNullableTypes = new ClassWithNullableTypes();
            OdbFactory.Delete("nullable1.ndb");

            using (var odb = OdbFactory.Open("nullable1.ndb"))
            {
                odb.Store(classWithNullableTypes);
            }

            using (var odb = OdbFactory.OpenLast())
            {
                var query = odb.Query<ClassWithNullableTypes>();
                var objectToTest = query.Execute<ClassWithNullableTypes>().GetFirst();

                Assert.That((object) objectToTest.Size, Is.Null);
                Assert.That((object) objectToTest.Price, Is.Null);
                Assert.That((object) objectToTest.Measure, Is.Null);
            }
        }
Exemplo n.º 3
0
        public void It_should_store_object_with_all_nullable_fields_with_values()
        {
            var classWithNullableTypes = new ClassWithNullableTypes {Size = 33, Measure = 2, Price = 33.33m};
            OdbFactory.Delete("nullable2.ndb");

            using (var odb = OdbFactory.Open("nullable2.ndb"))
            {
                odb.Store(classWithNullableTypes);
            }

            using (var odb = OdbFactory.OpenLast())
            {
                var query = odb.Query<ClassWithNullableTypes>();
                var objectToTest = query.Execute<ClassWithNullableTypes>().GetFirst();

                Assert.That((object) objectToTest.Size, Is.EqualTo(33));
                Assert.That((object) objectToTest.Price, Is.EqualTo(33.33m));
                Assert.That((object) objectToTest.Measure, Is.EqualTo(2));
            }
        }
        public void It_should_store_object_with_all_nullable_fields_set_to_null()
        {
            var classWithNullableTypes = new ClassWithNullableTypes();

            OdbFactory.Delete("nullable1.ndb");

            using (var odb = OdbFactory.Open("nullable1.ndb"))
            {
                odb.Store(classWithNullableTypes);
            }

            using (var odb = OdbFactory.OpenLast())
            {
                var query        = odb.Query <ClassWithNullableTypes>();
                var objectToTest = query.Execute <ClassWithNullableTypes>().GetFirst();

                Assert.That((object)objectToTest.Size, Is.Null);
                Assert.That((object)objectToTest.Price, Is.Null);
                Assert.That((object)objectToTest.Measure, Is.Null);
            }
        }
        public void It_should_store_object_with_all_nullable_fields_with_values()
        {
            var classWithNullableTypes = new ClassWithNullableTypes {
                Size = 33, Measure = 2, Price = 33.33m
            };

            OdbFactory.Delete("nullable2.ndb");

            using (var odb = OdbFactory.Open("nullable2.ndb"))
            {
                odb.Store(classWithNullableTypes);
            }

            using (var odb = OdbFactory.OpenLast())
            {
                var query        = odb.Query <ClassWithNullableTypes>();
                var objectToTest = query.Execute <ClassWithNullableTypes>().GetFirst();

                Assert.That((object)objectToTest.Size, Is.EqualTo(33));
                Assert.That((object)objectToTest.Price, Is.EqualTo(33.33m));
                Assert.That((object)objectToTest.Measure, Is.EqualTo(2));
            }
        }