public void WithEmptyPeg_ShouldAllowDiscOntoPeg() { //Arrange var disc = FakeDiscDataBuilder.Create().WithSize(1).Build(); var sut = CreateSut(2); //Act sut.PlaceDisc(disc); //Assert sut.CurrentNumberOfDiscs.Should().Be(1); }
public void ShouldAllowSkippingDiscSizes() { //Arrange var disc1 = FakeDiscDataBuilder.Create().WithSize(3).Build(); var disc2 = FakeDiscDataBuilder.Create().WithSize(1).Build(); var sut = CreateSut(3); //Act sut.PlaceDisc(disc1); sut.PlaceDisc(disc2); //Assert sut.CurrentNumberOfDiscs.Should().Be(2); }
public void ShouldNotAllowBigDiscOnTopOfSmallDiscs() { //Arrange var disc1 = FakeDiscDataBuilder.Create().WithSize(1).Build(); var disc2 = FakeDiscDataBuilder.Create().WithSize(2).Build(); var sut = CreateSut(2); //Act sut.PlaceDisc(disc1); Action action = () => sut.PlaceDisc(disc2); //Assert action.Should().Throw <InvalidOperationException>().WithMessage("Cannot place bigger disc on top of smaller disc"); }
public void ShouldEnumrateTheDiscsFromTheBottomUp() { //Arrange var disc1 = FakeDiscDataBuilder.Create().WithSize(3).Build(); var disc2 = FakeDiscDataBuilder.Create().WithSize(2).Build(); var disc3 = FakeDiscDataBuilder.Create().WithSize(1).Build(); var sut = CreateSut(3); sut.PlaceDisc(disc1); sut.PlaceDisc(disc2); sut.PlaceDisc(disc3); //Act //Assert sut.AllDiscs().Should().ContainInOrder(disc1, disc2, disc3); }
public void ShouldRemoveLastDiscFromPeg() { //Arrange var disc1 = FakeDiscDataBuilder.Create().WithSize(3).Build(); var disc2 = FakeDiscDataBuilder.Create().WithSize(2).Build(); var sut = CreateSut(2); sut.PlaceDisc(disc1); sut.PlaceDisc(disc2); //Act var actual = sut.TakeTopDisc(); //Assert sut.CurrentNumberOfDiscs.Should().Be(1); }
public void ShouldReturnLastDiscFromPeg() { //Arrange var disc1 = FakeDiscDataBuilder.Create().WithSize(3).Build(); var disc2 = FakeDiscDataBuilder.Create().WithSize(2).Build(); var sut = CreateSut(2); sut.PlaceDisc(disc1); sut.PlaceDisc(disc2); //Act var actual = sut.TakeTopDisc(); //Assert actual.Should().Be(disc2); }
public void ShouldNotAllowMoreTanMaxDiscsOnPeg() { //Arrange var disc1 = FakeDiscDataBuilder.Create().WithSize(3).Build(); var disc2 = FakeDiscDataBuilder.Create().WithSize(2).Build(); var disc3 = FakeDiscDataBuilder.Create().WithSize(1).Build(); var sut = CreateSut(2); //Act sut.PlaceDisc(disc1); sut.PlaceDisc(disc2); Action action = () => sut.PlaceDisc(disc3); //Assert action.Should().Throw <InvalidOperationException>().WithMessage("This peg is full"); }