Here is question about context injection in specflow. I have class with my entity:
public class OrderInfo
{
public string Status { get; set; }
public string OrderName { get; set; }
}
In another class I'm using this entity to create new order:
[Binding]
public class OrderSteps
{
private NgWebDriver driver;
private OrderInfo orderInfo = new OrderInfo();
public OrderSteps(NgWebDriver driver,OrderInfo orderInfo)
{
this.orderInfo = orderInfo;
this.driver = driver;
}
[When(@"I am creating new order")]
public void WhenIAmCreatingNewOrder(Table table)
{
var orderListPage = new OrdersListPage(driver);
orderInfo = orderListPage.CreateNewOrder(table.CreateInstance<OrderInfo>());
}
}
In this class my method returns some data that is stored in 'orderInfo' object. Everything is okay till I needed to use data from that object in another class. I'm trying to get my object data, but it's empty inside....
[Binding]
public class BuyerPortalSteps
{
private NgWebDriver driver;
private OrderInfo orderInfo;
public BuyerPortalSteps(NgWebDriver driver, OrderInfo orderInfo)
{
this.driver = driver;
this.orderInfo = orderInfo;
}
}
So the question is: how to use data in the second class from the object that has been filled with data of the first class