public void GenerateNewNumberEachTime() { var subject = new RandomIntsForDays(); subject.GenerateNumber(); var firstNumber = subject.CurrentNumber; subject.GenerateNumber(); var secondNumber = subject.CurrentNumber; firstNumber.ShouldNotBe(secondNumber); }
private static TimeSpan TriggerNewNumber(Stopwatch stopwatch, TimeSpan lastTime) { WriteLine($"It's Been {(stopwatch.Elapsed - lastTime).Milliseconds} Milliseconds Since I Last Got a Number!"); lastTime = stopwatch.Elapsed; randoNumber.GenerateNumber(); return(lastTime); }
public void GenerateNumbers() { var subject = new RandomIntsForDays(); subject.GenerateNumber(); var result = subject.CurrentNumber; result.ShouldBeOfType <int>(); }
public void NotifySubscribersMultipleTimes(int timesToUpdate) { var subject = new RandomIntsForDays(); var numberFan = Substitute.For <ISubscriber>(); subject.AddSubscriber(numberFan); var expectedValues = new List <int>(); for (var i = 0; i < timesToUpdate; i++) { subject.GenerateNumber(); expectedValues.Add(subject.CurrentNumber); } numberFan.Received(timesToUpdate).Notify(Arg.Is <int>(x => expectedValues.Contains(x))); }