示例#1
0
        public static void Execute()
        {
            var wrap = new SomeUnmockableObject {
                Dummy = 3
            }.Wrap();

            wrap.Execute(x => x.Foo()).Should().Be(3);
        }
示例#2
0
        public static async Task ExecuteAsync()
        {
            var wrap = new SomeUnmockableObject {
                Dummy = 9
            }.Wrap();
            var result = await wrap.Execute(x => x.FooAsync());

            result.Should().Be(9);
        }
示例#3
0
        public static void ExecuteAction()
        {
            var wrap = new SomeUnmockableObject().Wrap();

            wrap.Execute(x => x.Bar(10));

            wrap
            .Execute(x => x.Dummy)
            .Should()
            .Be(10);
        }
示例#4
0
        public static void CachingUnique()
        {
            const int i    = 6;
            var       wrap = new SomeUnmockableObject().Wrap();

            wrap.Execute(x => x.Foo(5)).Should().Be(5);
            wrap.Execute(x => x.Foo(3)).Should().Be(3);
            wrap.Execute(x => x.Foo(new Func <int>(() => 4)())).Should().Be(4);
            wrap.Execute(x => x.Foo(i)).Should().Be(6);

            for (var j = 0; j < 200; j++)
            {
                wrap.Execute(x => x.Foo(j)).Should().Be(j);
            }
        }