Пример #1
0
        public void ComplexResponseTypeShouldHaveFieldsWithAttributes()
        {
            InterfaceSchema schema = new InterfaceSchema(typeof(IHasReturnType));

            schema.Methods.First().Response.Fields.Length.ShouldBe(2);
            (schema.Methods.First().Response.Fields.First().Attributes.Single().Attribute is JsonPropertyAttribute).ShouldBeTrue();
        }
Пример #2
0
        public void RequestParamShouldBeWithoutAttribute(Type type)
        {
            InterfaceSchema schema = new InterfaceSchema(type);

            foreach (var parameter in schema.Methods.First().Parameters)
            {
                parameter.Attributes.ShouldBeEmpty();
            }
        }
Пример #3
0
        public void ShouldHendleRevocable()
        {
            InterfaceSchema schema = new InterfaceSchema(typeof(IHasRevocableReturn));

            schema.Methods.First().Response.Fields.Length.ShouldBe(2);
            InterfaceSchema schema2 = new InterfaceSchema(typeof(IHasReturnType));

            schema2.Methods.First().IsRevocable.ShouldNotBe(schema.Methods.First().IsRevocable);
        }
Пример #4
0
        public void ReqestParamWithComplexObjectShouldHaveAttrbute(Type type)
        {
            InterfaceSchema schema = new InterfaceSchema(type);

            schema.Methods.First().Parameters.First().Fields.First().Attributes.Length.ShouldBe(1);
        }
Пример #5
0
        public void ResponseShouldBeNullForMethodWithoutResponseType()
        {
            InterfaceSchema schema = new InterfaceSchema(typeof(INoRetrunObject));

            schema.Methods.First().Response.ShouldBeNull();
        }
Пример #6
0
        public void MethodShouldHaveOneParam(Type type)
        {
            InterfaceSchema schema = new InterfaceSchema(type);

            schema.Methods.First().Parameters.Length.ShouldBe(1);
        }
Пример #7
0
        public void SimpleResponseTypeShouldNotHaveFields(Type type)
        {
            InterfaceSchema schema = new InterfaceSchema(type);

            schema.Methods.First().Response.Fields.ShouldBeNull();
        }