Exemple #1
0
                public void Filter(string columName, string[] values)
                {
                    string filter = $"[{columName}] IN ({values.Select(x => $"'{x}'").Joined()})";

                    _filterClause.TryClearColumn(columName);
                    _filterClause.AddFilterClause(filter);
                    MagicToolbox.SetProperty(_view, nameof(_view.FilterString), _filterClause.Clause);
                }
Exemple #2
0
        public void GetEvent_EventWithoutHandlers_ReturnNull()
        {
            // Arrange
            var anyClass = new AnyClass();

            // Act
            var evt = MagicToolbox.GetEvent(anyClass, nameof(AnyClass.Event));

            // Assert
            evt.Should().BeNull();
        }
Exemple #3
0
        public void GetEvent_EventWithHandlers_InvokeEventHandlerByReflection()
        {
            // Arrange
            var anyClass          = new AnyClass();
            var receivedSender    = default(object);
            var receivedEventArgs = default(EventArgs);
            var anyEventArgs      = EventArgs.Empty;

            anyClass.Event += (sender, e) => { receivedSender = sender; receivedEventArgs = e; };

            // Act
            var evt = MagicToolbox.GetEvent(anyClass, nameof(AnyClass.Event));

            evt.Invoke(this, anyEventArgs);

            // Assert
            receivedSender.Should().BeEquivalentTo(this);
            receivedEventArgs.Should().BeEquivalentTo(anyEventArgs);
        }
Exemple #4
0
 public void CleanFilter(string headerName)
 {
     _filterClause.ClearColumn(headerName);
     MagicToolbox.SetProperty(_view, nameof(_view.FilterString), _filterClause.Clause);
 }