예제 #1
0
        public void PassesFilter_WithIntAndMethod_ReturnsTrue(int toTest, IntFilter.IntFilterMethods method, bool expected)
        {
            var filter = new IntFilter(method, 10);
            var result = filter.PassesFilter(toTest);

            Assert.Equal(expected, result);
        }
예제 #2
0
        public void PassesFilter_WithValidStringAndMethod_ReturnsTrue()
        {
            var filter = new IntFilter(IntFilter.IntFilterMethods.Greater, 10);
            var result = filter.PassesFilter("20");

            Assert.True(result);
        }
예제 #3
0
        public void PassesFilter_WithNonInt_ThrowArgumentException()
        {
            var filter = new IntFilter(IntFilter.IntFilterMethods.Equal, 10);

            Assert.Throws <ArgumentException>(() => filter.PassesFilter(new object()));
        }
예제 #4
0
        public void PassesFilter_WithInvalidStringAndMethod_ThrowsFormatException()
        {
            var filter = new IntFilter(IntFilter.IntFilterMethods.Greater, 10);

            Assert.Throws <FormatException>(() => filter.PassesFilter("not_a_number"));
        }
예제 #5
0
        public void PassesFilter_WithIntAndNullMethod_ThrowsInvalidOperationException()
        {
            var filter = new IntFilter();

            Assert.Throws <InvalidOperationException>(() => filter.PassesFilter(10));
        }