private static string DescriptionOf(ISelfDescribing selfDescribing) { TextWriter writer = new DescriptionWriter(); selfDescribing.DescribeTo(writer); return(writer.ToString()); }
private static string DescriptionOf(ISelfDescribing selfDescribing) { var writer = new StringDescriptionWriter(); selfDescribing.DescribeOn(writer); return writer.ToString(); }
private bool InternalTryMatch(Object actual, IMatcher childMatcher, ISelfDescribing selfDescribing) { //so we can print child diagnostics after var childDiag = new MatchDiagnostics(); var matched = childMatcher.Matches(actual, childDiag); Text(matched ? "Match":"Mismatch!"); var desc = Description.With(); if (selfDescribing != null) { desc.Value(selfDescribing); } if (!matched) { Expect.PrintExpectButGot(desc, actual, childMatcher); desc.Value(childDiag); } else { desc.Value(childMatcher); } Child(desc); return(matched); }
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); }
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(); }
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); }
public static void IsComposed(ISelfDescribing selfDescribing, string format, params ISelfDescribing[] components) { var componentDescriptions = new string[components.Length]; for (int i = 0; i < components.Length; i++) { componentDescriptions[i] = DescriptionOf(components[i]); } IsEqual(selfDescribing, String.Format(format, componentDescriptions)); }
/// <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)); }
public static void IsComposed(ISelfDescribing selfDescribing, string format, params ISelfDescribing[] components) { string[] componentDescriptions = new string[components.Length]; for (int i = 0; i < components.Length; i++) { componentDescriptions[i] = DescriptionOf(components[i]); } IsEqual(selfDescribing, String.Format(format, componentDescriptions)); }
private static MicroModelObject CreateMicroModelObject(ISelfDescribing selfDescribing) { selfDescribing.SealTypeDescription(); var properties = selfDescribing.GetProperties(); var microModelObjectType = MicroModelObjectBuilder.GetMicroModelObjectType(properties); var microModelObject = (MicroModelObject)Activator.CreateInstance(microModelObjectType, selfDescribing); return(microModelObject); }
public static void IsEqual(ISelfDescribing selfDescribing, string expectedDescription) { Assert.AreEqual(expectedDescription, DescriptionOf(selfDescribing), "description"); }
public ModelTypeDescriptor(ISelfDescribing model) { _model = model; }
public IMatchDiagnostics MisMatched(ISelfDescribing selfDescribing) { return(this); }
public bool TryMatch(Object actual, IMatcher childMatcher, ISelfDescribing selfDescribing) { return(InternalTryMatch(actual, childMatcher)); }
public bool TryMatch <T>(T actual, IMatcher <T> childMatcher, ISelfDescribing selfDescribing) { return(InternalTryMatch(actual, childMatcher)); }
/// <summary> /// Return the description of an <see cref="ISelfDescribing"/> object as a string. /// </summary> /// <param name="selfDescribing">The object to be described.</param> /// <returns>The description of the object.</returns> public static string ToString(ISelfDescribing selfDescribing) { return new StringDescription().AppendDescriptionOf(selfDescribing).ToString(); }
/// <summary> /// Alias for ToString(ISelfDescribing). /// </summary> public static String AsString(ISelfDescribing selfDescribing) { return(ToString(selfDescribing)); }
/// <summary> /// Return the description of an <see cref="ISelfDescribing"/> object as a string. /// </summary> /// <param name="selfDescribing">The object to be described.</param> /// <returns>The description of the object.</returns> public static string ToString(ISelfDescribing selfDescribing) { return(new StringDescription().AppendDescriptionOf(selfDescribing).ToString()); }
/// <summary> /// Alias for ToString(ISelfDescribing). /// </summary> public static String AsString(ISelfDescribing selfDescribing) { return ToString(selfDescribing); }
public IMatchDiagnostics Matched(ISelfDescribing selfDescribing) { Text("Match"); Child(selfDescribing); return(this); }
public IDescription AppendDescriptionOf(ISelfDescribing value) { return(this); }
/// <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); }