public void IsNullOrEmptyTestCase()
        {
            List<String> list = null;
            Assert.IsTrue( list.IsNullOrEmpty() );

            list = new List<String>();
            Assert.IsTrue( list.IsNullOrEmpty() );

            list.Add( RandomValueEx.GetRandomString() );
            Assert.IsFalse( list.IsNullOrEmpty() );
        }
 public void TestIsNullOrEmptyNotEmpty()
 {
     IEnumerable nullEnumerable = new[] { new object() };
     IEnumerable<object> nullEnumerableT = new List<object> { new object(), new object() };
     Assert.IsFalse(nullEnumerable.IsNullOrEmpty());
     Assert.IsFalse(nullEnumerableT.IsNullOrEmpty());
 }
 public void TestIsNullOrEmptyEmpty()
 {
     IEnumerable nullEnumerable = new object[] { };
     IEnumerable<object> nullEnumerableT = new List<object>();
     Assert.IsTrue(nullEnumerable.IsNullOrEmpty());
     Assert.IsTrue(nullEnumerableT.IsNullOrEmpty());
 }
Пример #4
0
        public void IsNullOrEmptyTest()
        {
            var data = new List<String>() { "A", "B", "C", "D", "E" };
              var emptyData = new List<String>();

              Assert.IsFalse(data.IsNullOrEmpty());
              Assert.IsTrue(emptyData.IsNullOrEmpty());
              Assert.IsTrue(((IEnumerable<String>) null).IsNullOrEmpty());
        }
        public void IsNullOrEmpty()
        {
            IEnumerable<int> nullList = null;
            IEnumerable<int> emptyList = new List<int>();
            IEnumerable<int> nonEmptyList = MakeList(1, 2);

            Assert.That(nullList.IsNullOrEmpty(), Is.True);
            Assert.That(emptyList.IsNullOrEmpty(), Is.True);
            Assert.That(nonEmptyList.IsNullOrEmpty(), Is.False);
        }
Пример #6
0
        public void Should_Return_False_If_Collection_Has_Multiple_Elements()
        {
            // arrange - create strong typed collection, with multiple items
            var collection = new List<string>() { "a", "b", "c" };

            // act
            var target = collection.IsNullOrEmpty();

            // assert
            target.Should().BeFalse();
        }
Пример #7
0
        public void Should_Return_True_If_Collection_IsEmpty()
        {
            // arrange - create empty collection
            var collection = new List<string>();

            // act
            var target = collection.IsNullOrEmpty();

            // assert
            target.Should().BeTrue();
        }
Пример #8
0
        public void TestNullOrEmpty()
        {
            // Arrange.
            var sequence = new List<int> { 1, 2, 3 };
            var emptySequence = new List<int>();
            List<int> nullSequence = null;

            // Assert.
            Assert.IsFalse(sequence.IsNullOrEmpty());

            Assert.IsTrue(emptySequence.IsNullOrEmpty());
            Assert.IsTrue(nullSequence.IsNullOrEmpty());
        }
        public void IsNullOrEmpty_TreatsValueAsACollectionIfIsEnumerable()
        {
            object nullList = null;
            object emptyList = new List<int>();
            object nonEmptyList = MakeList(1, 2, 3);

            Assert.That(nullList.IsNullOrEmpty(), Is.True);
            Assert.That(emptyList.IsNullOrEmpty(), Is.True);
            Assert.That(nonEmptyList.IsNullOrEmpty(), Is.False);
        }
Пример #10
0
        public void IsNullOrEmptyCollectionTest()
        {
            ICollection<int> col = null;
            Assert.IsTrue(col.IsNullOrEmpty());

            col = new List<int>();
            Assert.IsTrue(col.IsNullOrEmpty());

            col = new List<int>() { 42 };
            Assert.IsFalse(col.IsNullOrEmpty());
        }
 public void TestIsNullOrEmpty1()
 {
     List<int> l1 = new List<int>
     {
         1,
         2,
         3,
         4
     };
     Assert.IsFalse(l1.IsNullOrEmpty());
 }
Пример #12
0
 public void IsNullOrEmpty()
 {
     List<Int32> test1 = new List<int>(3) { 0, 5, 0 };
     Assert.AreEqual(false, test1.IsNullOrEmpty());
     test1.RemoveAt(2);
     Assert.AreEqual(false, test1.IsNullOrEmpty());
     test1.Clear();
     Assert.AreEqual(true, test1.IsNullOrEmpty());
     test1 = null;
     Assert.AreEqual(true, test1.IsNullOrEmpty());
 }
 public void TestIsNullOrEmpty2()
 {
     List<int> l1 = new List<int>();
     Assert.IsTrue(l1.IsNullOrEmpty());
 }
        public void IsNullOrEmpty_ShouldReturnTrueForEmptyCollection()
        {
            IEnumerable<string> collection = new List<string>();

            Assert.That(collection.IsNullOrEmpty(), Is.True);
        }
Пример #15
0
        public void IsNullOrEmpty_List_Test_Empty()
        {
            List<int> intList = new List<int>();
            bool expected = true;
            bool actual = intList.IsNullOrEmpty();

            Assert.AreEqual(expected, actual);
        }
 public void then_empty_list_is_null_or_empty()
 {
     var list = new List<int>();
     Assert.IsTrue(list.IsNullOrEmpty());
 }
 public void then_populated_list_is_null_or_empty()
 {
     var list = new List<int>{1};
     Assert.IsFalse(list.IsNullOrEmpty());
 }