Пример #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
        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));
        }