public GetServerVersion ( Guid environmentId ) : string | ||
environmentId | Guid | |
Результат | string |
public void StudioResourceRepository_GetServerVersion_CallsProxy_ReturnsDefault_IfError() { //------------Setup for test-------------------------- var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>(); var mockVersionRepository = new Mock<IVersionRepository>(); var parent = new ServerExplorerItem { ResourceType = ResourceType.WorkflowService, DisplayName = "SuperWF", ResourceId = Guid.NewGuid(), Permissions = Permissions.Contribute, ResourcePath = "MANFOLDER\\APRIL WORK\\SUB FOLDER" }; var repo = new StudioResourceRepository(parent, Guid.Empty, _invoke) { GetVersionProxy = id => mockVersionRepository.Object, GetExplorerProxy = id => mockExplorerResourceRepository.Object, GetCurrentEnvironment = () => Guid.Empty, GetEnvironmentRepository = () => new Mock<IEnvironmentRepository>().Object }; var env = Guid.NewGuid(); mockExplorerResourceRepository.Setup(a => a.GetServerVersion()).Throws(new Exception()); //------------Execute Test--------------------------- Assert.AreEqual("Less than 0.4.19.1", repo.GetServerVersion(env)); mockExplorerResourceRepository.Verify(a=>a.GetServerVersion()); }