public void CanStore() { // Get the folders var lookup = MediaFolder.Repository.ToLookUpMulti <string>("Name"); var file1 = new MediaFile() { FullNameRaw = "profile_image.jpg", Description = "Main photo for profile.", DirectoryName = "photos", SortIndex = 1, IsPublic = true, Length = 0, ParentId = lookup["photos"].Id, Contents = "testing some sample content".ToBytesAscii() }; var controller = new MediaFileController(); MediaFile.Create(file1); // Confirm 2 things. // 1. The length of the MediaFolder is updated. // 2. The length of the MediaFile is updated // 3. The extension on the MediaFile is set to jpg var folder = MediaFolder.Get(lookup["photos"].Id); var file = MediaFile.GetAll()[0]; Assert.AreEqual(file.Extension, ".jpg"); Assert.AreEqual(folder.Length, file.Length); }
public void TestMethod1() { var db = new FakeMediaManagerDb(); db.AddSet(TestData.MediaFiles); db.AddSet(TestData.Metadata); var controller = new MediaFileController(db); controller.ControllerContext = new FakeControllerContext(); ViewResult result = (ViewResult)controller.Index(new ListMediaFilesViewModel()); ListMediaFilesViewModel model = result.Model as ListMediaFilesViewModel; Assert.AreEqual(10, model.MediaFiles.Count); }
public void CanStore() { // Get the folders var lookup = MediaFolder.Repository.ToLookUpMulti<string>("Name"); var file1 = new MediaFile() { FullNameRaw = "profile_image.jpg", Description = "Main photo for profile.", DirectoryName = "photos", SortIndex = 1, IsPublic = true, Length = 0, ParentId = lookup["photos"].Id, Contents = "testing some sample content".ToBytesAscii() }; var controller = new MediaFileController(); MediaFile.Create(file1); // Confirm 2 things. // 1. The length of the MediaFolder is updated. // 2. The length of the MediaFile is updated // 3. The extension on the MediaFile is set to jpg var folder = MediaFolder.Get(lookup["photos"].Id); var file = MediaFile.GetAll()[0]; Assert.AreEqual(file.Extension, ".jpg"); Assert.AreEqual(folder.Length, file.Length); }