Exemple #1
0
        public void TestString()
        {
            InfoPool.Provide <string>("test", ReturnSomething);

            string x = InfoPool.Request <string>("test");

            Assert.AreEqual(x, TEST_VALUE);

            InfoPool.Unprovide <string>("test", ReturnSomething);
        }
Exemple #2
0
        public void TestUnprovide()
        {
            InfoPool.Provide <string>("test", ReturnSomething);
            string x = InfoPool.Request <string>("test");

            Assert.AreEqual(x, TEST_VALUE);

            InfoPool.Unprovide <string>("test", ReturnSomething);

            Assert.That(() => InfoPool.Request <string>("test"),
                        Throws.TypeOf <InfoPool.RequestedItemNotProvidedException>());
        }
Exemple #3
0
 public void TestCastException()
 {
     InfoPool.Provide <string>("test", ReturnSomething);
     try
     {
         InfoPool.Request <int>("test");
         Assert.Fail();
     }
     catch (InvalidCastException e)
     {
         Assert.Pass("Expected: " + e.ToString());
     }
     finally
     {
         InfoPool.Unprovide <string>("test", ReturnSomething);
     }
 }