Index: Src/GoogleApis.Tools.CodeGen.Tests/Decorator/ResourceDecorator/RequestDecorator/ParameterPropertyDecoratorTest.cs
===================================================================
deleted file mode 100644
--- a/Src/GoogleApis.Tools.CodeGen.Tests/Decorator/ResourceDecorator/RequestDecorator/ParameterPropertyDecoratorTest.cs
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
-Copyright 2011 Google Inc
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-using System.CodeDom;
-using System.Collections.Generic;
-using System.Linq;
-
-using NUnit.Framework;
-
-using Google.Apis.Discovery;
-using Google.Apis.Json;
-using Google.Apis.Testing;
-using Google.Apis.Tools.CodeGen.Decorator.ResourceDecorator.RequestDecorator;
-using Google.Apis.Util;
-
-
-namespace Google.Apis.Tools.CodeGen.Tests.Decorator.ResourceDecorator.RequestDecorator
-{
- /// Tests for the ParameterPropertyDecorator class.
- [TestFixture]
- public class ParameterPropertyDecoratorTest
- {
- /// Tests the constructor of this decorator.
- [Test]
- public void ConstructTest()
- {
- Assert.DoesNotThrow(() => new ParameterPropertyDecorator());
- }
-
- /// Tests the DecorateClass method.
- [Test]
- public void DecorateClassTest()
- {
- var method = new MockMethod()
- {
- Name = "Method",
- Parameters =
- new Dictionary()
- };
- method.Parameters.Add("Param", new MockParameter() { Name = "Param" });
- method.Parameters.Add("Param2", new MockParameter() { Name = "Param2" });
- var resource = new MockResource();
- resource.Methods.Add("Method", method);
- var resourceDecl = new CodeTypeDeclaration();
- var requestDecl = new CodeTypeDeclaration();
-
- // Confirm that the decorator adds the two parameters as properties with a backing field each.
- var decorator = new ParameterPropertyDecorator();
- decorator.DecorateClass(resource, method, requestDecl, resourceDecl);
- Assert.AreEqual(4, requestDecl.Members.Count); // 2 properties + 2 field.
- Assert.AreEqual(0, resourceDecl.Members.Count);
- }
-
- /// Tests the GenerateParameterProperty method.
- [Test]
- public void GenerateParameterPropertyTest()
- {
- var parameter = new MockParameter() { Name = "Param" };
- var method = new MockMethod()
- {
- Name = "Method",
- Parameters = new Dictionary()
- };
- method.Parameters.Add("Param", parameter);
- var resource = new MockResource();
- resource.Methods.Add("Method", method);
- var resourceDecl = new CodeTypeDeclaration();
-
- // Confirm that two properties and two fields are generated.
- var decorator = new ParameterPropertyDecorator();
- CodeTypeMemberCollection newMembers = decorator.GenerateParameterProperty(
- parameter, method, resourceDecl, Enumerable.Empty());
- Assert.AreEqual(2, newMembers.Count); // Property + field.
- Assert.AreEqual(0, resourceDecl.Members.Count);
-
- // Check the generated property.
- Assert.IsInstanceOf(newMembers[0]);
-
- CodeMemberProperty property = (CodeMemberProperty)newMembers[1];
- Assert.AreEqual("Param", property.Name);
-
- // Check that the property has a Key attribute.
- Assert.AreEqual(1, property.CustomAttributes.Count);
- Assert.AreEqual(
- typeof(RequestParameterAttribute).FullName, property.CustomAttributes[0].AttributeType.BaseType);
- Assert.AreEqual(
- "Param", ((CodePrimitiveExpression)property.CustomAttributes[0].Arguments[0].Value).Value);
- }
-
- ///
- /// Tests the GenerateParameterProperty method.
- ///
- [Test]
- public void GenerateCommonParameterPropertyTest()
- {
- var method = new MockMethod()
- {
- Name = "Method",
- Parameters = new Dictionary()
- };
- var resource = new MockResource();
- resource.Methods.Add("Method", method);
- var resourceDecl = new CodeTypeDeclaration();
- var requestDecl = new CodeTypeDeclaration();
-
- #region Create common Parameters
- IDictionary commonParameters = new Dictionary();
- var dict = new JsonDictionary {
- { "name", "alt" }, { "location", "query" }, { "type", "string" }, { "default", "json" } };
- var p = ServiceFactory.Default.CreateParameter("alt", dict);
- commonParameters["alt"] = p;
- #endregion
-
- // Confirm that two properties and two fields are generated.
- var decorator = new CommonParameterRequestDecorator(commonParameters);
- decorator.DecorateClass(resource, method, requestDecl, resourceDecl);
-
- Assert.AreEqual(2, requestDecl.Members.Count); // Property + field.
- Assert.AreEqual(0, resourceDecl.Members.Count);
-
- CodeTypeMemberCollection newMembers = requestDecl.Members;
-
- // Check the generated field.
- Assert.IsInstanceOf(newMembers[0]);
- Assert.AreEqual("_alt", newMembers[0].Name);
-
- // Check the generated property.
- Assert.IsInstanceOf(newMembers[1]);
- CodeMemberProperty property = (CodeMemberProperty)newMembers[1];
- Assert.AreEqual("Alt", property.Name);
-
- // Check that the property has a Key attribute.
- Assert.AreEqual(1, property.CustomAttributes.Count);
- Assert.AreEqual(
- typeof(RequestParameterAttribute).FullName, property.CustomAttributes[0].AttributeType.BaseType);
- Assert.AreEqual(
- "alt", ((CodePrimitiveExpression)property.CustomAttributes[0].Arguments[0].Value).Value);
- }
- }
-}