コード例 #1
0
        public void LogResultListener()
        {
            LogResultListener log = new LogResultListener {
                FilePath = new MacroString {
                    Text = "logResult.txt"
                }
            };
            var expanded = log.FilePath.Expand();

            // If debugging the LogResultListener will just rename the file since it might exist
            if (System.IO.File.Exists(expanded))
            {
                System.IO.File.Delete(expanded);
            }

            ResourceTest.TestConformance(log);
            var testPlan = TestStepTest.CreateGenericTestPlan();

            testPlan.Steps.Add(new TestStepEmit());
            ResultSettings.Current.Add(log);
            var run = testPlan.Execute();

            var logText = System.IO.File.ReadAllText(expanded, System.Text.Encoding.ASCII);

            StringAssert.Contains("This was called", logText);

            ResultSettings.Current.Remove(log);
        }