• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IFoo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IFoo的典型用法代码示例。如果您正苦于以下问题:C# IFoo类的具体用法?C# IFoo怎么用?C# IFoo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IFoo类属于命名空间,在下文中一共展示了IFoo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: BarWithMultipleParameters

 public BarWithMultipleParameters(IFoo parameter1, string parameter2, string parameter3, int parameter4)
 {
     Parameter1 = parameter1;
     Parameter2 = parameter2;
     Parameter3 = parameter3;
     Parameter4 = parameter4;
 }
开发者ID:ChristianEder,项目名称:Cherry,代码行数:7,代码来源:Bar.cs


示例2: MultipleCallbacks

        public static void MultipleCallbacks(
            IFoo fake,
            bool firstWasCalled,
            bool secondWasCalled,
            int returnValue)
        {
            "establish"
                .x(() => fake = A.Fake<IFoo>());

            "when configuring multiple callback"
                .x(() =>
                    {
                        A.CallTo(() => fake.Baz())
                            .Invokes(x => firstWasCalled = true)
                            .Invokes(x => secondWasCalled = true)
                            .Returns(10);

                        returnValue = fake.Baz();
                    });

            "it should call the first callback"
                .x(() => firstWasCalled.Should().BeTrue());

            "it should call the second callback"
                .x(() => secondWasCalled.Should().BeTrue());

            "it should return the configured value"
                .x(() => returnValue.Should().Be(10));
        }
开发者ID:bluePlayer,项目名称:FakeItEasy,代码行数:29,代码来源:ConfigurationSpecs.cs


示例3: RaiseTests

 public RaiseTests()
 {
     this.foo = A.Fake<IFoo>();
     this.foo.SomethingHappened += this.Foo_SomethingHappened;
     this.sender = null;
     this.eventArguments = null;
 }
开发者ID:bman61,项目名称:FakeItEasy,代码行数:7,代码来源:RaiseTests.cs


示例4: MatchingCallsWithMatches

        public static void MatchingCallsWithMatches(
            IFoo fake,
            IEnumerable<ICompletedFakeObjectCall> completedCalls,
            IEnumerable<ICompletedFakeObjectCall> matchedCalls)
        {
            "Given a Fake"
                .x(() => fake = A.Fake<IFoo>());

            "And I make several calls to the Fake"
                .x(() =>
                {
                    fake.AMethod();
                    fake.AnotherMethod();
                    fake.AnotherMethod("houseboat");
                });

            "And I use the static Fake class to get the calls made on the Fake"
                .x(() => completedCalls = Fake.GetCalls(fake));

            "When I use Matching to find calls to a method with a match"
                .x(() => matchedCalls = completedCalls.Matching<IFoo>(c => c.AnotherMethod("houseboat")));

            "Then it finds the matching call"
                .x(() => matchedCalls.Select(c => c.Method.Name).Should().Equal("AnotherMethod"));
        }
开发者ID:bman61,项目名称:FakeItEasy,代码行数:25,代码来源:FakeSpecs.cs


示例5: FakeWrapperConfiguratorTests

        public FakeWrapperConfiguratorTests()
        {
            this.faked = A.Fake<IFoo>();

            IFoo wrapped = A.Fake<IFoo>();
            this.wrapperConfigurator = new FakeWrapperConfigurator<IFoo>(A.Fake<IFakeOptions<IFoo>>(), wrapped);
        }
开发者ID:bman61,项目名称:FakeItEasy,代码行数:7,代码来源:FakeWrapperConfiguratorTests.cs


示例6: Serialize

        public static void Serialize(IFoo h)
        {
		Point  point1 = new Point (0, 1);
                Point? point2 = new Point (1, 2);
		h.Foo (ref point1);
                h.Foo (ref point2);
        }
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:gtest-283.cs


示例7: MultipleCallbacks

        public static void MultipleCallbacks(
            IFoo fake,
            bool firstWasCalled,
            bool secondWasCalled,
            int returnValue)
        {
            "Given a fake"
                .x(() => fake = A.Fake<IFoo>());

            "And I configure a method to invoke two actions and return a value"
                .x(() =>
                    A.CallTo(() => fake.Baz())
                        .Invokes(x => firstWasCalled = true)
                        .Invokes(x => secondWasCalled = true)
                        .Returns(10));

            "When I call the method"
                .x(() => returnValue = fake.Baz());

            "Then it calls the first callback"
                .x(() => firstWasCalled.Should().BeTrue());

            "And it calls the first callback"
                .x(() => secondWasCalled.Should().BeTrue());

            "And it returns the configured value"
                .x(() => returnValue.Should().Be(10));
        }
开发者ID:TimLovellSmith,项目名称:FakeItEasy,代码行数:28,代码来源:ConfigurationSpecs.cs


示例8: SetUp

 public void SetUp()
 {
     this.foo = A.Fake<IFoo>();
     this.foo.SomethingHappened += new EventHandler(this.Foo_SomethingHappened);
     this.sender = null;
     this.eventArguments = null;
 }
开发者ID:patrik-hagne,项目名称:FakeItEasy,代码行数:7,代码来源:RaiseTests.cs


示例9: MultistepOrderedAssertionsInOrder

        public static void MultistepOrderedAssertionsInOrder(
            IFoo fake,
            Exception exception,
            IOrderableCallAssertion lastAssertion)
        {
            "Given a Fake"
                .x(() => fake = A.Fake<IFoo>());

            "And a call on the Fake, passing argument 1"
                .x(() => fake.Bar(1));

            "And a call on the Fake, passing argument 2"
                .x(() => fake.Bar(2));

            "And a call on the Fake, passing argument 2"
                .x(() => fake.Bar(2));

            "And a call on the Fake, passing argument 3"
                .x(() => fake.Bar(3));

            "When I assert that a call with argument 1 was made exactly once"
                .x(() => lastAssertion = A.CallTo(() => fake.Bar(1)).MustHaveHappened(Repeated.Exactly.Once));

            "And then a call with argument 2"
                .x(() => lastAssertion = lastAssertion.Then(A.CallTo(() => fake.Bar(2)).MustHaveHappened()));

            "And then a call with argument 3 exactly once"
                .x(() => exception = Record.Exception(() => lastAssertion.Then(A.CallTo(() => fake.Bar(3)).MustHaveHappened(Repeated.Exactly.Once))));

            "Then the assertions should pass"
                .x(() => exception.Should().BeNull());
        }
开发者ID:bman61,项目名称:FakeItEasy,代码行数:32,代码来源:OrderedCallMatchingSpecs.cs


示例10: Run

 private double Run(IFoo foo)
 {
     double sum = 0;
     for (int i = 0; i < 1001; i++)
         sum += foo.Inc(0);
     return sum;
 }
开发者ID:omariom,项目名称:BenchmarkDotNet,代码行数:7,代码来源:Jit_InterfaceMethod.cs


示例11: Setup

        public void Setup()
        {
            this.faked = A.Fake<IFoo>();

            IFoo wrapped = A.Fake<IFoo>();
            this.wrapperConfigurator = new FakeWrapperConfigurator(wrapped);
        }
开发者ID:balarav,项目名称:FakeItEasy,代码行数:7,代码来源:FakeWrapperConfiguratorTests.cs


示例12: Setup

        public void Setup()
        {
            this.faked = A.Fake<IFoo>();

            IFoo wrapped = A.Fake<IFoo>();
            this.wrapperConfigurator = new FakeWrapperConfigurator<IFoo>(A.Fake<IFakeOptionsBuilder<IFoo>>(), wrapped);
        }
开发者ID:huoxudong125,项目名称:FakeItEasy,代码行数:7,代码来源:FakeWrapperConfiguratorTests.cs


示例13: Setup

 public void Setup()
 {
     this.foo = A.Fake<IFoo>();
     this.foo.SomethingHappened += this.Foo_SomethingHappened;
     this.sender = null;
     this.eventArguments = null;
 }
开发者ID:bluePlayer,项目名称:FakeItEasy,代码行数:7,代码来源:RaiseTests.cs


示例14: VoidMethodWithThrows

        public void VoidMethodWithThrows(
            IFoo foo,
            Action action,
            Exception exception)
        {
            "Given a fake"
                .x(() => foo = A.Fake<IFoo>());

            "And an action"
                .x(() => action = A.Fake<Action>());

            "When a void method is configured to invoke a delegate twice then throw an exception"
                .x(() =>
                    A.CallTo(() => foo.Bar()).Invokes(action).DoesNothing().Twice()
                        .Then.Throws<InvalidOperationException>());

            "And the method is called 3 times"
                .x(() =>
                {
                    foo.Bar();
                    foo.Bar();
                    exception = Record.Exception(() => foo.Bar());
                });

            "Then the delegate is invoked twice"
                .x(() => A.CallTo(() => action()).MustHaveHappened(Repeated.Exactly.Twice));

            "And the third call throws an exception"
                .x(() => exception.Should().BeAnExceptionOfType<InvalidOperationException>());
        }
开发者ID:adamralph,项目名称:FakeItEasy,代码行数:30,代码来源:ThenSpecs.cs


示例15: VoidMethodWithInvokes

        public void VoidMethodWithInvokes(
            IFoo foo,
            Action action1,
            Action action2)
        {
            "Given a fake"
                .x(() => foo = A.Fake<IFoo>());

            "And two delegates"
                .x(() =>
                {
                    action1 = A.Fake<Action>();
                    action2 = A.Fake<Action>();
                });

            "When a void method is configured to invoke a delegate once then invoke another delegate"
                .x(() =>
                    A.CallTo(() => foo.Bar()).Invokes(action1).DoesNothing().Once()
                        .Then.Invokes(action2));

            "And the method is called 3 times"
                .x(() =>
                {
                    foo.Bar();
                    foo.Bar();
                    foo.Bar();
                });

            "Then the first delegate is invoked once, and the second delegate is invoked twice"
                .x(() => A.CallTo(() => action1()).MustHaveHappened(Repeated.Exactly.Once)
                    .Then(A.CallTo(() => action2()).MustHaveHappened(Repeated.Exactly.Twice)));
        }
开发者ID:adamralph,项目名称:FakeItEasy,代码行数:32,代码来源:ThenSpecs.cs


示例16: Method1

        public static void Method1(GetString f, IFoo foo)
        {
            Console.WriteLine("Method1");

            Console.WriteLine("foo: " + foo.Invoke1("clr"));
            Console.WriteLine("GetString: " + f());
            Console.WriteLine("GetString: " + f());
            Console.WriteLine("GetString: " + f());
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:9,代码来源:Program.cs


示例17: Bastard

        public Bastard(IFoo foo)
        {
            if (foo == null)
            {
                throw new ArgumentNullException(nameof(foo));
            }

            this.foo = foo;
        }
开发者ID:ErikSchierboom,项目名称:AutoFixture,代码行数:9,代码来源:Bastard.cs


示例18: PingHub

        public PingHub(ILifetimeScope lifetimeScope)
        {
            // Create a lifetime scope for this hub instance.
            _hubLifetimeScope = lifetimeScope.BeginLifetimeScope();

            // Resolve the dependencies from the hub lifetime scope (unfortunately, service locator style).
            _bar = _hubLifetimeScope.Resolve<IBar>();
            _foo = _hubLifetimeScope.Resolve<IFoo>();
        }
开发者ID:FukKwang,项目名称:SignalRSamples,代码行数:9,代码来源:PingHub.cs


示例19: Context

        public override void Context()
        {
            _routerForSubstitute = mock<ICallRouter>();
                _substitute = mock<IFoo>();
                _context = mock<ISubstitutionContext>();

                _context.stub(x => x.GetCallRouterFor(_substitute)).Return(_routerForSubstitute);

                temporarilyChange(() => SubstitutionContext.Current).to(_context);
        }
开发者ID:rodrigoelp,项目名称:NSubstitute,代码行数:10,代码来源:ReceivedWithAnyArgsExtensionSpec.cs


示例20: FooBar

		public FooBar(IFoo f, IBar b)
		{
			if (f == null)
				throw new ArgumentNullException("f");
			if (b == null)
				throw new ArgumentNullException("b");

			Foo = f;
			Bar = b;
		}
开发者ID:Kingefosa,项目名称:Dynamo.IoC,代码行数:10,代码来源:Stubs.cs



注:本文中的IFoo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IFormFactory类代码示例发布时间:2022-05-24
下一篇:
C# IFont类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap