public async Task SyncControllerTest_Rename_WithCurrentStatusDisabled() { InsertSearchData(); var context = new ControllerContext { HttpContext = new DefaultHttpContext() }; var fakeStorage = new FakeIStorage(new List <string> { "/" }, new List <string> { _createAnImage.DbPath }); var storageSelector = new FakeSelectorStorage(fakeStorage); var controller = new DiskController(_query, storageSelector, new FakeIWebSocketConnectionsService(), new FakeINotificationQuery()) { ControllerContext = context }; var result = await controller.Rename(_createAnImage.DbPath, "/test.jpg", true, false) as JsonResult; var list = result.Value as List <FileIndexItem>; Assert.AreEqual(FileIndexItem.ExifStatus.Ok, list[0].Status); Assert.AreEqual(FileIndexItem.ExifStatus.NotFoundSourceMissing, list[1].Status); await _query.RemoveItemAsync(await _query.GetObjectByFilePathAsync("/test.jpg")); }
public async Task SyncControllerTest_Rename_Good_SocketUpdate() { InsertSearchData(); var context = new ControllerContext { HttpContext = new DefaultHttpContext() }; var socket = new FakeIWebSocketConnectionsService(); var fakeStorage = new FakeIStorage(new List <string> { "/" }, new List <string> { _createAnImage.DbPath }); var storageSelector = new FakeSelectorStorage(fakeStorage); var controller = new DiskController(_query, storageSelector, socket, new FakeINotificationQuery()) { ControllerContext = context }; await controller.Rename(_createAnImage.DbPath, "/test.jpg"); Assert.AreEqual(1, socket.FakeSendToAllAsync.Count(p => !p.Contains("[system]"))); Assert.IsTrue(socket.FakeSendToAllAsync[0].Contains("/test.jpg")); await _query.RemoveItemAsync(await _query.GetObjectByFilePathAsync("/test.jpg")); }
public async Task SyncControllerTest_Rename_NotFoundInIndex() { var context = new ControllerContext { HttpContext = new DefaultHttpContext() }; var fakeStorage = new FakeIStorage(); var storageSelector = new FakeSelectorStorage(fakeStorage); var controller = new DiskController(_query, storageSelector, new FakeIWebSocketConnectionsService(), new FakeINotificationQuery()); controller.ControllerContext = context; var result = await controller.Rename("/notfound-image.jpg", "/test.jpg") as NotFoundObjectResult; Assert.AreEqual(404, result.StatusCode); }