One of the issues with mocking Session – once you’ve got past the issue of mocking HttpContext – is how to moq indexed property access, which Moq doesn’t quite do neatly yet.
Your answer is How to Moq Setting an Indexed property, as in:
MockSession.SetupSet( x => x["MyKey"]=null).Verifiable();
var description = new StringBuilder("");
foreach (var item in productItems.Where(x => x.ItemType == type))
description.Append(item.Description + ", ");
return description.Remove(description.Length - 2, 2).ToString();
return string.Join(", ", productItems.Where(x => x.ItemType == type).Select(x => x.Description).ToArray());
because the first example fails when your collection has no elements.
A one man show by Roger llewellyn is possibly the most impressive one man show you’ll see anytime soon. Half a dozen characters interact and by the interval you face the puzzle of how exactly the relationship between Arthur Conan Doyle and his creations can work out. And whereas this kind of frame-breaking has been with us for a long time, this is the first time I’ve seen it done convincingly.