Exemplo n.º 1
0
        internal static Constraint Incomplete(this Must.BeEntryPoint entry, Action <IncompleteAllocationConstraint> setup)
        {
            var incomplete = new IncompleteAllocationConstraint();

            setup(incomplete);
            return(incomplete);
        }
Exemplo n.º 2
0
        internal static Constraint QuasiComplete(this Must.BeEntryPoint entry, Action <QuasiCompleteAllocationConstraint> setup)
        {
            var quasiComplete = new QuasiCompleteAllocationConstraint();

            setup(quasiComplete);
            return(quasiComplete);
        }
Exemplo n.º 3
0
        internal static Constraint Complete(this Must.BeEntryPoint entry, Action <CompleteAllocationConstraint> setup)
        {
            var complete = new CompleteAllocationConstraint();

            setup(complete);
            return(complete);
        }
Exemplo n.º 4
0
        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));
 }
Exemplo n.º 6
0
 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));
 }
Exemplo n.º 7
0
 public static Constraint MoneyWith(this Must.BeEntryPoint entryPoint, decimal amount, Currency currency)
 {
     return(new MoneyConstraint(amount, currency));
 }
Exemplo n.º 8
0
 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));
 }
Exemplo n.º 9
0
 public static PropertyConstraint Ok(this Must.BeEntryPoint entry)
 {
     return(new LambdaPropertyConstraint <HttpResponse>(r => r.StatusCode, Is.EqualTo(HttpStatusCode.OK)));
 }
Exemplo n.º 10
0
 public static Constraint DataContractJsonSerializable <T>(this Must.BeEntryPoint entryPoint)
 {
     return(new SerializationConstraint <T>(new DataContractJsonRoundtripSerializer <T>(dataContractSurrogate: new DataContractSurrogate()), NUnit.Framework.Is.Not.Null));
 }
Exemplo n.º 11
0
 public static Constraint EntityWith(this Must.BeEntryPoint entry, string entityName, string entityNumber)
 {
     return(new CharacterReferenceConstraint(entityName, entityNumber));
 }
Exemplo n.º 12
0
 /// <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));
 }
Exemplo n.º 13
0
 public static Constraint XmlSerializable <T>(this Must.BeEntryPoint entryPoint)
 {
     return(new SerializationConstraint <T>(new XmlRoundtripSerializer <T>(), NUnit.Framework.Is.Not.Null));
 }
Exemplo n.º 14
0
 /// <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)));
 }
Exemplo n.º 15
0
 /// <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));
 }
Exemplo n.º 16
0
 /// <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));
 }
Exemplo n.º 17
0
 /// <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));
 }
Exemplo n.º 18
0
 public static AgeConstraint Age(this Must.BeEntryPoint entry)
 {
     return(new AgeConstraint());
 }
Exemplo n.º 19
0
 public static CurrencyInfoConstraint CurrencyInfo(this Must.BeEntryPoint entryPoint)
 {
     return(new CurrencyInfoConstraint());
 }
Exemplo n.º 20
0
 /// <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));
 }
Exemplo n.º 21
0
 public static Constraint BinarySerializable <T>(this Must.BeEntryPoint entryPoint, Constraint constraintOverDeserialized)
 {
     return(new SerializationConstraint <T>(new BinaryRoundtripSerializer <T>(), constraintOverDeserialized));
 }
Exemplo n.º 22
0
 /// <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));
 }
Exemplo n.º 23
0
 public static Constraint XmlDeserializableInto <T>(this Must.BeEntryPoint entryPoint, T to)
 {
     return(new DeserializationConstraint <T>(new XmlDeserializer(), NUnit.Framework.Is.EqualTo(to)));
 }
Exemplo n.º 24
0
 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));
 }
Exemplo n.º 25
0
 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)));
 }
Exemplo n.º 26
0
 /// <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));
 }
Exemplo n.º 27
0
 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));
 }
Exemplo n.º 28
0
 internal static StringRepresentationConstraint RepresentableAs(this Must.BeEntryPoint entry, string representation)
 {
     return(new StringRepresentationConstraint(representation));
 }
Exemplo n.º 29
0
 public static SpecificationConstraint <T> SatisfiedBy <T>(this Must.BeEntryPoint entry, T value)
 {
     return(new SpecificationConstraint <T>(value, true));
 }
Exemplo n.º 30
0
 public static DateConstraint DateWith(this Must.BeEntryPoint entry, int year, int month, int day)
 {
     return(new DateConstraint(year, month, day, 0, 0, 0, 0));
 }