Ejemplo n.º 1
0
        public void Null_collections_should_return_false()
        {
            var post = new BlogPost();

            post.Tags = null;
            Assert.False(DefaultValueChecker.HasValue(post, typeof(BlogPost).GetProperties().First(x => x.Name == nameof(BlogPost.Tags))));
        }
Ejemplo n.º 2
0
        public void Non_empty_collections_should_return_true()
        {
            var post = new BlogPost();

            post.Tags.Add("Azure");
            Assert.True(DefaultValueChecker.HasValue(post, typeof(BlogPost).GetProperties().First(x => x.Name == nameof(BlogPost.Tags))));
        }
Ejemplo n.º 3
0
        public void Default_datetime_should_return_false()
        {
            var post = new BlogPost {
            };

            Assert.False(DefaultValueChecker.HasValue(post, typeof(BlogPost).GetRuntimeProperties().First(x => x.Name == nameof(BlogPost.CreateDate))));
        }
Ejemplo n.º 4
0
        public void Default_string_should_return_false()
        {
            var post = new BlogPost {
            };

            Assert.False(DefaultValueChecker.HasValue(post, typeof(BlogPost).GetProperties().First(x => x.Name == nameof(BlogPost.Title))));
        }
Ejemplo n.º 5
0
        public void Filled_int_should_return_true()
        {
            var post = new BlogPost {
                BlogPostId = 12
            };

            Assert.True(DefaultValueChecker.HasValue(post, typeof(BlogPost).GetProperties().First(x => x.Name == nameof(BlogPost.BlogPostId))));
        }
Ejemplo n.º 6
0
        public void Filled_ulong_should_return_true()
        {
            var post = new Person {
                HeightInCentiMeters = 12
            };

            Assert.True(DefaultValueChecker.HasValue(post, typeof(Person).GetProperties().First(x => x.Name == nameof(Person.HeightInCentiMeters))));
        }
Ejemplo n.º 7
0
        public void Filled_int16_should_return_true()
        {
            var post = new Person {
                NumberOfToes = 12
            };

            Assert.True(DefaultValueChecker.HasValue(post, typeof(Person).GetProperties().First(x => x.Name == nameof(Person.NumberOfToes))));
        }
Ejemplo n.º 8
0
        public void Filled_enum_should_return_true()
        {
            var post = new BlogPost {
                Type = BlogTypeEnum.Post
            };

            Assert.True(DefaultValueChecker.HasValue(post, typeof(BlogPost).GetProperties().First(x => x.Name == nameof(BlogPost.Type))));
        }
Ejemplo n.º 9
0
        public void Filled_datetime_should_return_true()
        {
            var post = new BlogPost {
                CreateDate = DateTime.Now
            };

            Assert.True(DefaultValueChecker.HasValue(post, typeof(BlogPost).GetProperties().First(x => x.Name == nameof(BlogPost.CreateDate))));
        }
Ejemplo n.º 10
0
        public void Filled_string_should_return_true()
        {
            var post = new BlogPost {
                Title = "Bob"
            };

            Assert.True(DefaultValueChecker.HasValue(post, typeof(BlogPost).GetProperties().First(x => x.Name == nameof(BlogPost.Title))));
        }
        public void Filled_decimal_should_return_true()
        {
            var post = new Person {
                HeightInMetres = 12
            };

            Assert.True(DefaultValueChecker.HasValue(post, typeof(Person).GetProperties().First(x => x.Name == "HeightInMetres")));
        }
Ejemplo n.º 12
0
        public void Default_ulong_should_return_false()
        {
            var post = new Person();

            Assert.False(DefaultValueChecker.HasValue(post, typeof(Person).GetProperties().First(x => x.Name == nameof(Person.HeightInCentiMeters))));
        }
Ejemplo n.º 13
0
        public void Default_int16_should_return_false()
        {
            var post = new Person();

            Assert.False(DefaultValueChecker.HasValue(post, typeof(Person).GetProperties().First(x => x.Name == nameof(Person.NumberOfToes))));
        }
Ejemplo n.º 14
0
        public void Empty_enum_should_return_false()
        {
            var post = new BlogPost();

            Assert.False(DefaultValueChecker.HasValue(post, typeof(BlogPost).GetProperties().First(x => x.Name == nameof(BlogPost.Type))));
        }
        public void Default_decimal_should_return_false()
        {
            var post = new Person();

            Assert.False(DefaultValueChecker.HasValue(post, typeof(Person).GetProperties().First(x => x.Name == "HeightInMetres")));
        }
        public void Default_int_should_return_false()
        {
            var post = new BlogPost();

            Assert.False(DefaultValueChecker.HasValue(post, typeof(BlogPost).GetProperties().First(x => x.Name == "BlogPostId")));
        }