当前位置: 首页>>代码示例>>C#>>正文


C# Dev2JsonSerializer.Serialize方法代码示例

本文整理汇总了C#中Dev2JsonSerializer.Serialize方法的典型用法代码示例。如果您正苦于以下问题:C# Dev2JsonSerializer.Serialize方法的具体用法?C# Dev2JsonSerializer.Serialize怎么用?C# Dev2JsonSerializer.Serialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dev2JsonSerializer的用法示例。


在下文中一共展示了Dev2JsonSerializer.Serialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResourceTypeConvertor_ConvertToJson_EnumAsString_ExpectConvert

 public void ResourceTypeConvertor_ConvertToJson_EnumAsString_ExpectConvert()
 {
     //------------Setup for test--------------------------
     Dev2JsonSerializer serializer = new Dev2JsonSerializer();
     var data = serializer.Serialize(new ServerExplorerItem("a", Guid.Empty, ResourceType.DbService, null, Permissions.Administrator, "bob"));
     
     //------------Execute Test---------------------------
     Assert.IsTrue(data.Contains("DbService"));
     //------------Assert Results-------------------------
 }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:10,代码来源:ServerExplorerItemSerialisation.cs

示例2: ResourceTypeConvertor_ConvertToJson_EnumAsString_Deserialise_ExpectConvert_OldServer_IsServer

        public void ResourceTypeConvertor_ConvertToJson_EnumAsString_Deserialise_ExpectConvert_OldServer_IsServer()
        {
            //------------Setup for test--------------------------
            Dev2JsonSerializer serializer = new Dev2JsonSerializer();
            var data = serializer.Serialize(new ServerExplorerItem("a", Guid.Empty, ResourceType.DbService, null, Permissions.Administrator, "bob"));

            //------------Execute Test---------------------------
            Assert.IsTrue(data.Contains("DbService"));
            data = data.Replace(@"""ResourceType"": ""DbService""", @"""ResourceType"": ""1024""");
            var item = (ServerExplorerItem)serializer.Deserialize(data, typeof(ServerExplorerItem));
            Assert.AreEqual(ResourceType.Server, item.ResourceType);
            //------------Assert Results-------------------------
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:13,代码来源:ServerExplorerItemSerialisation.cs

示例3: RemoteDebugItemParser_Parse_WhenValidJsonList_ExpectItems

        // ReSharper disable InconsistentNaming
        public void RemoteDebugItemParser_Parse_WhenValidJsonList_ExpectItems()
        // ReSharper restore InconsistentNaming
        {
            //------------Setup for test--------------------------
            List<IDebugState> items = new List<IDebugState>
            {
                new DebugState {ActivityType = ActivityType.Workflow, ClientID = Guid.Empty, DisplayName = "DebugState"}
            };

            Dev2JsonSerializer serializer = new Dev2JsonSerializer();
            var data = serializer.Serialize(items);

            //------------Execute Test---------------------------
            var result = RemoteDebugItemParser.ParseItems(data);

            //------------Assert Results-------------------------
            Assert.AreEqual(1, result.Count);
            Assert.AreEqual("DebugState", result[0].DisplayName);
            Assert.AreEqual(ActivityType.Workflow, result[0].ActivityType);
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:21,代码来源:RemoteDebugItemParserTest.cs

示例4: Execute

        /// <summary>
        /// Executes the service
        /// </summary>
        /// <param name="values">The values.</param>
        /// <param name="theWorkspace">The workspace.</param>
        /// <returns></returns>
        public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
        {
            try
            {

          
            string directory = null;
            StringBuilder result = new StringBuilder();
            if(values == null)
            {
                throw new InvalidDataContractException("No parameter values provided.");
            }
            StringBuilder tmp;
            values.TryGetValue("Directory", out tmp);
            if(tmp != null)
            {
                directory = tmp.ToString();
            }
            if(String.IsNullOrEmpty(directory))
            {
                throw new InvalidDataContractException("No value provided for Directory parameter.");
            }
            Dev2Logger.Log.Info("Get Directories Relative to Server. "+directory);
            result.Append("<JSON>");
            var explorerItem = ServerExplorerRepo.Load(ResourceType.Folder, string.Empty);
            var jsonTreeNode = new JsonTreeNode(explorerItem);
            var serializer = new Dev2JsonSerializer();
            var directoryInfoAsJson = serializer.Serialize(jsonTreeNode);
            result.Append(directoryInfoAsJson);
            result.Append("</JSON>");
            return result;
            }
            catch (Exception e)
            {
                Dev2Logger.Log.Error(e);
                throw;
            }
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:44,代码来源:GetDirectoriesRelativeToServer.cs

示例5: SetupConnectionWithCompileMessageList

 static Mock<IEnvironmentConnection> SetupConnectionWithCompileMessageList(List<ICompileMessageTO> compileMessageTos, List<string> deps)
 {
     CompileMessageList compileMessageList = new CompileMessageList { MessageList = compileMessageTos, Dependants = deps };
     var jsonSer = new Dev2JsonSerializer();
     string serializeObject = jsonSer.Serialize(compileMessageList);
     var envConnection = new Mock<IEnvironmentConnection>();
     envConnection.Setup(e => e.IsConnected).Returns(true);
     envConnection.Setup(c => c.ServerEvents).Returns(new EventPublisher());
     envConnection.Setup(connection => connection.ExecuteCommand(It.IsAny<StringBuilder>(), It.IsAny<Guid>())).Returns(new StringBuilder(serializeObject));
     return envConnection;
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:11,代码来源:ServiceCallbackHandlerTests.cs


注:本文中的Dev2JsonSerializer.Serialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。