本文整理汇总了C#中Microsoft.VisualStudio.TestTools.UnitTesting.List.IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# List.IsEmpty方法的具体用法?C# List.IsEmpty怎么用?C# List.IsEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.VisualStudio.TestTools.UnitTesting.List
的用法示例。
在下文中一共展示了List.IsEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsEmptyTest_IEnumerable
public void IsEmptyTest_IEnumerable()
{
List<int> source = new List<int>();
Assert.IsTrue(source.IsEmpty());
source.Add(1);
Assert.IsFalse(source.IsEmpty());
}
示例2: IsEmpty
public void IsEmpty()
{
// Type
var @this = new List<string>();
// Examples
bool value1 = @this.IsEmpty(); // return true;
@this.Add("Fizz");
bool value2 = @this.IsEmpty(); // return false;
// Unit Test
Assert.IsTrue(value1);
Assert.IsFalse(value2);
}
示例3: DeleteTest
public void DeleteTest()
{
List<string> list = new List<string>();
list.InsertToEnd("1");
list.RemoveElement("1");
Assert.IsTrue(list.IsEmpty());
}
示例4: TestFilter2
public void TestFilter2()
{
Func<int, bool> somethingCheck = x => (x % 3) == 0;
list.InsertToEnd(3);
list = newFunctionClass.Filter(list, somethingCheck);
Assert.IsFalse(list.IsEmpty());
}
示例5: TestIsEmpty
public void TestIsEmpty()
{
var foo = new List<double>();
Assert.IsTrue(foo.IsEmpty());
var bar = "";
Assert.IsTrue(bar.IsEmpty());
bar = null;
Assert.IsTrue(bar.IsEmpty());
}
示例6: IsEmpty
public void IsEmpty()
{
// Type
IEnumerable<string> @thisEmpty = new List<string>().AsEnumerable();
IEnumerable<string> @thisNotEmpty = new List<string> {"Fizz"}.AsEnumerable();
// Exemples
bool result2 = @thisEmpty.IsEmpty(); // return true;
bool result3 = @thisNotEmpty.IsEmpty(); // return false;
// Unit Test
Assert.IsTrue(result2);
Assert.IsFalse(result3);
}
示例7: IsEmpty_Empty_Test
public void IsEmpty_Empty_Test()
{
IList<object> self = new List<object>(); // TODO: Initialize to an appropriate value
bool expected = true; // TODO: Initialize to an appropriate value
bool actual;
actual = self.IsEmpty();
Assert.AreEqual(expected, actual);
}
示例8: TestIsEmpty2
public void TestIsEmpty2()
{
List<int> l1 = new List<int>();
Assert.IsTrue(l1.IsEmpty());
}
示例9: TestIsEmpty1
public void TestIsEmpty1()
{
List<int> l1 = new List<int>
{
1,
2,
3,
4
};
Assert.IsFalse(l1.IsEmpty());
}
示例10: IsEmptyReturnsFalseIfTheSequenceContains3Elements
public void IsEmptyReturnsFalseIfTheSequenceContains3Elements()
{
var listWith3Elements = new List<int> {1, 2, 3};
Assert.IsFalse(listWith3Elements.IsEmpty());
}
示例11: IsEmptyReturnsFalseIfTheSequenceContains1Element
public void IsEmptyReturnsFalseIfTheSequenceContains1Element()
{
var listWith1Element = new List<int> {3};
Assert.IsFalse(listWith1Element.IsEmpty());
}
示例12: IsEmptyReturnTrueIfTheSequenceIsEmpty
public void IsEmptyReturnTrueIfTheSequenceIsEmpty()
{
// ReSharper disable once CollectionNeverUpdated.Local
var emptyList = new List<int>();
Assert.IsTrue(emptyList.IsEmpty());
}
示例13: IsEmpty
public void IsEmpty()
{
List<int> list = new List<int>();
Assert.IsTrue(list.IsEmpty());
list.Add(5);
Assert.IsFalse(list.IsEmpty());
}
示例14: ShouldDetermineIfEnumerableIsEmpty
public void ShouldDetermineIfEnumerableIsEmpty()
{
((List<Stub>) null).IsEmpty().ShouldBe(true);
var list = new List<Stub> ();
list.IsEmpty().ShouldBe(true);
list.Add(new Stub());
list.IsEmpty().ShouldBe(false);
}
示例15: IsEmpty
public void IsEmpty()
{
IEnumerable<int> emptyEnumerable = Enumerable.Empty<int>();
Assert.IsTrue(emptyEnumerable.IsEmpty());
IEnumerable<int> nonEmptyEnumerable = new List<int>() { 1 };
Assert.IsFalse(nonEmptyEnumerable.IsEmpty());
}