Ejemplo n.º 1
0
 public void ShouldTestNot()
 {
     var probability = new Probability(1.0);
     var probabilityHalf = new Probability(0.5);
     Assert.That(new Probability(0.0),Is.EqualTo(probability.Not()));
     Assert.That(probabilityHalf,Is.EqualTo(probabilityHalf.Not()));
 }
Ejemplo n.º 2
0
 public void ShouldTestOr()
 {
     var probability = new Probability(1.0);
     var probabilityHalf = new Probability(0.5);
     Assert.That(probability,Is.EqualTo(probability.Or(probability)));
     Assert.That(probability,Is.EqualTo(probability.Or(probabilityHalf)));
     Assert.That(new Probability(0.75),Is.EqualTo(probabilityHalf.Or(probabilityHalf)));
 }
Ejemplo n.º 3
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.º 4
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.º 5
0
 public Probability Or(Probability probability)
 {
     return Not().And(probability.Not()).Not();
 }
Ejemplo n.º 6
0
 public Probability And(Probability probability)
 {
     return new Probability(valueAsFraction*probability.valueAsFraction);
 }