예제 #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);
            }
        }