public void TestClassInitialize()
        {
            // Create an instance of JiraRestClient to cause all static constructors in JIRC to be executed.
            // We need this so that JsonDataContractDeserializer will call JIRC's custom parsing handlers when parsing Issue from string.
            var client = JiraRestClientFactory.CreateWithBasicHttpAuth(
                new Uri("http://mock"),
                "mock",
                "mock");

            // Register a converter for custom Issue field type.
            Func <string, object> customTypeParser = (string json) =>
            {
                JsonObject parsed = JsonObject.Parse(json);

                CustomType custom = new CustomType();
                custom.CustomStringProperty = parsed["customstring"];
                custom.CustomIntProperty    = int.Parse(parsed["customint"]);

                return(custom);
            };

            Func <object, string> customTypeSerializer = (object obj) =>
            {
                JsonObject serialized = new JsonObject();
                serialized.Add("customstring", (obj as CustomType).CustomStringProperty);
                serialized.Add("customint", (obj as CustomType).CustomIntProperty.ToString());

                return(serialized.ToJson());
            };

            CustomFieldTypes.Register(TestRegisteredCustomFieldName, customTypeParser, customTypeSerializer);
        }
 public void TestRegisterConverterForInvalidFieldName()
 {
     CustomFieldTypes.Register("myfield", (string json) => { return(new CustomType()); }, (object obj) => { return(string.Empty); });
 }
 public void TestRegisterNullConverter()
 {
     CustomFieldTypes.Register("customfield_another", null, null);
 }