当前位置: 首页>>代码示例>>C#>>正文


C# IFoo类代码示例

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


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


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