Пример #1
0
        public void Test_IsPalindrome()
        {
            var exercise12 = new Exercise12();

            Assert.AreEqual(exercise12.IsPalindrome(12321), true);
            Assert.AreEqual(exercise12.IsPalindrome(101010), false);
        }
Пример #2
0
        public void TestSimpleFilter()
        {
            var actualResult = Exercise12.Flatten(new Filter());

            Assert.IsNotNull(actualResult);
            Assert.AreEqual(1, actualResult.Count);
            Assert.IsNotNull(actualResult.First());
            Assert.AreEqual(1, actualResult.First().Length);
        }
Пример #3
0
        public void TestSimpleFilter()
        {
            var actualResult = Exercise12.Flatten(new Filter());

            actualResult.Should().NotBeNull();
            actualResult.Count.Should().Be(1);
            actualResult.First().Should().NotBeNull();
            actualResult.First().Length.Should().Be(1);
        }
Пример #4
0
        public void TestSingleCompositeAllFilter()
        {
            var filters      = new CompositeFilter(CompositeFilterOperation.All, new Filter(), new Filter(), new Filter());
            var actualResult = Exercise12.Flatten(filters);

            Assert.IsNotNull(actualResult);
            Assert.AreEqual(1, actualResult.Count);
            Assert.IsNotNull(actualResult.First());
            Assert.AreEqual(3, actualResult.First().Length);
        }
Пример #5
0
        public void TestSingleCompositeAllFilter()
        {
            var filters      = new CompositeFilter(CompositeFilterOperation.All, new Filter(), new Filter(), new Filter());
            var actualResult = Exercise12.Flatten(filters);

            actualResult.Should().NotBeNull();
            actualResult.Count.Should().Be(1);
            actualResult.First().Should().NotBeNull();
            actualResult.First().Length.Should().Be(3);
        }
Пример #6
0
        public void TestNestedCompositeAnyFilter()
        {
            var filters = new CompositeFilter(CompositeFilterOperation.All,
                                              new CompositeFilter(CompositeFilterOperation.Any, new Filter(), new Filter(), new Filter()),
                                              new CompositeFilter(CompositeFilterOperation.Any, new Filter(), new Filter(), new Filter()),
                                              new CompositeFilter(CompositeFilterOperation.All, new Filter(), new Filter()),
                                              new Filter());
            var actualResult = Exercise12.Flatten(filters);

            Assert.IsNotNull(actualResult);
            Assert.AreEqual(8, actualResult.Count);
        }
Пример #7
0
        public void TestNestedCompositeAnyFilter()
        {
            var filters = new CompositeFilter(CompositeFilterOperation.All,
                                              new CompositeFilter(CompositeFilterOperation.Any, new Filter(), new Filter(), new Filter()),
                                              new CompositeFilter(CompositeFilterOperation.Any, new Filter(), new Filter(), new Filter()),
                                              new CompositeFilter(CompositeFilterOperation.All, new Filter(), new Filter()),
                                              new Filter());
            var actualResult = Exercise12.Flatten(filters);

            actualResult.Should().NotBeNull();
            actualResult.Count.Should().Be(8);
        }
Пример #8
0
        public void TestSingleCompositeAnyFilter()
        {
            var filters      = new CompositeFilter(CompositeFilterOperation.Any, new Filter(), new Filter(), new Filter());
            var actualResult = Exercise12.Flatten(filters);

            Assert.IsNotNull(actualResult);
            Assert.AreEqual(3, actualResult.Count);
            foreach (var filterSet in actualResult)
            {
                Assert.IsNotNull(filterSet);
                Assert.AreEqual(1, filterSet.Length);
            }
        }
Пример #9
0
        public void TestSingleCompositeAnyFilter()
        {
            var filters      = new CompositeFilter(CompositeFilterOperation.Any, new Filter(), new Filter(), new Filter());
            var actualResult = Exercise12.Flatten(filters);

            actualResult.Should().NotBeNull();
            actualResult.Count.Should().Be(3);
            foreach (var filterSet in actualResult)
            {
                filterSet.Should().NotBeNull();
                filterSet.Length.Should().Be(1);
            }
        }
Пример #10
0
 public void Test_SymmetricNumber_Ok(int n, bool result)
 {
     Assert.AreEqual(Exercise12.SymmetricNumber(n), result);
 }