Example #1
0
        public void empty_sequence_returned_for_null()
        {
            HasProperties item = null;

            Assert.IsNotNull(item.AsSeq());
            Assert.AreEqual(0, item.AsSeq().Count());
        }
Example #2
0
        public void sequence_returned_for_object()
        {
            HasProperties item = new HasProperties();

            Assert.IsNotNull(item.AsSeq());
            Assert.AreNotEqual(0, item.AsSeq().Count());
        }
Example #3
0
        public void sequence_contains_value_of_nullable_struct(long value)
        {
            HasProperties item = new HasProperties {
                OptLong = value
            };
            var pair = item.AsSeq().FirstOrDefault(p => p.Key == nameof(HasProperties.OptLong));

            Assert.AreEqual(value, pair.Value);
        }
Example #4
0
        public void sequence_contains_value_of_class(string value)
        {
            HasProperties item = new HasProperties {
                Text = value
            };
            var pair = item.AsSeq().FirstOrDefault(p => p.Key == nameof(HasProperties.Text));

            Assert.AreEqual(value, pair.Value);
        }
Example #5
0
        public void sequence_contains_value_of_struct(int value)
        {
            HasProperties item = new HasProperties {
                Int1 = value
            };
            var pair = item.AsSeq().First(p => p.Key == nameof(HasProperties.Int1));

            Assert.AreEqual(value, pair.Value);
        }
Example #6
0
        public void sequence_does_not_contain_value_of_nullable_struct()
        {
            HasProperties item = new HasProperties();

            Assert.IsFalse(item.AsSeq().Contains(p => p.Key == nameof(HasProperties.OptLong)));
        }
Example #7
0
        public void sequence_does_not_contain_value_of_null_class()
        {
            HasProperties item = new HasProperties();

            Assert.IsFalse(item.AsSeq().Contains(p => p.Key == nameof(HasProperties.Text)));
        }
Example #8
0
        public void sequence_contains_pair_for_default_value_of_int()
        {
            HasProperties item = new HasProperties();

            Assert.IsTrue(item.AsSeq().Contains(p => p.Key == nameof(HasProperties.Int1)));
        }