[Then(@"the order details should match the following:")] public void ThenTheOrderDetailsShouldMatchTheFollowing(Table expectedOrderDetails) { var actualOrder = OrderService.GetOrder(); expectedOrderDetails.CompareToInstance(actualOrder); }
[Then(@"the customer details should be:")] public void ThenTheCustomerDetailsShouldBe(Table expectedCustomerDetails) { var actualCustomer = CustomerService.GetCustomer(); expectedCustomerDetails.CompareToInstance(actualCustomer, ignoreUnmatchedProperties: true); }In this example, we compare the data in the `expectedCustomerDetails` table with an `actualCustomer` object returned from the `CustomerService`. The `ignoreUnmatchedProperties` parameter is set to `true`, which means that any additional properties in the `actualCustomer` object will be ignored and not cause the test to fail. The `CompareToInstance` method is part of the `TechTalk.SpecFlow.Assist` namespace, which is included in the TechTalk.SpecFlow package.