public void FileExistsGood(string id) { IDBManager fakeDatabase = new FakeDBManager(); fakeDatabase.AddFile(file); Assert.AreEqual(true, fakeDatabase.FileExists(id)); }
public void AddFileGood() { IDBManager fakeDatabase = new FakeDBManager(); fakeDatabase.AddFile(file); Assert.AreEqual(true, fakeDatabase.FileExists(file.Id)); }
public void AddFileBadAlreadyCreated(string id, string name, string extension) { Mock <Files> fileDouble2 = new Mock <Files>(); fileDouble2.Setup(file => file.Id).Returns(id); fileDouble2.Setup(file => file.Name).Returns(name); fileDouble2.Setup(file => file.Extension).Returns(extension); file = fileDouble2.Object; IDBManager fakeDatabase = new FakeDBManager(); fakeDatabase.AddFile(file); Mock <Files> fileDouble3 = new Mock <Files>(); fileDouble3.Setup(file => file.Id).Returns(id); fileDouble3.Setup(file => file.Name).Returns(name); fileDouble3.Setup(file => file.Extension).Returns(extension); Assert.AreEqual(false, fakeDatabase.AddFile(file)); }
public void AddFileBadException(string id, string name, string extension) { Mock <Files> fileDouble2 = new Mock <Files>(); fileDouble2.Setup(file => file.Id).Returns(id); fileDouble2.Setup(file => file.Name).Returns(name); fileDouble2.Setup(file => file.Extension).Returns(extension); file = fileDouble2.Object; IDBManager fakeDatabase = new FakeDBManager(); Assert.Throws <ArgumentException>(() => { fakeDatabase.AddFile(file); } ); }