public Load ( Guid environmentId, IAsyncWorker asyncWorker ) : void | ||
environmentId | Guid | |
asyncWorker | IAsyncWorker | |
리턴 | void |
public void StudioResourceRepository_Load_CallsServiceLoad() { //------------Setup for test-------------------------- var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>(); // ReSharper disable MaximumChainedReferences mockExplorerResourceRepository.Setup(m => m.Load(It.IsAny<Guid>())) .Returns(new ServerExplorerItem { DisplayName = "some name" }) .Verifiable(); var mockVersionRepository = new Mock<IVersionRepository>(); SetupEnvironmentRepo(Guid.Empty); var repository = new StudioResourceRepository(null, Guid.Empty, _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(Guid.Empty); GetEnvironmentRepository(mockEnvironment); //------------Execute Test--------------------------- repository.Load(Guid.Empty, AsyncWorkerTests.CreateSynchronousAsyncWorker().Object); //------------Assert Results------------------------- mockExplorerResourceRepository.Verify(m => m.Load(It.IsAny<Guid>()), Times.Never()); }
public void StudioResourceRepository_Load_ServiceCallReturnsNoData_ExplorerItemsHasNoData() { //------------Setup for test-------------------------- var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>(); mockExplorerResourceRepository.Setup(m => m.Load(It.IsAny<Guid>())); var mockVersionRepository = new Mock<IVersionRepository>(); SetupEnvironmentRepo(Guid.Empty); var repository = new StudioResourceRepository(null, Guid.Empty, _invoke) { GetVersionProxy = id => mockVersionRepository.Object, GetExplorerProxy = id => mockExplorerResourceRepository.Object }; var countBeforeConnecting = repository.ExplorerItemModels.Count; //------------Execute Test--------------------------- repository.Load(Guid.Empty, AsyncWorkerTests.CreateSynchronousAsyncWorker().Object); //------------Assert Results------------------------- Assert.AreEqual(0, countBeforeConnecting); Assert.AreEqual(0, repository.ExplorerItemModels.Count); }