public void Contained() { // ARRANGE Sample sample = new Sample(); sample.AddModification(new Span(10, 20), null); sample.AddModification(new Span(30, 40), null); // ACT & ASSERT Assert.Throws <ArgumentException>(() => { sample.AddModification(new Span(15, 18), null); }); }
public void Insert_Middle_Discrete() { // ARRANGE Sample sample = new Sample(); sample.AddModification(new Span(10, 20), null); sample.AddModification(new Span(30, 40), null); // ACT sample.AddModification(new Span(24, 26), null); // ASSERT IReadOnlyList <MessageBuffer.Modification> actual = sample.Modifications; Assert.Equal(3, actual.Count); Assert.Equal(new Span(10, 20), actual[0].Span); Assert.Equal(new Span(24, 26), actual[1].Span); Assert.Equal(new Span(30, 40), actual[2].Span); }
public void InsertAtSamePoint() { // ARRANGE Sample sample = new Sample(); sample.AddModification(new Span(10, 10), null); sample.AddModification(new Span(10, 10), null); Func <Modifier, bool> handler = (modifier) => false; // ACT sample.AddModification(new Span(10, 10), handler); // ASSERT IReadOnlyList <MessageBuffer.Modification> actual = sample.Modifications; // Note that the added modification is appended at the last Assert.Equal(3, actual.Count); Assert.Equal(new Span(10, 10), actual[0].Span); Assert.Equal(null, actual[0].Handler); Assert.Equal(new Span(10, 10), actual[1].Span); Assert.Equal(null, actual[1].Handler); Assert.Equal(new Span(10, 10), actual[2].Span); Assert.Equal(handler, actual[2].Handler); }