コード例 #1
0
        public void Should_Form_Order_Until_Error_Then_Stop()
        {
            var testMenu = new TestMenu1();
            string[] orderStrings = { testMenu.Name, "1", "2", "1", "3" };

            var testOrder = sut.FormOrder(orderStrings);

            NUnit.Framework.Assert.IsTrue(testOrder.ErrorOccurred);
            NUnit.Framework.Assert.That(testOrder.OrderedDishes[1].Count, Is.EqualTo(1));
            NUnit.Framework.Assert.That(testOrder.OrderedDishes[2].Count, Is.EqualTo(1));
            NUnit.Framework.Assert.IsFalse(testOrder.OrderedDishes.ContainsKey(3));
        }
コード例 #2
0
        public void Should_Not_Trim_WhiteSpace_For_Menu_Names()
        {
            var testMenu = new TestMenu1();
            string[] orderStrings = { testMenu.Name + " ", "1" };

            var testOrder = sut.FormOrder(orderStrings);

            NUnit.Framework.Assert.IsTrue(testOrder.ErrorOccurred);
            NUnit.Framework.Assert.That(testOrder.OrderedDishes.Count, Is.EqualTo(0));
        }
コード例 #3
0
        public void Should_Trim_WhiteSpace_For_OrderNumbers()
        {
            var testMenu = new TestMenu1();
            string[] orderStrings = { testMenu.Name, " 1   ", "2 ", "  3" };

            var testOrder = sut.FormOrder(orderStrings);

            NUnit.Framework.Assert.IsFalse(testOrder.ErrorOccurred);
            NUnit.Framework.Assert.That(testOrder.OrderedDishes[1].Name, Is.EqualTo(testMenu.MenuItems[1].Name));
            NUnit.Framework.Assert.That(testOrder.OrderedDishes[2].Name, Is.EqualTo(testMenu.MenuItems[2].Name));
            NUnit.Framework.Assert.That(testOrder.OrderedDishes[3].Name, Is.EqualTo(testMenu.MenuItems[3].Name));
        }
コード例 #4
0
        public void TestMenu1_Standard_Order_Should_Form_Valid_Order()
        {
            var testMenu = new TestMenu1();
            string[] orderStrings = {testMenu.Name, "1", "2", "3"};

            var testOrder = sut.FormOrder(orderStrings);

            NUnit.Framework.Assert.IsFalse(testOrder.ErrorOccurred);
            NUnit.Framework.Assert.That(testOrder.OrderedDishes[1].Name, Is.EqualTo(testMenu.MenuItems[1].Name));
            NUnit.Framework.Assert.That(testOrder.OrderedDishes[2].Name, Is.EqualTo(testMenu.MenuItems[2].Name));
            NUnit.Framework.Assert.That(testOrder.OrderedDishes[3].Name, Is.EqualTo(testMenu.MenuItems[3].Name));
        }
コード例 #5
0
        public void Should_Return_Error_Upon_Invalid_OrderNumber_String2()
        {
            var testMenu = new TestMenu1();
            string[] orderStrings = { testMenu.Name, "1.0" };

            var testOrder = sut.FormOrder(orderStrings);

            NUnit.Framework.Assert.IsTrue(testOrder.ErrorOccurred);
            NUnit.Framework.Assert.IsFalse(testOrder.OrderedDishes.ContainsKey(1));
        }