public void CalculateSumsTest_MultiMenuMultiItemSomeLabel() { //Arrange Item testItem = new Item() {ID = 5, Label = "test"}; List<Item> testItems = new List<Item>() {testItem}; MenuNode testMenuNode = new MenuNode() {Items = testItems}; MenuRoot testMenuRoot = new MenuRoot {Menu = testMenuNode}; Item testItem2 = new Item() {ID = 10}; Item testItem3 = new Item() {ID = 15, Label = "test3"}; List<Item> testItems2 = new List<Item>() {testItem2, testItem3}; MenuNode testMenuNode2 = new MenuNode() {Items = testItems2}; MenuRoot testMenuRoot2 = new MenuRoot {Menu = testMenuNode2}; List<MenuRoot> fileContents = new List<MenuRoot> {testMenuRoot, testMenuRoot2}; //Act var actual = Program.CalculateSums(fileContents); //Assert var expected = 5; var expected2 = 15; var expectedCount = 2; Assert.AreEqual(expectedCount, actual.Count()); Assert.AreEqual(expected, actual.ElementAt(0)); Assert.AreEqual(expected2, actual.ElementAt(1)); }
public void CalculateSumsTest_SingleMenuEmptyItem() { //Arrange List<Item> testItems = new List<Item>(); MenuNode testMenuNode = new MenuNode() {Items = testItems}; MenuRoot testMenuRoot = new MenuRoot {Menu = testMenuNode}; List<MenuRoot> fileContents = new List<MenuRoot> {testMenuRoot}; //Act var actual = Program.CalculateSums(fileContents); //Assert var expected = 0; var expectedCount = 1; Assert.AreEqual(expectedCount, actual.Count()); Assert.AreEqual(expected, actual.ElementAt(0)); }
public void CalculateSumsTest_SingleMenuMultiItemLabel() { //Arrange Item testItem = new Item() {ID = 5, Label = "test"}; Item testItem2 = new Item() {ID = 10, Label = "test2"}; Item testItem3 = new Item() {ID = 15, Label = "test3"}; List<Item> testItems = new List<Item>() {testItem, testItem2, testItem3}; MenuNode testMenuNode = new MenuNode() {Items = testItems}; MenuRoot testMenuRoot = new MenuRoot {Menu = testMenuNode}; List<MenuRoot> fileContents = new List<MenuRoot> {testMenuRoot}; //Act var actual = Program.CalculateSums(fileContents); //Assert var expected = 30; var expectedCount = 1; Assert.AreEqual(expectedCount, actual.Count()); Assert.AreEqual(expected, actual.ElementAt(0)); }
public void CalculateSumsTest_SingleMenuNullItems() { //Arrange List<Item> testItems = null; MenuNode testMenuNode = new MenuNode() {Items = testItems}; MenuRoot testMenuRoot = new MenuRoot {Menu = testMenuNode}; List<MenuRoot> fileContents = new List<MenuRoot> {testMenuRoot}; //Act var actual = Program.CalculateSums(fileContents); //Assert Assert.IsTrue(!actual.Any()); }