public void SwapImportsTheDetailsFromTheOtherInstance() { //Arrange var keeper = new StringKeeper("test"); var keeper2 = new StringKeeper(keeper); var takenData = keeper.TakeAll(); //keeper is now finished //Act keeper.Swap(keeper2); //Assert var result = keeper.TakeAll(); //if swap did not change keeper, this will return string.Empty result.Should().Be(takenData); }
public void InstancesCanBeCopied() { //Arrange var keeper = new StringKeeper("test"); //Act var keeper2 = new StringKeeper(keeper); //Assert keeper2.TakeAll().Should().Be(keeper.TakeAll()); }
public void FinishedShouldBeTrueAfterTakeAll() { //Arrange var keeper = new StringKeeper("test"); //Act keeper.TakeAll(); //Assert keeper.Finished.Should().BeTrue(); }
public void TakeAllReturnsFullString() { //Arrange var keeper = new StringKeeper("test"); //Act var result = keeper.TakeAll(); //Assert result.Should().Be("test"); }
public void CopiedInstancesDoNotFollowTheOriginal() { //Arrange var keeper = new StringKeeper("test"); var keeper2 = new StringKeeper(keeper); //Act keeper.TakeAll(); //Assert keeper2.Finished.Should().BeFalse(); }
public void CopyingAFinishedInstanceShouldProduceAFinishedInstance() { //Arrange var keeper = new StringKeeper("test"); keeper.TakeAll(); //Act var keeper2 = new StringKeeper(keeper); //Assert keeper2.Finished.Should().BeTrue(); }
public void CopiedInstancesShouldHaveTheSamePositionAsTheOriginal() { //Arrange var keeper = new StringKeeper("test"); keeper.Take(); //Act var keeper2 = new StringKeeper(keeper); //Assert keeper2.TakeAll().Should().Be(keeper.TakeAll()); }
public void SkipWhitespaceWorksIfFinished() { //Arrange var keeper = new StringKeeper("test"); keeper.TakeAll(); //Act keeper.SkipWhiteSpace(); //Assert keeper.Finished.Should().BeTrue(); //well, still true anyway }
public void TakeAllReturnsRemainingText() { //Arrange var keeper = new StringKeeper("test"); keeper.Take(); //Act var result = keeper.TakeAll(); //Assert result.Should().Be("est"); }
public void SwapCopiesTheCorrectPositionIntoAnotherInstance() { //Arrange var keeper = new StringKeeper("test"); var keeper2 = new StringKeeper(keeper); keeper.TakeAll(); //Act keeper.Swap(keeper2); //Assert keeper2.Finished.Should().BeTrue(); }
public ErrorToken(StringKeeper pos, string errorMessage) { Text = pos.TakeAll(); ErrorMessage = errorMessage; }