public void EqualityAndInequality() { var eight = new UnrelatedType7 {Value = 8}.ToContract<IComparableTo1<int>>(); Assert.IsTrue(eight.Equals(8)); Assert.IsFalse(eight.Equals(9)); Assert.IsTrue(eight.NotEqualTo(9)); Assert.IsFalse(eight.Equals(9)); }
public void SelfCastable() { var nn = new UnrelatedType7 {Value = 99}; var contract = nn.ToContract<ICastableTo<UnrelatedType7>>(); var self = contract.Cast(); Assert.AreSame(nn, self); }
public void Modulus() { var ten = new UnrelatedType7 {Value = 10}.ToContract<IModulusOperator>(); Assert.AreEqual(1, ten.Modulus(3)); }
public void DivisionGeneric() { var twelve = new UnrelatedType7 {Value = 12}.ToContract<IDividable<int, int>>(); Assert.AreEqual(3, twelve.DivideBy(4)); }
public void MultiplicationGeneric() { var nine = new UnrelatedType7 {Value = 9}.ToContract<IMultipliable<int>>(); Assert.AreEqual(81, nine.MultiplyBy(9)); }
public void SubtractionBothSides() { var ten = new UnrelatedType7 {Value = 10}.ToContract<ISubtractable>(); Assert.AreEqual(3, ten.Subtract(7)); Assert.AreEqual(4, ten.SubtractFrom(14)); }
public void AdditionRightSide() { var nine = new UnrelatedType7 { Value = 9 }.ToContract<IAddableRight>(); var sum = nine.Add(4); Assert.AreEqual(13, sum); }
public void AdditionLeftSide() { var five = new UnrelatedType7 {Value = 5}.ToContract<IAddableLeft>(); var sum = five.Add(3); Assert.AreEqual(8, sum); }