Пример #1
0
        public async Task OperationContext()
        {
            var stub   = server.CreateStub <IOperationContextTest>();
            var result = await stub.HttpContextTestAsync("test");

            Assert.Equal("test", result);
        }
Пример #2
0
        public async Task EnumParameter()
        {
            var stub = server.CreateStub <IEnumParameterTest>();
            await stub.EnumParameterTestAsync(MyEnum.b);

            await stub.EnumFlagParameterTestAsync(MyEnumFlag.f);
        }
Пример #3
0
        public async Task NullableParameter()
        {
            var stub = server.CreateStub <INullableParameterTest>();

            await stub.NullableParameterTest1Async(
                "myString",
                sbyte.MaxValue,
                byte.MaxValue,
                short.MaxValue,
                int.MaxValue,
                long.MaxValue,
                ushort.MaxValue,
                uint.MaxValue,
                ulong.MaxValue,
                float.MaxValue,
                double.MaxValue,
                decimal.MaxValue,
                true,
                new DateTime(2000, 1, 1).ToUniversalTime(),
                DateTimeOffset.MaxValue,
                new TimeSpan(1, 1, 1, 1, 1),
                'c'
                );

            await stub.NullableParameterTest2Async(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);

            await stub.NullableParameterTest3Async();
        }
Пример #4
0
        public async Task ValueTupleParameter()
        {
            var stub = server.CreateStub <IValueTupleParameterTest>();
            await stub.ValueTupleParameterTestAsync((a : 1, (b : 2, c : 3)));

            await stub.ValueTupleParameterTest2Async((4, 5));
        }
Пример #5
0
        public async Task BasicParameter()
        {
            var stub   = server.CreateStub <IBasicParameterTest>();
            var result = await stub.BasicParameterAsync(
                "myString",
                sbyte.MaxValue,
                byte.MaxValue,
                short.MaxValue,
                int.MaxValue,
                long.MaxValue,
                ushort.MaxValue,
                uint.MaxValue,
                ulong.MaxValue,
                float.MaxValue,
                double.MaxValue,
                decimal.MaxValue,
                true,
                new DateTime(2000, 1, 1).ToUniversalTime(),
                DateTimeOffset.MaxValue,
                new TimeSpan(1, 1, 1, 1, 1),
                'c',
                new string[] { "abc", "edf" },
                new sbyte[] { sbyte.MinValue, sbyte.MaxValue },
                new byte[] { byte.MinValue, byte.MaxValue },
                new short[] { short.MinValue, short.MinValue },
                new int[] { int.MinValue, int.MaxValue },
                new long[] { long.MinValue, long.MaxValue },
                new ushort[] { ushort.MinValue, ushort.MaxValue },
                new uint[] { uint.MinValue, uint.MaxValue },
                new ulong[] { ulong.MinValue, ulong.MaxValue },
                new float[] { float.MinValue, float.MaxValue },
                new double[] { double.MinValue, double.MaxValue },
                new decimal[] { decimal.MinValue, decimal.MaxValue },
                new bool[] { true, false },
                new DateTime[] { new DateTime(2017, 1, 1).ToUniversalTime(), new DateTime(2017, 1, 2).ToUniversalTime() },
                new DateTimeOffset[] { DateTimeOffset.MinValue, DateTimeOffset.MaxValue },
                new TimeSpan[] { new TimeSpan(1, 1, 1, 1, 1), new TimeSpan(2, 2, 2, 2, 2) },
                "char".ToCharArray()
                );

            await stub.BasicParameterDefaultAsync();
        }