NUnit Example Test Case - NUnit Tutorial - DotNetPattern.com
www.dotnetpattern.com › nunit-example-test-caseFirst NUnit Test Case Example. [TestCase] public void When_PremiumCustomer_Expect_10PercentDiscount() { //Arrange Customer premiumCustomer = new Customer { CustomerId = 1, CustomerName = "George", CustomerType = CustomerType.Premium }; Order order = new Order { OrderId = 1, ProductId = 212, ProductQuantity = 1, Amount = 150 }; CustomerOrderService customerOrderService = new CustomerOrderService(); //Act customerOrderService.ApplyDiscount(premiumCustomer, order); //Assert Assert.AreEqual(order.
Test | NUnit Docs
docs.nunit.org › articles › nunitAsync test methods must return Task if no value is returned, or Task<T> if a value of type T is returned. If the programmer marks a test method that does not have the correct signature it will be considered as not runnable. If the test method returns a value, you must pass in the ExpectedResult named parameter to the Test attribute. This expected return value will be checked for equality with the return value of the test method.