예제 #1
0
        private void MakeTestRunComplete()
        {
            var pass = TrxLoggerTests.CreatePassTestResultEventArgsMock();

            this.testableTrxLogger.TestResultHandler(new object(), pass.Object);
            var testRunCompleteEventArgs = TrxLoggerTests.CreateTestRunCompleteEventArgs();

            this.testableTrxLogger.TestRunCompleteHandler(new object(), testRunCompleteEventArgs);
        }
예제 #2
0
        private void ValidateTestIdAndNameInTrx(bool isMstestAdapter)
        {
            ObjectModel.TestCase testCase = CreateTestCase("TestCase");
            testCase.ExecutorUri = isMstestAdapter ? new Uri("some://mstestadapteruri") : new Uri("some://uri");

            ObjectModel.TestResult result = new ObjectModel.TestResult(testCase);
            result.SetPropertyValue <Guid>(TrxLoggerConstants.ExecutionIdProperty, Guid.NewGuid());
            if (isMstestAdapter)
            {
                result.DisplayName = "testDisplayName";
            }

            Mock <TestResultEventArgs> resultEventArg = new Mock <TestResultEventArgs>(result);

            this.testableTrxLogger.TestResultHandler(new object(), resultEventArg.Object);
            var testRunCompleteEventArgs = TrxLoggerTests.CreateTestRunCompleteEventArgs();

            this.testableTrxLogger.TestRunCompleteHandler(new object(), testRunCompleteEventArgs);

            this.ValidateResultAttributesInTrx(this.testableTrxLogger.trxFile, testCase.Id, testCase.DisplayName, isMstestAdapter);
        }
예제 #3
0
        public void CRLFCharactersShouldGetRetainedInTrx()
        {
            // To create default trx file, If LogFileName parameter not passed
            this.parameters.Remove(TrxLoggerConstants.LogFileNameKey);
            this.testableTrxLogger.Initialize(this.events.Object, this.parameters);

            string message = $"one line{ Environment.NewLine }second line\r\nthird line";
            var    pass    = TrxLoggerTests.CreatePassTestResultEventArgsMock("Pass1", new List <TestResultMessage> {
                new TestResultMessage(TestResultMessage.StandardOutCategory, message)
            });

            this.testableTrxLogger.TestResultHandler(new object(), pass.Object);

            var testRunCompleteEventArgs = TrxLoggerTests.CreateTestRunCompleteEventArgs();

            this.testableTrxLogger.TestRunCompleteHandler(new object(), testRunCompleteEventArgs);

            Assert.IsTrue(File.Exists(this.testableTrxLogger.trxFile), string.Format("TRX file: {0}, should have got created.", this.testableTrxLogger.trxFile));

            string actualMessage = GetElementValueFromTrx(this.testableTrxLogger.trxFile, "StdOut");

            Assert.IsNotNull(actualMessage);
            Assert.IsTrue(string.Equals(message, actualMessage), string.Format("StdOut messages do not match. Expected:{0}, Actual:{1}", message, actualMessage));
        }