ENع
الدرس 22 · Advanced .NET

Unit testing

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

A unit test is a small method that calls one piece of code with known inputs and checks the result by itself. Follow one xUnit test through dotnet test: it arranges qty = 10 and price = 5, acts by calling Cart.Total, and asserts that the total is 45. A bug (qty > 10 instead of >= 10) returns 50, the Assert throws and the test goes red; after a one-character fix the same test goes green.

14 دقيقة10 خطوات5 أسئلةAdvanced
شكل 22 · تفاعلي
جارٍ تحميل الرسم…
أو ← →

اختبار يتاح بعد الخطوة الأخيرة.