public void When_the_return_type_is_primitive_it_is_mapped_to_an_IEnumerable_of_DotNet_Primitives()
        {
            Init(model => model.Namespaces[0].Classes.First()
                 .Methods.Add(Method = Any.OdcmMethod(m =>
            {
                m.ReturnType   = new OdcmPrimitiveType("Stream", OdcmNamespace.Edm);
                m.IsCollection = IsCollection;
            })));

            _expectedReturnType = ReturnTypeGenerator(typeof(Microsoft.OData.Client.DataServiceStreamLink));

            _expectedMethodName = Method.Name + "Async";

            var methodInfos = new[]
            {
                FetcherInterface.GetMethod(_expectedMethodName),
                FetcherType.GetMethod(_expectedMethodName)
            };

            foreach (var methodInfo in methodInfos)
            {
                methodInfo.ReturnType
                .Should().Be(_expectedReturnType);
            }
        }
Example #2
0
        public void When_the_return_type_is_primitive_it_is_mapped_to_a_DotNet_Primitive()
        {
            Init(model => model.Namespaces[0].Classes.First()
                 .Methods.Add(_method = Any.OdcmMethod(m => m.ReturnType = new OdcmPrimitiveType("Stream", "Edm"))));

            _expectedReturnType = typeof(Task <>).MakeGenericType(typeof(Microsoft.OData.Client.DataServiceStreamLink));

            _expectedMethodName = _method.Name + "Async";

            var methodInfos = new[]
            {
                ConcreteInterface.GetMethod(_expectedMethodName),
                ConcreteType.GetMethod(_expectedMethodName),
                FetcherInterface.GetMethod(_expectedMethodName),
                FetcherType.GetMethod(_expectedMethodName)
            };

            foreach (var methodInfo in methodInfos)
            {
                methodInfo.ReturnType
                .Should().Be(_expectedReturnType);
            }
        }