Ejemplo n.º 1
0
 public void GemericMethodsTest()
 {
     GenericStorage<int> a = new GenericStorage<int>(5);
     a.GenericStorage_1Prototype.SetMeAnd2Objects_2<int, int>((x, y, z) =>
                                                              	{ return "Hi, together we are "+(x.Data + y + z).ToString(); });
     Assert.That(a.MeAnd2Objects<int, int>(10, 20) == "Hi, together we are 35");
 }
Ejemplo n.º 2
0
        public void GenericMethodInStaticProtoTest()
        {
            GenericStorage<int>.StaticPrototype.SetMeAnd2Objects_2<string,int>((x, y, z) => { return "test"; });
            GenericStorage<int> test = new GenericStorage<int>(10);

            Assert.That(test.MeAnd2Objects<string, int>(10, "a") == "test");
        }
Ejemplo n.º 3
0
        public void CrazyTest()
        {
            GenericStorage<GenericStorage<string>>.StaticPrototype.SetMeAnd2Objects_2<GenericStorage<bool>,GenericStorage<GenericStorage<int>>>(
                (x,y,z) => { return x.Data.Data.ToString() + y.Data.Data.ToString() + z.Data.ToString(); }
                );
            GenericStorage<GenericStorage<string>> a = new GenericStorage<GenericStorage<string>>(new GenericStorage<string>("Yes! I am string!"));

            var result =
                a.MeAnd2Objects<GenericStorage<bool>, GenericStorage<GenericStorage<int>>>(
                    new GenericStorage<GenericStorage<int>>(new GenericStorage<int>(2)), new GenericStorage<bool>(true));
            Assert.That(result == "Yes! I am string!2True");
        }