public void Update_Prefix_WithNullValue_Works(params object[] prefix) { var sut = new PrefixDictionary <object, object>(); sut.Add(prefix, 1); Assert.That(() => sut.Update(prefix, null), Throws.Nothing); }
public void Update_ExistingPrefix_Works(params object[] prefix) { var sut = new PrefixDictionary <object, object>(); sut.Add(prefix, 1); Assert.That(() => sut.Update(prefix, 0), Throws.Nothing); }
public void Update_Works(params object[] prefix) { var sut = new PrefixDictionary <object, object>(); sut.Add(prefix, 0); sut.Update(prefix, 42); Assert.That(sut.GetMatches(prefix), Is.EquivalentTo(new[] { 42 })); }
public void GetMatches_Case2() { var sut = new PrefixDictionary <char, int>(); sut.Add("", 0); sut.Add("PRE", 0); sut.Add("PREFIX", 2); sut.Update("PRE", 1); var actual = sut.GetMatches("PREF").ToList(); var expected = new[] { 0, 1 }; Assert.AreEqual(expected, actual); }
public void Scenario1() { var sut = new PrefixDictionary <char, int>(); Assert.That(sut.Remove("P"), Is.False); Assert.That(() => sut.Add("P", 0), Throws.Nothing); Assert.That(sut.Remove("P"), Is.True); Assert.That(() => sut.Add("P", 0), Throws.Nothing); Assert.That(sut.Remove("P"), Is.True); Assert.That(() => sut.Update("P", 0), Throws.TypeOf <KeyNotFoundException>()); Assert.That(() => sut.Add("P", 0), Throws.Nothing); Assert.That(() => sut.Add("PREFIX", 1), Throws.Nothing); Assert.That(sut.GetMatches("PREFIX"), Is.EquivalentTo(new[] { 0, 1 })); Assert.That(sut.Remove("P"), Is.True); Assert.That(sut.GetMatches("PREFIX"), Is.EquivalentTo(new[] { 1 })); Assert.That(sut.Remove("PREFIX"), Is.True); Assert.That(sut.GetMatches("PREFIX"), Is.Empty); }
public void Update_NullPrefix_Throw() { var sut = new PrefixDictionary <char, object>(); Assert.That(() => sut.Update(null, 1), Throws.ArgumentNullException); }
public void Update_NewPrefix_Throw(params object[] prefix) { var sut = new PrefixDictionary <object, object>(); Assert.That(() => sut.Update(prefix, 0), Throws.TypeOf <KeyNotFoundException>()); }