public void GetContainerTest() { GetPapersClass target = new GetPapersClass(); // TODO: Initialize to an appropriate value string activeDir = Path.GetPathRoot(Directory.GetCurrentDirectory()); string aGUID = "adeac8b2-89eb-40e4-b44a-85927a3a1f20"; // TODO: Initialize to an appropriate value string Course_ID = "3"; // TODO: Initialize to an appropriate value string expected = "C:\\FileRepository\\3\\adeac8b2-89eb-40e4-b44a-85927a3a1f20"; // TODO: Initialize to an appropriate value string actual; actual = target.GetContainer(aGUID, Course_ID); //Assert.AreEqual(expected, actual); if(StringAssert.Equals(expected, actual) == true){} if (StringAssert.Equals(expected, actual) == false) { Assert.Fail("Check GetContainerTest Code"); } }
public void ToDataSetImage1Test() { string aGUID = "adeac8b2-89eb-40e4-b44a-85927a3a1f20"; string Course_ID = "3"; GetPapersClass gpc = new GetPapersClass(); //Create new instance GetPapersClass target = new GetPapersClass(); // TODO: Initialize to an appropriate value LinkedList<Paper> list = (gpc.pathToPapers(gpc.GetContainer(aGUID, Course_ID), aGUID));// TODO: Initialize to an appropriate value DataSet expected = gpc.ToDataSet1(gpc.pathToPapers(gpc.GetContainer(aGUID, Course_ID), aGUID)); // TODO: Initialize to an appropriate value DataSet actual; actual = target.ToDataSetImage1(list); //Assert.AreEqual(expected, actual); Assert.AreEqual(expected.Tables.Contains("txtFileName"), actual.Tables.Contains("txtFileName")); // Checks if txtFileName is a table name //Loops through all Columns and values in Rows and compairs values for (int i = 0; i < expected.Tables.Count; i++) for (int j = 0; j < expected.Tables[i].Rows.Count; j++) { Assert.AreEqual(expected.Tables[i].Rows[j].ToString(), actual.Tables[i].Rows[j].ToString()); } }
public void pathToPapersTest() { string aGUID = "adeac8b2-89eb-40e4-b44a-85927a3a1f20"; string Course_ID = "3"; GetPapersClass gpc = new GetPapersClass(); //Create new instance GetPapersClass target = new GetPapersClass(); // TODO: Initialize to an appropriate value string path = gpc.GetContainer(aGUID, Course_ID); // TODO: Initialize to an appropriate value LinkedList<Paper> expected = (gpc.pathToPapers(gpc.GetContainer(aGUID, Course_ID), aGUID)); // TODO: Initialize to an appropriate value LinkedList<Paper> actual; actual = target.pathToPapers(path, aGUID); LinkedListNode<Paper> p = expected.First; LinkedListNode<Paper> r = actual.First; //Iterates through Papers and compairs values while(p.Next != null) { StringAssert.Equals(p.Value.AID.ToString(), r.Value.AID.ToString()); StringAssert.Equals(p.Value.FileName.ToString(), r.Value.FileName.ToString()); StringAssert.Equals(p.Value.Link.ToString(), r.Value.Link.ToString()); StringAssert.Equals(p.Value.UserID.ToString(), r.Value.UserID.ToString()); //*************************************************** //***************************************************** p = p.Next; r = r.Next; } // Assert.AreEqual(expected, actual); }