public void TestChildren() { List <string> code = new List <string>(); List <string> name = new List <string>(); InstitutionClass inst = u.createInstitution("COD", "INST"); for (int i = 0; i < 10; ++i) { string c = "Code" + i; string n = "Name" + i; InstitutionClass k = inst.createChild(c, n); code.Add(c); name.Add(n); Assert.AreEqual(c, k.GetCode()); Assert.AreEqual(n, k.GetName()); } IReadOnlyCollection <InstitutionClass> insts = inst.GetChildren(); Assert.AreEqual(10, insts.Count); foreach (InstitutionClass t in insts) { int idx = code.IndexOf(t.GetCode()); Assert.GreaterOrEqual(idx, 0); code[idx] = "-----"; } }
public void TestInstitutionsCreation() { List <string> code = new List <string>(); List <string> name = new List <string>(); for (int i = 0; i < 10; ++i) { code.Add("INST" + i); name.Add("NAME" + i); InstitutionClass inst = u.createInstitution(code[i], name[i]); Assert.IsNotNull(inst); Assert.AreEqual(inst.GetName(), name[i]); Assert.AreEqual(inst.GetCode(), code[i]); } int c = 0; foreach (InstitutionClass inst in u.getInstitutions()) { int idx = code.IndexOf(inst.GetCode()); Assert.AreEqual(idx >= 0, true); code[idx] = "----"; c = c + 1; } Assert.AreEqual(10, c); }
public void TestInstitutionCreation() { InstitutionClass inst = new InstitutionClass("ABC", "B", u); Assert.AreEqual("ABC", inst.GetCode()); Assert.AreEqual("B", inst.GetName()); Assert.AreEqual(u, inst.GetUniversity()); }
public void TestFirstInstitutionCreation() { InstitutionClass i = u.createInstitution("AVX", "ABC"); Assert.IsNotNull(i); Assert.AreEqual("AVX", i.GetCode()); Assert.AreEqual("ABC", i.GetName()); int c = 0; foreach (InstitutionClass x in u.getInstitutions()) { Assert.AreEqual(x, i); c = c + 1; } Assert.AreEqual(1, c); }