Ejemplo n.º 1
0
        public void should_register_log_filter()
        {
            // given
            var collection = new GlobalFilterCollection();

            // when
            FilterConfig.RegisterGlobalFilters(collection);

            // then
            var instance = collection.First().Instance;

            Assert.That(instance.GetType(), Is.EqualTo(typeof(LogExceptionsAttribute)));
        }
Ejemplo n.º 2
0
        public void Test_All_Methods()
        {
            var global = new GlobalFilterCollection();

            Assert.True(global.Count == 0);
            Assert.Throws <ArgumentNullException>(() => global.Add(null));

            var filter = new Filter();

            global.Add(filter);
            Assert.True(global.Count == 1 && global.First() == filter);
            Assert.Contains(filter, global);

            global.Remove(filter);
            Assert.True(global.Count == 0);


            global.Add(filter);
            global.Clear();
            Assert.True(global.Count == 0);
        }