public void ShouldReturnFirstIfNeverChurned() { //Arrange FakeRandomBookEnd fakeRandomBookEnd = new FakeRandomBookEnd.Builder().NextInt(new IntOf(1)).Build(); SingleReservoirSample <string> subject = new SingleReservoirSample <string>(new List <string>(), "DEFAULT", fakeRandomBookEnd); //Act string actual = subject.Element(); //Assert actual.Should().Be("DEFAULT"); }
public void ShouldReturnDefaultGivenNoElements() { //Arrange FakeRandomBookEnd fakeRandomBookEnd = new FakeRandomBookEnd.Builder().Build(); SingleReservoirSample <string> subject = new SingleReservoirSample <string>(new List <string>(), "DEFAULT", fakeRandomBookEnd); //Act string actual = subject.Element(); //Assert actual.Should().Be("DEFAULT"); }
public void ShouldReturnSampledValue() { //Arrange List <string> initial = new List <string> { "a", "b", "c", "d" }; FakeRandomBookEnd fakeRandomBookEnd = new FakeRandomBookEnd.Builder().NextInt(new IntOf(0), new IntOf(1), new IntOf(0), new IntOf(1)).Build(); SingleReservoirSample <string> subject = new SingleReservoirSample <string>(initial, "DEFAULT", fakeRandomBookEnd); //Act string actual = subject.Element(); //Assert actual.Should().Be("c"); }