public void AddDeltaGood() { IDBManager fakeDatabase = new FakeDBManager(); fakeDatabase.AddDelta(delta); Assert.AreEqual(true, fakeDatabase.DeltaExists(delta.FileId)); }
public void DeltaExistsGood(string id) { IDBManager fakeDatabase = new FakeDBManager(); fakeDatabase.AddDelta(delta); Assert.AreEqual(true, fakeDatabase.DeltaExists(id)); }
public void AddDeltaBadAlreadyCreated(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(); fakeDatabase.AddDelta(delta); Mock <Delta> deltaDouble3 = new Mock <Delta>(); deltaDouble3.Setup(delta => delta.FileId).Returns(id); deltaDouble3.Setup(delta => delta.Content).Returns(content); deltaDouble3.Setup(delta => delta.LineRange).Returns(linerange); Assert.AreEqual(false, fakeDatabase.AddDelta(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 AddDeltaBadExceptionLength(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.AddDelta(delta); } ); }