public void FileRepoCheck() { CleanUpDatabase(); _db = CreateDBInstance(); _db.Init(); DatabaseService.RegisterInstance(_db); var file = FileLink.Create(@"C:\dummy_test_file.txt"); DatabaseService.FileRepository.Write(file); var dbObject = (IPersistable)file; Assert.IsFalse(dbObject.Key.IsEmpty()); var readed = DatabaseService.FileRepository.FindByKey(dbObject.Key); Assert.IsFalse(readed == default(FileLink)); Assert.IsTrue(readed.FullName == file.FullName); DatabaseService.FileRepository.Remove(readed); readed = DatabaseService.FileRepository.FindByKey(dbObject.Key); Assert.IsTrue(readed == default(FileLink)); CleanUpDatabase(); }
public void Can_Insert_And_Find_File_Link() { var link = FileLink.Create(new Uri("file.mp3", UriKind.RelativeOrAbsolute), FileLinkLocation.WebServer); Context.Set <FileLink>().Add(link); Context.SaveChanges(); var foundLink = Context.Set <FileLink>().Find(link.Id); Assert.IsNotNull(foundLink); Assert.AreEqual("file.mp3", foundLink.Uri); Assert.AreEqual(FileLinkLocation.WebServer.ToString(), foundLink.Location); }