??????????????Generics Unit Test??
???????????? ???????[ 2013/7/22 14:04:06 ] ????????
??????????????????[Visual Studio] ????Visual Studio 2012?????????????????????Unit Test????
???????????????????????????????????????????????????е???????????????????????????http://msdn.microsoft.com/en-us/library/vstudio/ms243401.aspx?????????????????????????????????????Microsoft.VisualStudio.TestTools.UnitTesting????????“GenericParameterHelper”?????????дUnit Test????
??????????·?????????????demo??????????????
public static bool IsCollectionEmpty<T>(ICollection<T> collection)
{
return collection == null || collection.Count < 1;
}
???????????
/// <summary>
///IsCollectionEmpty ?????
///</summary>
public void IsCollectionEmptyTestHelper<T>()
{
//????????????????????????null??????????
ICollection<T> collection = new T[]{default(T)}; // TODO: ????????????
bool expected = false; // TODO: ????????????
bool actual;
actual = UtilityCheckData.IsCollectionEmpty<T>(collection);
Assert.AreEqual(expected?? actual);
collection = new T[] { };
Assert.AreEqual(true?? UtilityCheckData.IsCollectionEmpty<T>(collection));
Assert.AreEqual(true?? UtilityCheckData.IsCollectionEmpty<T>(null));
}
[TestMethod()]
public void IsCollectionEmptyTest()
{
IsCollectionEmptyTestHelper<GenericParameterHelper>();
}
??????????????????????????????????μ?????????????????????????GenericParameterHelper?????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11