public Save ( string args, System.Guid workspaceId, System.Guid dataListId ) : string | ||
args | string | |
workspaceId | System.Guid | |
dataListId | System.Guid | |
리턴 | string |
public void WebSourcesSaveWithInValidArgsExpectedInvalidValidationResult() { var handler = new WebSources(); var jsonResult = handler.Save("root:'hello'", Guid.Empty, Guid.Empty); var result = JsonConvert.DeserializeObject<ValidationResult>(jsonResult); Assert.IsFalse(result.IsValid); }
public void WebSourcesSaveWithValidArgsExpectedInvokesResourceCatalogSave() { var expected = CreateWebSource(); var catalog = new Mock<IResourceCatalog>(); catalog.Setup(c => c.SaveResource(It.IsAny<Guid>(), It.IsAny<IResource>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())).Verifiable(); var handler = new WebSources(catalog.Object); var jsonResult = handler.Save(expected.ToString(), Guid.Empty, Guid.Empty); var actual = JsonConvert.DeserializeObject<WebSource>(jsonResult); catalog.Verify(c => c.SaveResource(It.IsAny<Guid>(), It.IsAny<IResource>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())); VerifySource(expected, actual); }
public void WebSourcesGetWithValidArgsExpectedReturnsSource() { var expected = CreateWebSource(); var saveArgs = expected.ToString(); var workspaceID = Guid.NewGuid(); var workspacePath = EnvironmentVariables.GetWorkspacePath(workspaceID); try { var handler = new WebSources(); handler.Save(saveArgs, workspaceID, Guid.Empty); var actual = handler.Get(expected.ResourceID.ToString(), workspaceID, Guid.Empty); VerifySource(actual, expected); } finally { try { if(Directory.Exists(workspacePath)) { DirectoryHelper.CleanUp(workspacePath); } } // ReSharper disable EmptyGeneralCatchClause catch(Exception) // ReSharper restore EmptyGeneralCatchClause { } } }