public override FunctionTable ShallowCopy()
        {
            FunctionTable table = base.ShallowCopy();

            table.AddFunction("rand", new Rand());
            return(table);
        }
    public void ShouldAddFunctionWithType()
    {
      FunctionTable table = new FunctionTable();
      table.AddFunction("test", typeof(TestFunction));

      Assert.AreEqual<int>(1, table.Count());
      Assert.IsTrue(table.Contains("test"));
      Assert.AreEqual<string>("test", table.First().Key);
      Assert.AreEqual<Type>(typeof(TestFunction), table.First().Value);
    }
Beispiel #3
0
        public void ShouldAddFunctionWithType()
        {
            FunctionTable table = new FunctionTable();

            table.AddFunction("test", typeof(TestFunction));

            Assert.AreEqual <int>(1, table.Count());
            Assert.IsTrue(table.Contains("test"));
            Assert.AreEqual <string>("test", table.First().Key);
            Assert.AreEqual <Type>(typeof(TestFunction), table.First().Value);
        }
Beispiel #4
0
        public void ShouldAddFunctionWithType()
        {
            FunctionTable table = new FunctionTable();

            table.AddFunction("test", typeof(TestFunction));

            Assert.Single(table);
            Assert.True(table.Contains("test"));
            Assert.Equal("test", table.First().Key);
            Assert.Equal(typeof(TestFunction), table.First().Value);
        }
Beispiel #5
0
        public void ShouldReturnEnumerator()
        {
            FunctionTable table = new FunctionTable();

            table.AddFunction <TestFunction>("test");

            int count = 0;

            IEnumerator enumerator = ((IEnumerable)table).GetEnumerator();

            while (enumerator.MoveNext())
            {
                count++;
            }

            Assert.AreEqual <int>(1, count);
        }
    public void ShouldReturnEnumerator()
    {
      FunctionTable table = new FunctionTable();
      table.AddFunction<TestFunction>("test");

      int count = 0;
      
      IEnumerator enumerator = ((IEnumerable)table).GetEnumerator();
      while (enumerator.MoveNext()) count++;

      Assert.AreEqual<int>(1, count);
    }