Exemplo n.º 1
0
        public void Support_customized_file_filters()
        {
            var regex = new Regex("Plugin.dll$");

            using (var sut = new PackageContainer <string> {
                FileFilter = regex.IsMatch
            })
            {
                sut.FileFilter(@"c:\some\path\packages\RestPlugin.1.2.3\lib\net45\RestPlugin.dll").Should().BeTrue();
                sut.FileFilter("Newtonsoft.Json.dll").Should().BeFalse();
                sut.Invoking(x => x.TypeFilter = null).ShouldThrow <ArgumentNullException>("null not allowed");
            }
        }
Exemplo n.º 2
0
        public void Support_customized_type_filters()
        {
            var expected = typeof(int);

            using (var sut = new PackageContainer <string> {
                TypeFilter = type => type == expected
            })
            {
                sut.TypeFilter(expected).Should().BeTrue();
                sut.TypeFilter(typeof(string)).Should().BeFalse();

                sut.Invoking(x => x.TypeFilter = null).ShouldThrow <ArgumentNullException>("null not allowed");
            }
        }