Esempio 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()));
 }
Esempio 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)));
 }
Esempio 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)));
 }
Esempio 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()));
 }
Esempio n. 5
0
 public Probability Or(Probability probability)
 {
     return Not().And(probability.Not()).Not();
 }
Esempio n. 6
0
 public Probability And(Probability probability)
 {
     return new Probability(valueAsFraction*probability.valueAsFraction);
 }