public void SharedFileStateConverter_ConvertedFileSet_AlreadyShared() { var user = new User() { UserId = Guid.NewGuid(), UserTag = TestConstants.Facebook1UserId }; var roomSharedFileCollectionsViewModel = viewModelFactory.GetViewModel <RoomSharedFileCollectionViewModel>(); var sharedFile = new SharedFile() { SharedFileId = Guid.NewGuid(), ConvertedFileLocation = "http://localhost/something", User = user }; var sharedFileViewModel = viewModelFactory.GetViewModel <SharedFileViewModel>(vm => vm.Model.SharedFileId == sharedFile.SharedFileId); sharedFileViewModel.Model = sharedFile; roomSharedFileCollectionsViewModel.ViewModels.Add(sharedFileViewModel); var converter = new SharedFileStateConverter() { SharedFileViewModels = roomSharedFileCollectionsViewModel.ViewModels }; string actual = converter.Convert(sharedFileViewModel, typeof(string), null, CultureInfo.CurrentCulture) as string; Assert.AreEqual(ClientStrings.SharedFileActionRemove, actual); }
public void SharedFileStateConverter_ConvertedFileNull_UploadCommandNull() { var sharedFile = new SharedFile(); var converter = new SharedFileStateConverter(); string actual = converter.Convert(sharedFile, typeof(string), null, CultureInfo.CurrentCulture) as string; Assert.AreEqual(ClientStrings.SharedFileActionError, actual); }
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); }