void ObjectInvariant() { Contract.Invariant(this.items != null); Contract.Invariant( this.count > -1 & this.count <= this.items.Length); Contract.Invariant( EnumerableContract.All(0, this.count, index => { var left = 2 * index + 1; var right = 2 * index + 2; return((left >= count || this.LessOrEqual(index, left)) && (right >= count || this.LessOrEqual(index, right))); }) ); }
public void CheckIntegerEnumeration() { var enumerablePropertyInfo = new Mock <PropertyInfo> { CallBase = true, DefaultValue = DefaultValue.Mock }; var propertyTypeMock = new Mock <Type> { CallBase = true, DefaultValue = DefaultValue.Mock }; propertyTypeMock.Setup(se => se.GenericTypeArguments).Returns(new[] { typeof(int) }); enumerablePropertyInfo.Setup(se => se.PropertyType).Returns(propertyTypeMock.Object); var enumerableContract = new EnumerableContract(typeof(MyTestModel), enumerablePropertyInfo.Object); Assert.AreEqual("int32sTomytestmodels", enumerableContract.tableName); }