private void ToStringContainsMessagesCollection()
        {
            var errorMessages = new ErrorMessage[] { new ErrorMessage("key1", "message1"), new ErrorMessage("key2", "message2") };
            var error = new Error("id", errorMessages);

            Assert.Contains("message1", error.ToString());
            Assert.Contains("message2", error.ToString());
        }
        private void ErrorMessageIsAddedToCollection()
        {
            var error = new Error("id");
            var errorMessage = new ErrorMessage("aKey", "aMessage");

            error.AddErrorMessage(errorMessage);

            Assert.Contains(errorMessage, error.Messages);
        }
        private void ErrorMessageIsSet()
        {
            var errorMessage1 = new ErrorMessage("key1", "message1");

            var error = new Error("id", errorMessage1);

            Assert.Equal(1, error.Messages.Count());
            Assert.Contains(errorMessage1, error.Messages);
        }
        private void NullErrorMessagesInCollectionAreNotAddedToMessagesCollection()
        {
            var errorMessage1 = new ErrorMessage("key", "message");
            var errorMessages = new ErrorMessage[] { errorMessage1, null };

            var error = new Error("id");
            error.AddErrorMessages(errorMessages);

            Assert.Equal(1, error.Messages.Count());
            Assert.Contains(errorMessage1, error.Messages);
        }
        private void ErrorMessagesIsSet()
        {
            var errorMessage1 = new ErrorMessage("key1", "message1");
            var errorMessage2 = new ErrorMessage("key2", "message2");
            var errorMessages = new ErrorMessage[] { errorMessage1, errorMessage2 };

            var error = new Error("id", errorMessages: errorMessages);

            Assert.Equal(2, error.Messages.Count());
            Assert.Contains(errorMessage1, error.Messages);
            Assert.Contains(errorMessage2, error.Messages);
        }
        private void ErrorMessageCollectionIsAddedToMessagesCollection()
        {
            var errorMessage1 = new ErrorMessage("key1", "message1");
            var errorMessage2 = new ErrorMessage("key2", "message2");
            var errorMessages = new ErrorMessage[] { errorMessage1, errorMessage2 };

            var error = new Error("id");
            error.AddErrorMessages(errorMessages);

            Assert.Equal(2, error.Messages.Count());
            Assert.Contains(errorMessage1, error.Messages);
            Assert.Contains(errorMessage2, error.Messages);
        }
Пример #7
0
        bool OnClass(XmlNode xml)
        {
            SendTestCaseMessagesWhenAppropriate(null);

            bool @continue = true;
            XmlNode failureNode;
            if ((failureNode = xml.SelectSingleNode("failure")) != null)
            {
                var failureInformation = Xunit1ExceptionUtility.ConvertToFailureInformation(failureNode);

                var errorMessage = new ErrorMessage(failureInformation.ExceptionTypes,
                    failureInformation.Messages, failureInformation.StackTraces,
                    failureInformation.ExceptionParentIndices);
                @continue = messageSink.OnMessage(errorMessage);
            }

            TestClassResults.Time = Decimal.Parse(xml.Attributes["time"].Value, CultureInfo.InvariantCulture);
            TestClassResults.Total = Int32.Parse(xml.Attributes["total"].Value, CultureInfo.InvariantCulture);
            TestClassResults.Failed = Int32.Parse(xml.Attributes["failed"].Value, CultureInfo.InvariantCulture);
            TestClassResults.Skipped = Int32.Parse(xml.Attributes["skipped"].Value, CultureInfo.InvariantCulture);
            return @continue && TestClassResults.Continue;
        }
 private void KeyIsSet()
 {
     var errorMessage = new ErrorMessage("key", "message");
     Assert.Equal("key", errorMessage.Key);
 }
 private void MessageNullSetsToNullString()
 {
     var errorMessage = new ErrorMessage("key", null);
     Assert.Equal(Defaults.ErrorMessage.NullString, errorMessage.Message);
 }
 private void MessageIsSet()
 {
     var errorMessage = new ErrorMessage("key", "message");
     Assert.Equal("message", errorMessage.Message);
 }
 private void ToStringContainsClassName()
 {
     var errorMessage = new ErrorMessage("aKey", "aMessage");
     Assert.Contains("ErrorMessage", errorMessage.ToString());
 }
 private void ToStringContainsKey()
 {
     var errorMessage = new ErrorMessage("aKey", "aMessage");
     Assert.Contains("Key = aKey", errorMessage.ToString());
 }