Save() public method

public Save ( string args, System.Guid workspaceId, System.Guid dataListId ) : string
args string
workspaceId System.Guid
dataListId System.Guid
return string
Esempio n. 1
0
 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);
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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
                {
                }
            }
        }