TUnit
TUnit copied to clipboard
Migration from XUnit is painful.
Design which requires assert to be awaitable, make migration from XUnit or MSUnit or NUnit painful.
-
All tests now have to be
async Task
which is.. you know... lot of typing. -
That looks super strange to compare things in awaitable fashion.
Assert.Equal(new char[] { 'D' }, input.ВисокошвидкосніПрінтери);
vs
await Assert.That(new char[] { 'D' }).IsEqualTo(input.ВисокошвидкосніПрінтери);
- Same problem but with untyped new.
Assert.Equal(new("PRODUCT-NO", 'A'), input.Перший);
Assert.Equal(new("PRODUCT-NO", 'B'), input.Другий);
become
await Assert.That(new ПосиланняНаПоле("PRODUCT-NO", 'A')).IsEqualTo(input.Перший);
await Assert.That(new ПосиланняНаПоле("PRODUCT-NO", 'B')).IsEqualTo(input.Другий);
notice that I have to write type name.
- Other small details, is that you cannot use collection initializers in your asserts, thus require rewriting tests again.
Probably only XUnit related.
var input = Assert.IsType<Input>(операція);
become
await Assert.That(операція).IsTypeOf(typeof(Input));
var input = (Input)операція;
- Cannot compare
T
andT?
for simple types.
Assert.Equal((ushort)10, input.Більше);
become
await Assert.That((ushort?)10).IsEqualTo(input.Більше);
- Ooh. I just notice. You insist on having specific order of declaration
await Assert.That('A').IsEqualTo(input.ІсходнийФайл);
is invalid, since I have to rewrite like that.
await Assert.That(input.ІсходнийФайл).IsEqualTo('A');
which is understandable, but again. I have to retype a lot of code.
- I don't know what's going on, but when comparing arrays I cannot use
IsEqualsTo
and have to useIsEquivalentTo
which is not what I expect from other frameworks. - When I try to compare array of tuples, it does not work. Nor
IsEqualsTo
norIsEquivalentTo
works for me.
await Assert.That(input.ОписПереміщення).IsEquivalentTo(new (ПосиланняНаПоле ІсходнеПоле, ПосиланняНаПоле[] ЦільовіПоля)[] {
(new ПосиланняНаПоле("PRODUCT-NO", 'A'), [new ПосиланняНаПоле("PRODUCT-NO", 'W')]),
(new ПосиланняНаПоле("QUANTITY", 'A'), [new ПосиланняНаПоле("QUANTITY", 'W')]),
});
Summary
Overall I think migration process even for small set of 13 tests which I have , is very painful to my taste.