Category Archives: 18099

WAQS and unit tests: Mock the database

7 reasons to use WAQS WAQS documentation   Unit testing implies without DB. Imagine that you wrote this two specification methods: public static bool HasOrderInLast120Days(string customerId, INorthwindWAQSEntities context){    return context.Orders.Any(o => o.CustomerId == customerId && (DateTime.Now – o.OrderDate).Days < 120);} public static Invoice MakeInvoice(this Order … Continue reading

Posted in 18099, 16868 | Leave a comment

WAQS and unit tests

7 reasons to use WAQS WAQS documentation   After writing your specifications code, it’s a good idea to test it. For this, WAQS can also help.   WAQS.Server.Mock First, we create a unit test project and we reference the server … Continue reading

Posted in 16402, 18099, 16868 | Leave a comment

How to unit test Roslyn Rewriter?

Yesterday, I wrote a SyntaxRewriter that adds null test on method body. So it could be very easy like this one: public int Foo1(OrderDetail od) {     return od.Product.Category.CategoryID; } That becomes: public int Foo1(OrderDetail od){    if (od == null || od.Product … Continue reading

Posted in 17895, 17894, 16402, 10550, 18099 | Leave a comment