Exemplo n.º 1
0
        public override FunctionTable ShallowCopy()
        {
            FunctionTable table = base.ShallowCopy();

            table.AddFunction("rand", new Rand());
            return(table);
        }
Exemplo n.º 2
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);
    }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 6
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);
    }