Inheritance: IFilterManager
コード例 #1
0
 public void AddFilter_AddingAFilterForEmptyManager_FilterManagerHasOneFilter()
 {
     // Arrange
     FilterManager target = new FilterManager();
     var filter = Mock.Create<IFilter>();
     // Act
     target.AddFilter(filter);
     // Assert
     Assert.IsTrue(target.CurrentFilters.Contains(filter));
 }
コード例 #2
0
 public void AddFilter_AddingAFilterWhenFilterIsAlreadyAdded_FilterManagerHasOneFilter()
 {
     // Arrange
     FilterManager target = new FilterManager();
     var filter = Mock.Create<IFilter>();
     // Act
     target.AddFilter(filter);
     target.AddFilter(filter);
     // Assert
     Assert.IsTrue(target.CurrentFilters.Length == 1);
 }
コード例 #3
0
        public void Process_CommandIsPending_ShouldCallProcessFilters()
        {
            // Arrange
            FilterManager target = new FilterManager();
            bool expected = false;
            //Mock.Arrange(() => target.ProcessFilters(null))
            var command = Mock.Create<CommandBase>();
            Mock.Arrange(() => command.CurrentState).Returns(CommandState.Pending);

            // Act

            var result = target.Process(command);

            // Assert
            Assert.IsTrue(result);
        }
コード例 #4
0
        public void RemoveFilter_RemovingAFilterWhenFilterExist_FilterManagerRemainEmptyFilters()
        {
            // Arrange
            FilterManager target = new FilterManager();
            var filter = Mock.Create<IFilter>();
            target.AddFilter(filter);

            // Act

            target.RemoveFilter(filter);
            // Assert
            Assert.IsTrue(target.CurrentFilters.Length == 0);
        }
コード例 #5
0
        public void RemoveFilter_RemovingAFilterWhenOtherFilterExist_FilterManagerShouldContainThatFilters()
        {
            // Arrange
            FilterManager target = new FilterManager();
            var filter = Mock.Create<IFilter>();
            var filter2 = Mock.Create<IFilter>();
            target.AddFilter(filter);
            target.AddFilter(filter2);

            // Act

            target.RemoveFilter(filter);
            // Assert
            Assert.IsTrue(target.CurrentFilters.Contains(filter2));
            Assert.IsFalse(target.CurrentFilters.Contains(filter));
        }