public void CreateObjectToJsonTest()
        {
            JsonSerializationMethods decorator = new JsonSerializationMethods();
            CodeMemberMethod         method    = decorator.CreateObjectToJson();

            Assert.IsNotNull(method);
            Assert.AreEqual(MemberAttributes.Public, method.Attributes);
            Assert.AreEqual(new CodeTypeReference(typeof(String)).BaseType, method.ReturnType.BaseType);
            Assert.AreEqual("SerializeObject", method.Name);
            Assert.IsNotNull(method.Parameters);
            Assert.AreEqual(1, method.Parameters.Count);
            Assert.AreEqual(new CodeTypeReference(typeof(object)).BaseType, method.Parameters[0].Type.BaseType);
            Assert.IsNotEmpty(method.Statements);
        }
        public void DecorateClassTest()
        {
            JsonSerializationMethods decorator = new JsonSerializationMethods();

            Assert.Throws(typeof(ArgumentNullException), () => decorator.DecorateClass(null, null));
            CodeTypeDeclaration declaration = new CodeTypeDeclaration("TestClass");

            decorator.DecorateClass(null, declaration);

            Assert.AreEqual(3, declaration.Members.Count);
            AssertContainsName(declaration.Members, "SerializeObject");
            AssertContainsName(declaration.Members, "DeserializeResponse");
            AssertContainsName(declaration.Members, "RegisterSerializer");
        }
        public void CreateJsonToObjectTest()
        {
            JsonSerializationMethods decorator = new JsonSerializationMethods();
            CodeMemberMethod         method    = decorator.CreateResponseToObject();

            Assert.IsNotNull(method);
            Assert.AreEqual(MemberAttributes.Public, method.Attributes);
            Assert.AreEqual("DeserializeResponse", method.Name);
            Assert.IsNotEmpty(method.TypeParameters);
            Assert.AreEqual(1, method.TypeParameters.Count);
            Assert.IsNotEmpty(method.Parameters);
            Assert.AreEqual(1, method.Parameters.Count);
            Assert.AreEqual(new CodeTypeReference(typeof(IResponse)).BaseType, method.Parameters[0].Type.BaseType);
            Assert.IsNotEmpty(method.Statements);
        }