public void AddDeltaMissingIdString(string id, string content, string linerange) { Mock <Delta> deltaDouble2 = new Mock <Delta>(); deltaDouble2.Setup(delta => delta.FileId).Returns(id); deltaDouble2.Setup(delta => delta.Content).Returns(content); deltaDouble2.Setup(delta => delta.LineRange).Returns(linerange); delta = deltaDouble2.Object; IDBManager fakeDatabase = new FakeDBManager(); Assert.AreEqual(false, fakeDatabase.UpdateDelta(delta)); }
public void UpdateDeltaGood(string id, string content, string linerange) { Mock <Delta> deltaDouble2 = new Mock <Delta>(); deltaDouble2.Setup(delta2 => delta2.FileId).Returns(id); deltaDouble2.Setup(delta2 => delta2.Content).Returns(content); deltaDouble2.Setup(delta2 => delta2.LineRange).Returns(linerange); delta2 = deltaDouble2.Object; FakeDBManager fakeDatabase = new FakeDBManager(); fakeDatabase.AddDelta(delta); fakeDatabase.UpdateDelta(delta2); Assert.AreEqual(fakeDatabase.GetDelta(delta.FileId).Content, delta2.Content); Assert.AreEqual(fakeDatabase.GetDelta(delta.FileId).LineRange, delta2.LineRange); }
public void UpdateDeltaBadExceptionLength(string id, string content, string linerange) { Mock <Delta> deltaDouble2 = new Mock <Delta>(); deltaDouble2.Setup(delta => delta.FileId).Returns(id); deltaDouble2.Setup(delta => delta.Content).Returns(content); deltaDouble2.Setup(delta => delta.LineRange).Returns(linerange); delta = deltaDouble2.Object; IDBManager fakeDatabase = new FakeDBManager(); Assert.Throws <ArgumentException>(() => { fakeDatabase.UpdateDelta(delta); } ); }