public void TestMethod2() { // Arrange string fileName = mTestHelper.GetTestResourcesFile("numbers.txt"); string[] list = System.IO.File.ReadAllLines(fileName); List <int> numbers = new List <int>(); foreach (string line in list) { mTestHelper.Log("line = " + line); numbers.Add(int.Parse(line)); } //Act int total = MyMath.Sum(numbers); //Assert Assert.AreEqual(4, numbers.Count, "numbers count is 4"); Assert.AreEqual(20, total, "total=20"); mTestHelper.CreateTestArtifact("file1.txt", "fffffffffffffffffffff"); mTestHelper.AddTestArtifact(fileName); }
public void AddHTMLReport() { //Arrange string ReportName = "Template #1"; string screenShotFileName = mTestHelper.GetTempFileName("screen1.png"); mGingerAutomator.MainWindowPOM.TakeScreenShot(screenShotFileName); mTestHelper.AddTestArtifact(screenShotFileName); //Act ObservableList <HTMLReportConfiguration> allReports = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <HTMLReportConfiguration>(); HTMLReportConfiguration Report1 = (from x in allReports where x.Name == ReportName select x).SingleOrDefault(); //Assert Assert.AreEqual(Report1.Name, ReportName); }
public void SampleTestArtifactFile() { //Arrange string fileName = mTestHelper.GetTempFileName("numbers.txt"); //Act for (int i = 0; i < 10; i++) { System.IO.File.AppendAllText(fileName, "line " + i + "##"); } //Artifacts mTestHelper.AddTestArtifact(fileName); //Assert long fileSize = new FileInfo(fileName).Length; Assert.AreEqual(80, fileSize, "fileSize"); }