internal static Constraint Incomplete(this Must.BeEntryPoint entry, Action <IncompleteAllocationConstraint> setup) { var incomplete = new IncompleteAllocationConstraint(); setup(incomplete); return(incomplete); }
internal static Constraint QuasiComplete(this Must.BeEntryPoint entry, Action <QuasiCompleteAllocationConstraint> setup) { var quasiComplete = new QuasiCompleteAllocationConstraint(); setup(quasiComplete); return(quasiComplete); }
internal static Constraint Complete(this Must.BeEntryPoint entry, Action <CompleteAllocationConstraint> setup) { var complete = new CompleteAllocationConstraint(); setup(complete); return(complete); }
internal static Constraint NoAllocation(this Must.BeEntryPoint entry, Action <NoAllocationConstraint> setup) { var no = new NoAllocationConstraint(); setup(no); return(no); }
/// <summary> /// Builds an instance of <see cref="SerializationConstraint{T}"/> that allows checking the data contract serialization/deserialization of an object. /// </summary> /// <typeparam name="T">Type to be serialized and deserialized.</typeparam> /// <param name="entry">Extension entry point.</param> /// <param name="constraintOverDeserialized">Constraint to apply to the deserialized object.</param> /// <param name="maxItemsInObjectGraph">The maximum number of items in the graph to serialize or deserialize. The default is <c>4</c>.</param> /// <param name="ignoreExtensionDataObject">true to ignore the <see cref="IExtensibleDataObject"/> interface upon serialization and ignore unexpected data upon deserialization; otherwise, false. The default is false.</param> /// <param name="dataContractSurrogate">An implementation of the <see cref="IDataContractSurrogate"/> to customize the serialization process.</param> /// <param name="alwaysEmitTypeInformation">true to emit type information; otherwise, false. The default is false.</param> /// <returns>Instance built.</returns> public static Constraint DataContractJsonSerializable <T>(this Must.BeEntryPoint entry, Constraint constraintOverDeserialized, int maxItemsInObjectGraph = 4, bool ignoreExtensionDataObject = false, IDataContractSurrogate dataContractSurrogate = null, bool alwaysEmitTypeInformation = false) { return(new SerializationConstraint <T>( new DataContractJsonRoundtripSerializer <T>( maxItemsInObjectGraph, ignoreExtensionDataObject, dataContractSurrogate, alwaysEmitTypeInformation), constraintOverDeserialized)); }
public static SpanConstraint SpanWith(this Must.BeEntryPoint entry, int days = 0, int hours = 0, int minutes = 0, int seconds = 0, int milliseconds = 0) { return(new SpanConstraint(days, hours, minutes, seconds, milliseconds)); }
public static Constraint MoneyWith(this Must.BeEntryPoint entryPoint, decimal amount, Currency currency) { return(new MoneyConstraint(amount, currency)); }
public static DateConstraint TimeWith(this Must.BeEntryPoint entry, int year = 1, int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0, int millisecond = 0) { return(new DateConstraint(year, month, day, hour, minute, second, millisecond)); }
public static PropertyConstraint Ok(this Must.BeEntryPoint entry) { return(new LambdaPropertyConstraint <HttpResponse>(r => r.StatusCode, Is.EqualTo(HttpStatusCode.OK))); }
public static Constraint DataContractJsonSerializable <T>(this Must.BeEntryPoint entryPoint) { return(new SerializationConstraint <T>(new DataContractJsonRoundtripSerializer <T>(dataContractSurrogate: new DataContractSurrogate()), NUnit.Framework.Is.Not.Null)); }
public static Constraint EntityWith(this Must.BeEntryPoint entry, string entityName, string entityNumber) { return(new CharacterReferenceConstraint(entityName, entityNumber)); }
/// <summary> /// Builds an instance of <see cref="Constraint"/> that tests whether the actual /// value occurs either on, or after the specified <paramref name="date"/>. /// </summary> /// <param name="entry">Extension entry point.</param> /// <param name="date">The expected date to compare the actual value with.</param> /// <returns>Instance built.</returns> public static Constraint OnOrAfter(this Must.BeEntryPoint entry, DateTime date) { return(Is.GreaterThanOrEqualTo(date)); }
public static Constraint XmlSerializable <T>(this Must.BeEntryPoint entryPoint) { return(new SerializationConstraint <T>(new XmlRoundtripSerializer <T>(), NUnit.Framework.Is.Not.Null)); }
/// <summary> /// Builds an instance of <see cref="Constraint"/> that tests whether the actual /// value occurs within the specified number of milliseconds (20 by default) from /// the specified <paramref name="date"/>. /// </summary> /// <param name="entry">Extension entry point.</param> /// <param name="date">The expected date to compare the actual value with.</param> /// <param name="ms"></param> /// <returns>Instance built.</returns> public static Constraint CloseTo(this Must.BeEntryPoint entry, DateTime date, uint ms = 20) { return(CloseTo(entry, date, TimeSpan.FromMilliseconds(ms))); }
/// <summary> /// Builds an instance of <see cref="Constraint"/> that tests whether the actual /// value occurs within the specified time span (20 ms by default) from /// the specified <paramref name="date"/>. /// </summary> /// <param name="entry">Extension entry point.</param> /// <param name="date">The expected date to compare the actual value with.</param> /// <param name="within"></param> /// <returns>Instance built.</returns> public static Constraint CloseTo(this Must.BeEntryPoint entry, DateTime date, TimeSpan within) { return(Is.EqualTo(date).Within(within)); }
/// <summary> /// Builds an instance of <see cref="SerializationConstraint{T}"/> that allows checking the data contract serialization/deserialization of an object. /// </summary> /// <typeparam name="T">Type to be serialized and deserialized.</typeparam> /// <param name="entry">Extension entry point.</param> /// <param name="constraintOverDeserialized">Constraint to apply to the deserialized object.</param> /// <returns>Instance built.</returns> public static Constraint DataContractSerializable <T>(this Must.BeEntryPoint entry, Constraint constraintOverDeserialized) { return(new SerializationConstraint <T>(new DataContractRoundtripSerializer <T>(), constraintOverDeserialized)); }
/// <summary> /// Builds an instance of <see cref="SerializationConstraint{T}"/> that allows checking the serialization/deserialization of an object. /// </summary> /// <typeparam name="T">Type to be serialized and deserialized.</typeparam> /// <param name="entry">Extension entry point.</param> /// <param name="serializer"></param> /// <param name="constraintOverDeserialized">Constraint to apply to the deserialized object.</param> /// <returns>Instance built.</returns> public static Constraint Serializable <T>(this Must.BeEntryPoint entry, IRoundtripSerializer <T> serializer, Constraint constraintOverDeserialized) { return(new SerializationConstraint <T>(serializer, constraintOverDeserialized)); }
public static AgeConstraint Age(this Must.BeEntryPoint entry) { return(new AgeConstraint()); }
public static CurrencyInfoConstraint CurrencyInfo(this Must.BeEntryPoint entryPoint) { return(new CurrencyInfoConstraint()); }
/// <summary> /// Builds an instance of <see cref="Constraint"/> that tests whether the actual /// value occurs either on, or before the specified <paramref name="date"/>. /// </summary> /// <param name="entry">Extension entry point.</param> /// <param name="date">The expected date to compare the actual value with.</param> /// <returns>Instance built.</returns> public static Constraint OnOrBefore(this Must.BeEntryPoint entry, DateTime date) { return(Is.LessThanOrEqualTo(date)); }
public static Constraint BinarySerializable <T>(this Must.BeEntryPoint entryPoint, Constraint constraintOverDeserialized) { return(new SerializationConstraint <T>(new BinaryRoundtripSerializer <T>(), constraintOverDeserialized)); }
/// <summary> /// Builds an instance of <see cref="JsonEqualConstraint"/> that allows assertions using /// compact JSON strings. /// </summary> /// <remarks>A compact JSON string notation uses single quotes for names and string values instead /// of double quotes, removing the need to escape such double quotes. /// <para>A non-compact JSON string uses the canonical double quote style for names an string values.</para> /// </remarks> /// <param name="entry">Extension entry point.</param> /// <param name="expected">The expected value in JSON compact notation.</param> /// <returns>Instance built.</returns> public static Constraint Json(this Must.BeEntryPoint entry, string expected) { return(new JsonEqualConstraint(expected)); }
public static Constraint XmlDeserializableInto <T>(this Must.BeEntryPoint entryPoint, T to) { return(new DeserializationConstraint <T>(new XmlDeserializer(), NUnit.Framework.Is.EqualTo(to))); }
public static SmartEntryConstraint <T> Entry <T>(this Must.BeEntryPoint entry, int index, T value, bool isFirst, bool isLast) { return(new SmartEntryConstraint <T>(index, value, isFirst, isLast)); }
public static Constraint DataContractJsonDeserializableInto <T>(this Must.BeEntryPoint entryPoint, T to) { return(new DeserializationConstraint <T>(new DataContractJsonDeserializer(dataContractSurrogate: new DataContractSurrogate()), NUnit.Framework.Is.EqualTo(to))); }
/// <summary> /// Builds an instance of <see cref="ConstrainedEnumerable"/> with the provided constraints. /// </summary> /// <param name="entry">Extension entry point.</param> /// <param name="constraints">Constraints to apply to the enumerable elements.</param> /// <returns>Instance built.</returns> public static ConstrainedEnumerable Constrained(this Must.BeEntryPoint entry, params Constraint[] constraints) { return(new ConstrainedEnumerable(constraints)); }
public static OffsetConstraint OffsetWith(this Must.BeEntryPoint entry, int year = 1, int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, TimeSpan offset = new TimeSpan()) { return(new OffsetConstraint(year, month, day, hour, minute, second, millisecond, offset)); }
internal static StringRepresentationConstraint RepresentableAs(this Must.BeEntryPoint entry, string representation) { return(new StringRepresentationConstraint(representation)); }
public static SpecificationConstraint <T> SatisfiedBy <T>(this Must.BeEntryPoint entry, T value) { return(new SpecificationConstraint <T>(value, true)); }
public static DateConstraint DateWith(this Must.BeEntryPoint entry, int year, int month, int day) { return(new DateConstraint(year, month, day, 0, 0, 0, 0)); }