public void GetStocksDictionary_AllInitializedStocks_VerifyEqualityByExpectedOutput() { var expected = new Dictionary <Coordinates, Stock> { { new Coordinates(3, 'D'), new Stock(new Product("Coca Cola 250ml", 30), 8) }, { new Coordinates(2, 'D'), new Stock(new Product("Sprite 250ml", 25), 6) }, { new Coordinates(0, 'A'), new Stock(new Product("Bake Rolls 150g", 35), 4) }, { new Coordinates(5, 'B'), new Stock(new Product("Snickers 50g", 20), 9) }, { new Coordinates(2, 'F'), new Stock(new Product("Evian 500ml", 30), 1) }, { new Coordinates(7, 'E'), new Stock(new Product("Bohemia Chips 25g", 25), 4) }, { new Coordinates(4, 'C'), new Stock(new Product("Twix 40g", 15), 0) }, { new Coordinates(7, 'F'), new Stock(new Product("Mattoni 250ml", 25), 5) } }; var dictionaryToCheck = controlUnit.GetStocksDictionary(); if (dictionaryToCheck == null || dictionaryToCheck.Count != expected.Count) { Assert.Fail("Dictionary to check is null or does not contain same amount of key value pairs as the expected one."); } foreach (var keyValuePair in expected) { if (!dictionaryToCheck.ContainsKey(keyValuePair.Key) || !dictionaryToCheck[keyValuePair.Key].Equals(keyValuePair.Value)) { var a = dictionaryToCheck[keyValuePair.Key]; var b = keyValuePair.Value; Assert.Fail($"Dictionary to check does not contain key {keyValuePair.Key} or value within this key ({keyValuePair.Value}) does not equal the expected one."); } } }