AAA Syntax does not use Record()/Play()

// Arrange
var view = MockRepository.GenerateStub<IView>();
view.Stub(v => v.Ask(Arg<string>.IsAny, Arg<string>.IsAny)).Return
(null);

// Act
var result = view.Ask("1", null);

// Assert
Assert.That(result, Is.Null);

... but, the only thing about this test is  .... it's only testing the
Mocking Framework (or is that the intention here?).

The test reads ...

// Arrange
Mocking framework generate a mock of the IView interface please.
Mocking framework, when I invoke IView.Ask(string, string), please pay
not attention to the values of the call, and give me a return value of
null

// Act.
Mocking framework, here's that method call I told you about

// Assert
Unit testing framework, please tell me if the Mocking framework gave
me a return value of null

On Dec 6, 9:25 pm, Fabien Arcellier <[email protected]>
wrote:
> Hello,
>
> I have rewritten every exemple in the documentation exemple by using
> AAA syntax (arrange, act, assert).
> There is one things I don't understand.
>
> What is the difference between the t.Stub<> and t.Expect<> ?
>
> According to the documentation comments in RhinoMocksExtention.cs,
> Stub doesn't create any expectation.
>
> What does it means ?
> Do you have an article to detail what is the expectation contest ?
>
> One exemple to illustrate my question with Expect :
>
>         [Test]
>         public void setReturnValueWhateverArguments_AAA()
>         {
>             //Assert
>             this.view.Replay();
>             this.view.Expect(v => v.Ask(null, null)).Return
> (null).IgnoreArguments();
>
>             //Act
>             object obj = this.view.Ask("1", null);
>
>             //Assert
>             Assert.AreEqual(null, obj);
>             this.view.VerifyAllExpectations();
>         }
>
> One exemple to illustrate my question with Stub:
>
>         [Test]
>         public void setReturnValueWhateverArguments_AAA()
>         {
>             //Assert
>             this.view.Replay();
>             this.view.Stub(v => v.Ask(null, null)).Return
> (null).IgnoreArguments();
>
>             //Act
>             object obj = this.view.Ask("1", null);
>
>             //Assert
>             Assert.AreEqual(null, obj);
>             this.view.VerifyAllExpectations();//I think this line is
> not important in this case
>         }
>
> Is there any difference on the interpretation ?
>
> Do you have any article about this topic ?
>
> Regards,
> Fabien Arcellier

--

You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rhinomocks?hl=en.


Reply via email to