Do you have any more basic full examples of like how to go through
step by step on how to do like a full unit test? Like I still do not
get fully how mock objects work and how you use interfaces(I don't
fully get interfaces too and I really don't get how they all work with
unit testing) with them and all that stuff.
Like even your tutorial I have a hard time following what your doing.
First I am unsure why you have this
public class InvoiceSender and not this.
public class InvoiceSender : IEmailService
I thought you would have to implement the interface
Second
If you would have done it the way I thought you would then you would
have to implement the Interface method
public void Send(MailMessage msg)
{
throw new System.NotImplementedException();
}
Like that(I am not sure exactly what you would put in this method).
Yet you don't do this why?
Third
You have this
private readonly IEmailService emailService;
public InvoiceSender(IEmailService emailService)
{
this.emailService = emailService;
}
I am not sure what the private readoly IEmailSerivce declaration is
really for nor do I get why you are setting this all up in the
constructor(or even why you have the constructor) and where exactly
the code is that will pass in the parameter for the constructor.
In the SendInvoice I don't understand why your actually using
MailMessage like your not really sending the message or anything(hence
mocking?). So why could you just got something else there instead(I
dont' a random string or stuff). Since if I understand it right its
not like the what every you have will be returned since Send() is
Void.
I am trying to figure out from you stuff how I would do my asp.net
membership tests. I am using asp.net mvc and wrote my login stuff
instead of using the canned some in the examples. So currently I am
trying to test if my LoginView does the right stuff or not if the user
gets valiated.
So like I am using the asp.net membership ValidateUser() method. It
returns true or false depending on if they are validated. I have some
stuff in my view that does stuff(like goes to places depending on if
they where validated or not).
At first I was just going to test it again my DB and stuff but now I
found out that really does not work since Nunit or something can't
access my membership stuff.
So thats pushed up me learning mocking a bit faster. People recommend
that I use Rhino Mocks(at first I was going to try to do it without a
framework but figured might as well use it so I don' t have to relearn
lots of the stuff later).
So I am guessing I will need a interface or something that will have a
method that returns True(validated) or False(not validated) or
something like that.
I wish that I could use the debugger too and see how the code goes
through everything when be tested I think that would help but I am not
sure if this is also possible.
Thanks
On Jun 21, 6:29 pm, David Tchepak <[email protected]> wrote:
> As far as I know the wiki just has code snippets (i.e. not a full
> reference implementation with source code).
>
> You could try looking at some open source projects for real world
> usage (maybe pick one from here:http://teamcity.codebetter.com, just
> login as guest).
>
> If you want a trivial example (i.e. one test) I've posted one
> here:http://www.davesquared.net/2008/10/very-basics-of-aaa-with-rhino-mock...
> You can download the example and start extending it to try out some of
> the Rhino Mocks features mentioned in the wiki.
>
> Good luck.
> Regards,
> David
>
> On Sun, Jun 21, 2009 at 1:24 PM, chobo2<[email protected]> wrote:
>
> > Hi
>
> > I am new to Rhino and I am looking at this
> > pagehttp://ayende.com/Wiki/Rhino+Mocks+3.5.ashx
> > . I am wondering though where can I get the source I would like to see
> > this run and stuff.
>
> > I think it would help out alot.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---