示例#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);
		}