public void AddIsMethodResultTest()
        {
            var dic     = new Dictionary <JsonSchema, SchemaImplementationDetails>();
            var schema  = new JsonSchema();
            var service = new MockService();

            service.Schemas.Add("TestSchema", new MockSchema()
            {
                SchemaDetails = schema
            });
            var method = new MockMethod()
            {
                ResponseType = "TestSchema"
            };

            // Test parameter validation:
            Assert.Throws <ArgumentNullException>(
                () => ImplementationDetailsGenerator.AddIsMethodResult(null, service, method));
            Assert.Throws <ArgumentNullException>(
                () => ImplementationDetailsGenerator.AddIsMethodResult(dic, null, method));
            Assert.Throws <ArgumentNullException>(
                () => ImplementationDetailsGenerator.AddIsMethodResult(dic, service, (IMethod)null));

            // Test single add:
            ImplementationDetailsGenerator.AddIsMethodResult(dic, service, method);
            Assert.AreEqual(dic.Count, 1);

            var implDetails = dic[schema];

            Assert.IsTrue(implDetails.IsMethodResult);
        }
        public void AddIsMethodResultRecursionTest()
        {
            var dic    = new Dictionary <JsonSchema, SchemaImplementationDetails>();
            var schema = new JsonSchema();

            var method = new MockMethod()
            {
                ResponseType = "TestSchema"
            };

            var subresource = new MockResource();

            subresource.Methods.Add("TestMethod", method);

            var resource = new MockResource();

            resource.Resources.Add("Subresource", subresource);

            var service = new MockService();

            service.Schemas.Add("TestSchema", new MockSchema {
                SchemaDetails = schema
            });
            service.Resources.Add("TestResource", resource);

            // Test parameter validation:
            Assert.Throws <ArgumentNullException>(
                () => ImplementationDetailsGenerator.AddIsMethodResult(null, service, service.Resources.Values));
            Assert.Throws <ArgumentNullException>(
                () => ImplementationDetailsGenerator.AddIsMethodResult(dic, null, service.Resources.Values));
            Assert.Throws <ArgumentNullException>(
                () => ImplementationDetailsGenerator.AddIsMethodResult(dic, service, (IEnumerable <IResource>)null));

            // Test recursive add:
            ImplementationDetailsGenerator.AddIsMethodResult(dic, service, service.Resources.Values);
            Assert.AreEqual(dic.Count, 1);

            var implDetails = dic[schema];

            Assert.IsTrue(implDetails.IsMethodResult);
        }