1: using Microsoft.VisualStudio.TestTools.UnitTesting;
2:
3: namespace ElBruno.DemoUnitTesting
4: {
5: [TestClass]
6: public class Class1Test
7: {
8: public TestContext TestContext { get; set; }
9:
10: [TestMethod]
11: public void ComparaElementosEnDosColecciones()
12: {
13: var col1 = new System.Collections.Generic.List<string>() { "a", "b", "c" };
14: var col2 = new System.Collections.Generic.List<string>() { "a", "b", "c" };
15: CollectionAssert.AreEqual(col1, col2);
16: }
17:
18: [TestMethod]
19: public void VerificaLosTiposDeLosElementos()
20: {
21: var col1 = new System.Collections.Generic.List<int> { 1, 2, 3 };
22: CollectionAssert.AllItemsAreInstancesOfType(col1, typeof(int));
23: }
24:
25: [TestMethod]
26: public void VerificaQueNoSeRepitanElementos()
27: {
28: var col1 = new System.Collections.Generic.List<int> { 1, 2, 3, 4 };
29: CollectionAssert.AllItemsAreUnique(col1);
30: }
31:
32: [TestMethod]
33: public void VerificaQueUnaColeccionEsSubSetDeOtra()
34: {
35: var col1 = new System.Collections.Generic.List<string>() { "a", "b", "c" };
36: var col2 = new System.Collections.Generic.List<string>() { "b", "c" };
37: CollectionAssert.IsSubsetOf(col2, col1);
38: }
39: }
40: }