Execute() public method

Executes the service
public Execute ( StringBuilder>.Dictionary values, IWorkspace theWorkspace ) : StringBuilder
values StringBuilder>.Dictionary The values.
theWorkspace IWorkspace The workspace.
return StringBuilder
 public void GetDatabaseColumnsForTable_UnitTest_ExecuteWithBlankDatabase_ExpectedHasErrors()
 {
     var esb = new GetDatabaseColumnsForTable();
     var actual = esb.Execute(new Dictionary<string, StringBuilder> { { "Database", new StringBuilder() } }, null);
     Assert.IsNotNull(actual);
     var result = JsonConvert.DeserializeObject<DbColumnList>(actual.ToString());
     Assert.IsTrue(result.HasErrors);
     Assert.AreEqual("No database set.", result.Errors);
 }
 public void GetDatabaseColumnsForTable_UnitTest_ExecuteWithNullValues_ExpectedInvalidDataContractException()
 {
     var esb = new GetDatabaseColumnsForTable();
     var actual = esb.Execute(null, null);
     Assert.AreEqual(string.Empty, actual);
 }
        public void GetDatabaseColumnsForTable_Execute_EmptySchema_ValidDatabaseSource_ReturnsFromAllSchemas()
        {
            //------------Setup for test--------------------------
            var dbSource = CreateDev2TestingDbSource();
            ResourceCatalog.Instance.SaveResource(Guid.Empty, dbSource);
            string someJsonData = JsonConvert.SerializeObject(dbSource, new JsonSerializerSettings
            {
                TypeNameHandling = TypeNameHandling.Objects,
                TypeNameAssemblyFormat = FormatterAssemblyStyle.Simple
            });
            var esb = new GetDatabaseColumnsForTable();
            var mockWorkspace = new Mock<IWorkspace>();
            mockWorkspace.Setup(workspace => workspace.ID).Returns(Guid.Empty);
            //------------Execute Test---------------------------
            var actual = esb.Execute(new Dictionary<string, StringBuilder> { { "Database", new StringBuilder(someJsonData) }, { "TableName", new StringBuilder("City") }, { "Schema", new StringBuilder("") } }, mockWorkspace.Object);
            //------------Assert Results-------------------------
            var value = actual.ToString();
            Assert.IsFalse(string.IsNullOrEmpty(value));
            var result = JsonConvert.DeserializeObject<DbColumnList>(actual.ToString(), new JsonSerializerSettings
            {
                TypeNameHandling = TypeNameHandling.Objects,
                TypeNameAssemblyFormat = FormatterAssemblyStyle.Simple
            });
            Assert.AreEqual(3, result.Items.Count);

            // Check Columns Returned ;)
            Assert.IsFalse(result.Items[0].IsNullable);
            Assert.IsFalse(result.Items[0].IsAutoIncrement);
            StringAssert.Contains(result.Items[0].ColumnName, "CityID");
            StringAssert.Contains(result.Items[0].SqlDataType.ToString(), "Int");

            Assert.IsFalse(result.Items[1].IsNullable);
            Assert.IsFalse(result.Items[1].IsAutoIncrement);
            StringAssert.Contains(result.Items[1].ColumnName, "Description");
            StringAssert.Contains(result.Items[1].SqlDataType.ToString(), "VarChar");

            Assert.IsFalse(result.Items[2].IsNullable);
            Assert.IsFalse(result.Items[2].IsAutoIncrement);
            StringAssert.Contains(result.Items[2].ColumnName, "CountryID");
            StringAssert.Contains(result.Items[2].SqlDataType.ToString(), "Int");
        }