Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test support #13

Open
hendryluk opened this issue Feb 9, 2015 · 1 comment
Open

Unit test support #13

hendryluk opened this issue Feb 9, 2015 · 1 comment

Comments

@hendryluk
Copy link
Owner

Example (with NUnit + NSubstitute)
Ref: http://jglue.org/cdi-unit-user-guide/#mocks

public class MyComponent
{
    [Inject] IDbSet<User> _users;
    [Inject] OtherComponent _otherStuff;
    public void DoSomething()
    {
    }
}

[CormoTest]
public class MyTest
{
    [Inject] MyComponent _component;
    [Produces, Mock] IDbSet <User> _users;

    [Test]
    public void Blah()
    {
        _component.DoSomething();
        _users.Received().Add(user);
    }
}
@hendryluk
Copy link
Owner Author

ok, perhaps xunit. For initial implementation I'll probably not even try to make it portable (e.g. nunit/xunit, nsubstitute/moq), I'll just pick xunit and nsubstitute.
Cdi-unit is portable (junit, testng, mockito, easymock).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant