Пример #1
0
        private static string DescriptionOf(ISelfDescribing selfDescribing)
        {
            TextWriter writer = new DescriptionWriter();

            selfDescribing.DescribeTo(writer);
            return(writer.ToString());
        }
Пример #2
0
        private static void WriteExpected(ISelfDescribing matcher, TextWriter writer)
        {
            writer.Write(TextMessageWriter.Pfx_Expected);
            var description = new StringDescription();

            matcher.DescribeTo(description);
            writer.Write(description.ToString());
            writer.WriteLine();
        }
Пример #3
0
        public static void ShouldHaveDescription(this ISelfDescribing matcher, string expected)
        {
            var description = new StringDescription();

            matcher.DescribeTo(description);
            var actual = description.ToString();

            Xunit.Assert.Equal(expected, actual);
        }
Пример #4
0
        public static void ShouldHaveDescription(this ISelfDescribing matcher, IMatcher <string> expectedMatcher)
        {
            var description = new StringDescription();

            matcher.DescribeTo(description);
            var actual = description.ToString();

            Assert.That(actual, expectedMatcher);
        }
Пример #5
0
        /// <summary>
        /// Gets the name of the member to be used as the name for a mock returned an a call to a stub.
        /// </summary>
        /// <param name="invocation">The invocation.</param>
        /// <returns>Name of the mock created as a result value on a call to a stub.</returns>
        private string GetMemberName(ISelfDescribing invocation)
        {
            var writer = new StringWriter();

            invocation.DescribeTo(writer);

            var name = writer.ToString();

            return(name.Replace(Environment.NewLine, string.Empty));
        }
Пример #6
0
 public IDescription AppendDescriptionOf(ISelfDescribing value)
 {
     value.DescribeTo(this);
     return(this);
 }
Пример #7
0
		/// <summary>
		/// Gets the name of the member to be used as the name for a mock returned an a call to a stub.
		/// </summary>
		/// <param name="invocation">The invocation.</param>
		/// <returns>Name of the mock created as a result value on a call to a stub.</returns>
		private string GetMemberName(ISelfDescribing invocation)
		{
			var writer = new StringWriter();
			invocation.DescribeTo(writer);

			var name = writer.ToString();
			return name.Replace(Environment.NewLine, string.Empty);
		}