July 2019
Intermediate to advanced
410 pages
10h 32m
English
With the changes to the InventoryContext class, we no longer have a convenient property for getting the only instance of the class. This means that InventoryContext.Instance will need to be replaced, and, as a first attempt, let's create a method to return a new instance of InventoryContext, and use GetInventoryContext() instead of InventoryContext.Instance:
private IInventoryContext GetInventoryContext(){ return new InventoryContext();}
As expected, the unit tests fail with an error message: The given key was not present in the dictionary:

As we saw in the previous chapter, this is because the InventoryContext list of books is ...
Read now
Unlock full access