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 16868, 18099 | 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, 16868, 18099 | 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 10550, 16402, 17894, 17895, 18099 | Leave a comment