public void InsertsAtBeginning() { var delimiter = Any.Symbol(); var data0 = Any.String(); var data1 = Any.String(); var data2 = Any.String(); var data = string.Join(delimiter, data0, data1); var divider = new RootStringDivider(data, delimiter[0]); divider.Insert(0, data2); divider.Value.Should().Be(string.Join(delimiter, data2, data0, data1)); }
public void MovesToEnd() { var delimiter = Any.Symbol(); var data0 = Any.String(); var data1 = Any.String(); var data2 = Any.String(); var data = string.Join(delimiter, data0, data1, data2); var divider = new RootStringDivider(data, delimiter[0]); divider.Move(1, 2); divider.Value.Should().Be(string.Join(delimiter, data0, data2, data1)); }
public void PadsDivider() { var delimiter = Any.Symbol(); var data = Any.String(); var divider = new RootStringDivider(data, delimiter[0]); var divisions = new List <StringDivision> { new StringDivision(0, data.Length) }; divider.Pad(delimiter[0], 2, 0, data.Length, divisions); divider.Value.Should().Be(string.Join(delimiter, data, string.Empty, string.Empty)); }
public void DeletesAtMiddle() { var delimiter = Any.Symbol(); var data0 = Any.String(); var data1 = Any.String(); var data2 = Any.String(); var data = string.Join(delimiter, data0, data1, data2); var divider = new RootStringDivider(data, delimiter[0]); divider.Delete(1); divider.Value.Should().Be(string.Join(delimiter, data0, data2)); }
public void GetsSubdivision() { var delimiter = Any.Symbol(); var value0 = Any.String(); var value1 = Any.String(); var value = string.Join(delimiter, value0, value1); var divider = new RootStringDivider(value, delimiter[0]); var delimiterOffset = value.IndexOf(delimiter, StringComparison.Ordinal); var division0 = divider.GetSubDivision(0); division0.Valid.Should().BeTrue(); division0.Offset.Should().Be(0); division0.Length.Should().Be(value0.Length); var division1 = divider.GetSubDivision(1); division1.Valid.Should().BeTrue(); division1.Offset.Should().Be(delimiterOffset + 1); division1.Length.Should().Be(value1.Length); }