public void SecondOrDefault_should_return_default_value_with_empty_collection()
        {
            var emptyValueTypeCollection = new List <int>();
            var emptyRefTypeCollection   = new List <FakeClass>();

            var actualValue   = 0;
            var expectedValue = emptyValueTypeCollection.SecondOrDefault();

            FakeClass actualRef   = null;
            var       expectedRef = emptyRefTypeCollection.SecondOrDefault();

            Assert.AreEqual(actualValue, expectedValue);
            Assert.AreEqual(actualRef, expectedRef);
        }
        public void FirstOrDefined_should_return_defined_value_with_empty_collection()
        {
            var emptyRefTypeCollection   = new List <FakeClass>();
            var emptyValueTypeCollection = new List <int>();

            var expectedRefType   = new FakeClass(10);
            var expectedValueType = 10;

            var actualRefType   = emptyRefTypeCollection.FirstOrDefined(expectedRefType);
            var actualValueType = emptyValueTypeCollection.FirstOrDefined(expectedValueType);

            Assert.AreEqual(expectedRefType, actualRefType);
            Assert.AreEqual(expectedValueType, actualValueType);
        }
示例#3
0
        public void ArgumentNotNull_shold_rise_ArgumentNullException_while_argument_is_null()
        {
            FakeClass argument = null;

            Guard.ArgumentNotNull(argument, nameof(argument));
        }