public void SharedFileStatusTest_NoModel() { var sharedFileVm = new SharedFileViewModel(); sharedFileVm.Initialize(viewModelFactory); Assert.AreEqual(SharedFileState.Error, sharedFileVm.State); }
public StoredFileDTO BuildDTO(SharedFileViewModel sharedFileViewModel) { return(new StoredFileDTO { Id = sharedFileViewModel.Id, FileName = sharedFileViewModel.FileName, FileSize = sharedFileViewModel.FileSize, UploadDate = sharedFileViewModel.UploadDate }); }
public void SharedFileStatusTest_ConvertedButNotShared() { var sharedFile = new SharedFile() { SharedFileId = Guid.NewGuid(), ConvertedFileLocation = "http://localhost" }; var sharedFileVm = new SharedFileViewModel(); sharedFileVm.Initialize(viewModelFactory); sharedFileVm.Model = sharedFile; Assert.AreEqual(SharedFileState.ReadyToShare, sharedFileVm.State); }
public void SharedFileStatusTest_NoFileUploadController() { var sharedFile = new SharedFile() { SharedFileId = Guid.NewGuid() }; var sharedFileVm = new SharedFileViewModel(); sharedFileVm.Initialize(viewModelFactory); sharedFileVm.Model = sharedFile; Assert.AreEqual(SharedFileState.Error, sharedFileVm.State); }
public void SharedFileStatusTest_Uploaded() { var sharedFile = new SharedFile() { SharedFileId = Guid.NewGuid() }; var sharedFileVm = new SharedFileViewModel(); sharedFileVm.Initialize(viewModelFactory); sharedFileVm.Model = sharedFile; sharedFileVm.FileUploadController = new FileUploadController(null, null, null); sharedFileVm.FileUploadController.UploadState = UploadState.Finished; Assert.AreEqual(SharedFileState.Converting, sharedFileVm.State); }
public void SharedFileStatusTest_Pending() { var sharedFile = new SharedFile() { SharedFileId = Guid.NewGuid() }; var sharedFileVm = new SharedFileViewModel(); sharedFileVm.Initialize(viewModelFactory); sharedFileVm.Model = sharedFile; sharedFileVm.FileUploadController = new FileUploadController(null, null, null); sharedFileVm.FileUploadController.UploadState = UploadState.Pending; Assert.AreEqual(SharedFileState.ReadyToUpload, sharedFileVm.State); }
public void SharedFileStateConverter_ConvertedFileNull_UploadCommandAnythingElse() { var fileUploadController = new FileUploadController(null, null, null) { UploadState = UploadState.Pending }; var sharedFile = new SharedFileViewModel() { FileUploadController = fileUploadController }; var converter = new SharedFileStateConverter(); string actual = converter.Convert(sharedFile, typeof(string), null, CultureInfo.CurrentCulture) as string; Assert.AreEqual(ClientStrings.SharedFileActionUpload, actual); }
public IActionResult EditFile(int id) { SharedFileViewModel model = _shareControllerHelper.BuildViewModel(_fileLogic.GetFileById(id)); return(View(model)); }