public object InvalidCommand(string kommando)
        {
            List <IBefehl> alleBefehle = new List <IBefehl>();

            alleBefehle.Add(new DummyBefehl());

            var befehleMock = new Mock <IBefehleListe>();

            befehleMock.Setup(befehl => befehl.Befehle()).Returns(alleBefehle);
            IInterpreter interpreter = new EinfacherInterpreter(befehleMock.Object);

            return(interpreter.OperationFuer(kommando));
        }
        public void FindetOperation(string kommando, Type operationstyp)
        {
            List <IBefehl> alleBefehle = new List <IBefehl>();

            alleBefehle.Add(new DummyBefehl());

            var befehleMock = new Mock <IBefehleListe>();

            befehleMock.Setup(befehl => befehl.Befehle()).Returns(alleBefehle);

            IInterpreter interpreter = new EinfacherInterpreter(befehleMock.Object);

            Assert.That(interpreter.OperationFuer(kommando), Is.InstanceOf(operationstyp));
        }
Exemple #3
0
        public void FindetOperation(string kommando, Type operationstyp)
        {
            Interpreter interpreter = new EinfacherInterpreter();

            var operation = interpreter.OperationFuer(kommando);

            if (operation.GetType() == typeof(KombiOperation))
            {
                Assert.AreEqual(1, ((KombiOperation)operation).Operationen.Count(o => o.GetType() == operationstyp));
            }
            else
            {
                Assert.IsInstanceOfType(interpreter.OperationFuer(kommando), operationstyp);
            }
        }
        public void UnknownInput()
        {
            IInterpreter interpreter = new EinfacherInterpreter();

            Assert.DoesNotThrow(() => interpreter.OperationFuer(""));
        }
        public void FindetOperation(string kommando, Type operationstyp)
        {
            IInterpreter interpreter = new EinfacherInterpreter();

            Assert.That(interpreter.OperationFuer(kommando), Is.InstanceOf(operationstyp));
        }