Exemple #1
0
        public void TestContains()
        {
            var repo = new ActionRepository();

            repo.AddAction("Hello", s => { });
            Assert.IsTrue(repo.Contains("Hello"));
            Assert.IsTrue(repo.Contains("hello"));
            Assert.IsFalse(repo.Contains(" hello"));
        }
Exemple #2
0
        public void TestReleaseExecute()
        {
            int i       = 0;
            var repo    = new ActionRepository();
            var release = repo.AddAction("a", s => i++);

            Assert.IsTrue(repo.Contains("a"));
            repo.Execute("a", null);
            Assert.AreEqual(1, i);
            release.Release();
            Assert.IsFalse(repo.Contains("a"));
            repo.Execute("a", null);
            Assert.AreEqual(1, i);
        }
Exemple #3
0
        public void TestAddNull()
        {
            var repo = new ActionRepository();

            try
            {
                repo.AddAction("Hello", null);
                Assert.Fail();
            }
            catch (ArgumentNullException) { }

            Assert.IsFalse(repo.Contains("Hello"));
            repo.Execute("Hello", null);
        }