public void ChecksForNullSampleList() { var stable = new Stable(); Assert.DoesNotThrow(() => stable.AddSample(123), "Adding Sample threw an error"); Assert.IsNotNull(stable.Samples, "Samples is still null"); }
public void DefaultThreshold() { var threshold = 0.2; var stable = new Stable(); Assert.AreEqual(threshold, stable.Threshold, "Threshold default not set to " + threshold); }
public void DefaultSampleSize() { var sampleSize = 3; var stable = new Stable(); Assert.AreEqual(sampleSize, stable.SampleSize, "Sample Size default not set to " + sampleSize); }
public void DefaultIsStable() { var isStable = false; var stable = new Stable(); Assert.AreEqual(isStable, stable.IsStable, "IsStable not defaulting to " + isStable); }
public void CanSetThreshold() { var threshold = 0.2; var stable = new Stable(new Stable { Threshold = threshold }); Assert.AreEqual(threshold, stable.Threshold, "Threshold not set."); }
public void StableAverageUpdated() { var stable = new Stable(); stable.AddSample(123); Assert.AreNotEqual(0, stable.StableAverage, "The Stable Average was not set."); }
public void SampleAddedToNew() { var sample = 45.2; var stable = new Stable(); stable.AddSample(sample); Assert.IsTrue(stable.Samples.Count > 0, "Sample not added to List."); Assert.AreEqual(sample, stable.Samples[0], "Sample not added to empty list"); }
public void CanSetSampleSize() { //Arrange var sampleSize = 2; //Act var stable = new Stable(new Stable { SampleSize = sampleSize }); //Assert Assert.AreEqual(sampleSize, stable.SampleSize, "Sample Size not set in constructor."); }
public void SamplesDoesNotGetBiggerThanSampleSize() { var sampleSize = 2; var stable = new Stable(new Stable { SampleSize = sampleSize }); stable.AddSample(23); stable.AddSample(65); stable.AddSample(123); Assert.AreEqual(sampleSize, stable.Samples.Count, "Samples count has exceeded sample size"); }
public void StableAverageIsCorrectWith3Values() { var average = 5; var diff = 2; var stable = new Stable(); stable.AddSample(average + diff); stable.AddSample(average - diff); stable.AddSample(average); Assert.AreEqual(average, stable.StableAverage, "The Stable Average is not computing correctly with 3 values"); }
public void WillBecomeStableAndThenUnstableWithAnotherValue() { var average = 5; var diff = .1; var stable = new Stable(); stable.AddSample(average + diff); stable.AddSample(average - diff); stable.AddSample(average); Assert.IsTrue(stable.IsStable, "Not marked as stable and should have."); stable.AddSample(average * 40); Assert.IsFalse(stable.IsStable, "Marked as stable and should not have."); }
public Stable(Stable stable) { SampleSize = stable.SampleSize; Threshold = stable.Threshold; }
public void WillMarkAsNotStableWithDefaultThreshold() { var average = 5; var diff = 2; var stable = new Stable(); stable.AddSample(average + diff); stable.AddSample(average - diff); stable.AddSample(average); Assert.IsFalse(stable.IsStable, "Marked as stable and should not have."); }
public void WillMarkAsStableWithDefaultThreshold() { var average = 5; var diff = .1; var stable = new Stable(); stable.AddSample(average + diff); stable.AddSample(average - diff); stable.AddSample(average); Assert.IsTrue(stable.IsStable, "Not marked as stable and should have."); }