Exemplo n.º 1
0
 public TestResult this[Test test]
 {
     get
     {
         return _results[test.GetPath().Locator];
     }
     set
     {
         _results[test.GetPath().Locator] = value;
     }
 }
Exemplo n.º 2
0
        public static void SaveResult(TestResult result, Test test, string folder)
        {
            result.Locator = test.GetPath().Locator;

            var fileSystem = new FileSystem();
            fileSystem.CreateDirectory(folder);

            var filename = Path.Combine(folder, FileNameFor(test));

            fileSystem.PersistToFile(result, filename);
        }
Exemplo n.º 3
0
        public void AddTest(Test test, string resultsFile)
        {
            _tbody.Add("tr", x =>
            {
                x.AddClass(test.WasSuccessful() ? HtmlClasses.PASS : HtmlClasses.FAIL);

                x.Add("td").Text(test.GetPath().Locator);
                x.Add("td").Text(test.Lifecycle.ToString());
                x.Add("td")
                    .Add("a")
                    .Text(test.GetStatus())
                    .Attr("href", resultsFile);
            });
        }
        public string GenerateMethod(Test test)
        {
            var methodText = _options.MethodTemplate;
            if (methodText.IsEmpty())
            {
                methodText = DefaultMethodTemplate();
            }

            methodText = methodText.Replace(TEST_PATH, test.GetPath().Locator);
            var sanitizedName = test.Name.Replace(" ", "_");

            return methodText.Replace(CLEAN_TEST_NAME, sanitizedName);
        }
Exemplo n.º 5
0
 public static string FileNameFor(Test test)
 {
     string locator = test.GetPath().Locator;
     return FileNameFor(locator);
 }
Exemplo n.º 6
0
        public void get_path_with_parent()
        {
            var suite = new Suite("s1");
            var test = new Test("t1");

            suite.AddTest(test);

            test.GetPath().Locator.ShouldEqual("s1/t1");
        }
Exemplo n.º 7
0
 public void get_path_without_a_parent()
 {
     var test = new Test("t1");
     test.GetPath().Locator.ShouldEqual("t1");
 }