コード例 #1
0
 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));
 }
コード例 #2
0
 public void SelfCastable()
 {
     var nn = new UnrelatedType7 {Value = 99};
     var contract = nn.ToContract<ICastableTo<UnrelatedType7>>();
     var self = contract.Cast();
     Assert.AreSame(nn, self);
 }
コード例 #3
0
 public void Modulus()
 {
     var ten = new UnrelatedType7 {Value = 10}.ToContract<IModulusOperator>();
     Assert.AreEqual(1, ten.Modulus(3));
 }
コード例 #4
0
 public void DivisionGeneric()
 {
     var twelve = new UnrelatedType7 {Value = 12}.ToContract<IDividable<int, int>>();
     Assert.AreEqual(3, twelve.DivideBy(4));
 }
コード例 #5
0
 public void MultiplicationGeneric()
 {
     var nine = new UnrelatedType7 {Value = 9}.ToContract<IMultipliable<int>>();
     Assert.AreEqual(81, nine.MultiplyBy(9));
 }
コード例 #6
0
 public void SubtractionBothSides()
 {
     var ten = new UnrelatedType7 {Value = 10}.ToContract<ISubtractable>();
     Assert.AreEqual(3, ten.Subtract(7));
     Assert.AreEqual(4, ten.SubtractFrom(14));
 }
コード例 #7
0
 public void AdditionRightSide()
 {
     var nine = new UnrelatedType7 { Value = 9 }.ToContract<IAddableRight>();
     var sum = nine.Add(4);
     Assert.AreEqual(13, sum);
 }
コード例 #8
0
 public void AdditionLeftSide()
 {
     var five = new UnrelatedType7 {Value = 5}.ToContract<IAddableLeft>();
     var sum = five.Add(3);
     Assert.AreEqual(8, sum);
 }