public void CreateWithApiKeyTest() { var decorator = new CreateRequestMethodServiceDecorator(); CodeConditionStatement result = decorator.CreateWithApiKey(); Assert.IsNotNull(result); Assert.That(result.TrueStatements.Count, Is.EqualTo(1)); Assert.That(result.TrueStatements[0], Is.InstanceOf<CodeAssignStatement>()); Assert.That(result.FalseStatements.Count, Is.EqualTo(0)); }
public void TestGenerateCreateRequestMethod() { var decorator = new CreateRequestMethodServiceDecorator(); CodeMemberMethod method = decorator.GenerateCreateRequestMethod(); Assert.AreEqual(CreateRequestMethodServiceDecorator.CreateRequestMethodName, method.Name); Assert.AreEqual(2, method.Parameters.Count); Assert.AreEqual("System.String", method.Parameters[0].Type.BaseType); Assert.AreEqual("System.String", method.Parameters[1].Type.BaseType); Assert.AreEqual(typeof(IRequest).FullName, method.ReturnType.BaseType); }
public void TestDecorateClass() { IService service = CreateService(); var decorator = new CreateRequestMethodServiceDecorator(); var codeType = new CodeTypeDeclaration("TestClass"); var requiredDecorator = new StandardServiceFieldServiceDecorator(); requiredDecorator.DecorateClass(service, codeType); var anotherRequiredDecorator = new ApiKeyServiceDecorator(); anotherRequiredDecorator.DecorateClass(service, codeType); decorator.DecorateClass(service, codeType); CheckCompile(codeType, false, "Failed To Compile StandardExecuteMethodServiceDecorator"); }