Ejemplo n.º 1
0
 public void ShouldTestAnd()
 {
     var probability = new Probability(1.0);
     var probabilityHalf = new Probability(0.5);
     Assert.That(probability,Is.EqualTo(probability.And(probability)));
     Assert.That(probabilityHalf,Is.EqualTo(probability.And(probabilityHalf)));
     Assert.That(new Probability(0.25),Is.EqualTo(probabilityHalf.And(probabilityHalf)));
 }
Ejemplo n.º 2
0
 public void ShouldTestEquals()
 {
     var probabilityOne = new Probability(0.5);
     Assert.That(probabilityOne,Is.EqualTo(probabilityOne));
     Assert.True(probabilityOne.Equals(new Probability(0.5)));
     Assert.False(probabilityOne.Equals(new Probability(1.0)));
     Assert.False(probabilityOne.Equals(null));
     Assert.False(probabilityOne.Equals(new object()));
 }
Ejemplo n.º 3
0
 public Probability And(Probability probability)
 {
     return new Probability(valueAsFraction*probability.valueAsFraction);
 }