public void CheckAccessToView_Returns500StatusCodeIfFolderIsNull() { // arrange string currUserId = "4321"; FolderVM folder = null; var mock = new Mock <IUnitOfWork>(); FileSystemService service = new FileSystemService(mock.Object, _mapper); int expected = 500; // act StatusCodeException ex = Assert.Throws <StatusCodeException>(() => service.CheckAccessToView(folder, currUserId)); // assert Assert.AreEqual(expected, ex.Data["Status code"]); }
public void CheckAccessToView_ReturnsTrueIfFileIsShared() { // arrange FileVM file = new FileVM { IsShared = true, OwnerId = "1234" }; var mock = new Mock <IUnitOfWork>(); FileSystemService service = new FileSystemService(mock.Object, _mapper); string currUserId = "4321"; // act bool result = service.CheckAccessToView(file, currUserId); // assert Assert.IsTrue(result); }
public void CheckAccessToView_ReturnsFalseIfFolderIsNonSharedAndYouAreNotOwner() { // arrange string currUserId = "4321"; FolderVM folder = new FolderVM { IsShared = false, OwnerId = "1234" }; var mock = new Mock <IUnitOfWork>(); FileSystemService service = new FileSystemService(mock.Object, _mapper); // act bool result = service.CheckAccessToView(folder, currUserId); // assert Assert.IsFalse(result); }
public void CheckAccessToView_ReturnsTrueIfFilerIsNonSharedButYouAreOwner() { // arrange string currUserId = "4321"; FileVM file = new FileVM { IsShared = false, OwnerId = currUserId }; var mock = new Mock <IUnitOfWork>(); FileSystemService service = new FileSystemService(mock.Object, _mapper); // act bool result = service.CheckAccessToView(file, currUserId); // assert Assert.IsTrue(result); }