public UpdateItem ( Guid id, Action |
||
id | Guid | |
update | Action |
|
environmentId | Guid | |
리턴 | void |
public void StudioResourceRepository_UpdateItem_NonExistentGuid_ExpectNoActionCalled() { SetupEnvironmentRepo(Guid.Empty); var repo = new StudioResourceRepository(GetTestData(), Guid.Empty, _invoke); var item = repo.ExplorerItemModels.First(); Assert.AreNotEqual(item.DisplayName, "bob"); bool updated = false; repo.UpdateItem(Guid.NewGuid(), a => { a.DisplayName = "bob"; updated = true; }, Guid.Empty); Assert.IsFalse(updated); }
public void StudioResourceRepository_UpdateItem_NullAction_ExpectException() { SetupEnvironmentRepo(Guid.Empty); var repo = new StudioResourceRepository(GetTestData(), Guid.Empty, _invoke); var item = repo.ExplorerItemModels.First(); Assert.AreNotEqual(item.DisplayName, "bob"); repo.UpdateItem(item.ResourceId, null, Guid.Empty); }
public void StudioResourceRepository_UpdateItem_ExpectSuccessfulUpdate() { var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>(); mockExplorerResourceRepository.Setup(m => m.RenameItem(It.IsAny<IExplorerItem>(), It.IsAny<string>(), It.IsAny<Guid>())) .Returns(new ExplorerRepositoryResult(ExecStatus.Success, "Success")) .Verifiable(); var environmentId = Guid.NewGuid(); var workflowId = Guid.NewGuid(); SetupEnvironmentRepo(environmentId); var mockVersionRepository = new Mock<IVersionRepository>(); var repository = new StudioResourceRepository(GetTestData(workflowId.ToString()), environmentId, _invoke) { GetVersionProxy = id => mockVersionRepository.Object, GetExplorerProxy = id => mockExplorerResourceRepository.Object }; var mockResourceRepository = new Mock<IResourceRepository>(); Mock<IEnvironmentModel> mockEnvironment = EnviromentRepositoryTest.CreateMockEnvironment(mockResourceRepository.Object, "localhost"); mockEnvironment.Setup(model => model.ID).Returns(environmentId); GetEnvironmentRepository(mockEnvironment); bool updated = false; repository.UpdateItem(workflowId, a => { updated = true; }, environmentId); Assert.IsTrue(updated); }