Exemple #1
0
        public void ToStringOrOperatorExpectedValue()
        {
            var          sub1     = PluginFilter.Create.IsNamed("sub1");
            var          sub2     = PluginFilter.Create.IsNamed("sub2");
            string       expected = "(" + sub1.ToString() + " | " + sub2.ToString() + ")";
            PluginFilter tested   = sub1.Or(sub2);

            Assert.AreEqual(expected, tested.ToString());
        }
Exemple #2
0
        public void ToStringUnaryOperatorExpectedValue()
        {
            PluginFilter.FilterOperation[] binaryOperators = new PluginFilter.FilterOperation[] {
                PluginFilter.FilterOperation.And,
                PluginFilter.FilterOperation.Or,
            };

            var unaryOperators = Enum.GetValues(typeof(PluginFilter.FilterOperation)).OfType <PluginFilter.FilterOperation>().Except(binaryOperators);

            foreach (var op in unaryOperators)
            {
                PluginFilter tested = new PluginFilter(op, "opdata", null);
                Assert.AreEqual(op.ToString() + "(opdata)", tested.ToString());
            }
        }
Exemple #3
0
        public void ShouldLogToDebugOnPluginQuery()
        {
            PluginRepository tested = new PluginRepository();
            MockLog          log    = new MockLog(tested);
            PluginFilter     filter = PluginFilter.Create.IsNamed("plugin name").Implements(typeof(IMockPluginInterface1));

            tested.Plugins(filter);
            Assert.IsTrue(log.Any(x => x.Level == MockLog.Level.Debug && x.Message.Contains("Returning plugins for") && x.Message.Contains(filter.ToString())));
        }
        public void ToStringUnaryOperatorExpectedValue()
        {
            PluginFilter.FilterOperation[] binaryOperators = new PluginFilter.FilterOperation[] {
            PluginFilter.FilterOperation.And,
            PluginFilter.FilterOperation.Or,
              };

              var unaryOperators = Enum.GetValues(typeof(PluginFilter.FilterOperation)).OfType<PluginFilter.FilterOperation>().Except(binaryOperators);

              foreach (var op in unaryOperators)
              {
            PluginFilter tested = new PluginFilter(op, "opdata", null);
            Assert.AreEqual(op.ToString() + "(opdata)", tested.ToString());
              }
        }