public static void CallsBaseMethodAndDoesNothingAppliedToSameACallTo( BaseClass fake, IVoidArgumentValidationConfiguration callToDoSomething, Exception exception) { "Given a fake" .x(() => fake = A.Fake<BaseClass>()); "And I identify a method to configure" .x(() => callToDoSomething = A.CallTo(() => fake.DoSomething())); "And I configure the method to call the base method" .x(() => callToDoSomething.CallsBaseMethod()); "And I configure the method to do nothing" .x(() => exception = Record.Exception(() => callToDoSomething.DoesNothing())); "Then it throws an invalid operation exception" .x(() => exception.Should().BeAnExceptionOfType<InvalidOperationException>()); }
public static void CallsToVoidMethodCallsBaseMethodAndDoesNothingAppliedToSameCallsTo( Fake<AClass> fake, IVoidArgumentValidationConfiguration callToVoidMethod, Exception exception) { "Given a strict unnatural fake" .x(() => fake = new Fake<AClass>(options => options.Strict())); "And I identify a void method to configure" .x(() => callToVoidMethod = fake.CallsTo(f => f.VoidMethod())); "And I configure the method to call the base method" .x(() => callToVoidMethod.CallsBaseMethod()); "And I configure the method to do nothing using the same call specifier" .x(() => exception = Record.Exception(() => callToVoidMethod.DoesNothing())); "Then it throws an invalid operation exception" .x(() => exception.Should().BeAnExceptionOfType<InvalidOperationException>()); }
public static void DoesNothingAndThrowsAppliedToSameACallTo( IFoo fake, IVoidArgumentValidationConfiguration callToBar, Exception exception) { "Given a fake" .x(() => fake = A.Fake<IFoo>()); "And I identify a method to configure" .x(() => callToBar = A.CallTo(() => fake.Bar())); "And I configure the method to do nothing" .x(() => callToBar.DoesNothing()); "When I configure the method to throw an exception" .x(() => exception = Record.Exception(() => callToBar.Throws<Exception>())); "Then it throws an invalid operation exception" .x(() => exception.Should().BeAnExceptionOfType<InvalidOperationException>()); }
public FakeItEasyMethodCallOccurance(IVoidArgumentValidationConfiguration configuration) { _configuration = configuration; _configuration.MustHaveHappened(); }