Best way to do TDD and CSLA
Asked Answered
M

1

7

I would like to know what tools, patterns, etc people have used to be able to do TDD with CSLA .NET 3.8 and higher.

Which parts pose the most effort. Are there parts that are completely untested, etc.

Any and all information is most welcome.

Thanks

Marcellus answered 30/8, 2011 at 14:16 Comment(0)
E
5

I use a combination of SpecFlow with xUnit to test my CSLA business objects. SpecFlow with xUnit are used to define and test the user scenarios (think: functional/acceptance testing), and xUnit alone is used to test individual classes and combinations of such.

Dependencies within the CSLA classes, such as data-access, are injected via a container. Such dependencies can and often are mocked for unit testing.

The test client and our remote Data Portal have separate containers loaded with the correct dependencies. If a test needs to mock any of the Data Portal dependencies we have a special CSLA Command that is executed (via xUnit BeforeAfterTestAttribute) on the Data Portal and replaces standard dependencies with our mocked dependencies. When the tests complete the Command is executed again to put the standard dependencies back into the container.

I hope some of this helps.

Elveraelves answered 11/11, 2011 at 15:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.