示例#1
0
        public void CanSerializeIsADictionary()
        {
            var isADictionary = new MyIsADictionary(new Dictionary <object, object>
            {
                { "Key1", "value1" },
                { "Key2", "value2" },
            });

            this.AssertSerializesAndRoundTrips(isADictionary);
        }
        public void CanSerializeIsADictionary()
        {
            var isADictionary = new MyIsADictionary(new Dictionary <object, object>
            {
                { "Key1", "value1" },
                { "Key2", "value2" },
            });

            SerializationTestHelper.Object(isADictionary).RoundTrips(ExpectJson);
        }
        public void SerializesIsADictionaryRespectsDefaultFieldNameInferrer()
        {
            var isADictionary = new MyIsADictionary(new Dictionary <object, object>
            {
                { "Key1", "value1" }
            });

            var client = new ElasticClient(new ConnectionSettings().DefaultFieldNameInferrer(f => f.ToUpperInvariant()));

            client.RequestResponseSerializer.SerializeToString(isADictionary).Should().Be("{\"KEY1\":\"value1\"}");
        }
        public void SerializesIsADictionaryNullValues()
        {
            var isADictionary = new MyIsADictionary(new Dictionary <object, object>
            {
                { "Key1", null },
                { "Key2", "value2" },
            });

            var client = new ElasticClient();

            client.RequestResponseSerializer.SerializeToString(isADictionary).Should().Be("{\"key1\":null,\"key2\":\"value2\"}");
        }