public void ExecuteImportFromCommand()
        {
            ImportFromCommand importcmd = new ImportFromCommand("setvars", new string[] { "one", "two" });

            Machine machine = new Machine();

            importcmd.Execute(machine.Environment);

            Assert.AreEqual(1, machine.Environment.GetValue("one"));
            Assert.AreEqual(2, machine.Environment.GetValue("two"));
        }
        public void ImportFileTypeFromSystemIONamespace()
        {
            ImportFromCommand importcmd = new ImportFromCommand("System.IO", new string[] { "File" });

            Machine machine = new Machine();

            importcmd.Execute(machine.Environment);

            var result = machine.Environment.GetValue("File");

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(Type));
        }
        public void RaiseWhenImportFromModuleDoesNotExist()
        {
            ImportFromCommand importcmd = new ImportFromCommand("spam");

            Machine machine = new Machine();

            try
            {
                importcmd.Execute(machine.Environment);
                Assert.Fail("Exception expected");
            }
            catch (Exception ex)
            {
                Assert.IsInstanceOfType(ex, typeof(ImportError));
                Assert.AreEqual("No module named spam", ex.Message);
            }
        }