コード例 #1
0
ファイル: SupportEvalBuilder.cs プロジェクト: lanicon/nesper
        public SupportEvalAssertionBuilder WithAssertion(object underlying)
        {
            SupportEvalAssertionBuilder builder = new SupportEvalAssertionBuilder(this);

            Assertions.Add(new SupportEvalAssertionPair(underlying, builder));
            return(builder);
        }
コード例 #2
0
        public DGWSPolicy(X509Certificate2 moces)
        {
            this.moces = moces;

            Assertions.Add(new RequireActionHeaderAssertion());                         // WSE policy

            DGWSAssertion dgwsAss = new DGWSAssertion();

            dgwsAss.Card = GetIDCard();
            Assertions.Add(dgwsAss);

            Assertions.Add(new AddressingConverterAssertion());

            MessageSignAssertion msgAss = new MessageSignAssertion();

            msgAss.certificate          = moces;
            msgAss.acceptedcartificates = new[] { "CVR:25767535-UID:1100080130597 + CN=TDC TOTALLØSNINGER A/S - TDC Test" };
            Assertions.Add(msgAss);

/*			DGWSAssertion dgwsAss = new DGWSAssertion();
 *                      dgwsAss.GetIDCard = new IDCardReceiver(GetClientIDCard);
 *                      Assertions.Add(dgwsAss);
 *
 *                      Assertions.Add(new AddressingConverterAssertion());
 *
 *                      MessageSignAssertion msgAss = new MessageSignAssertion();
 *                      msgAss.certificate = moces;
 *                      msgAss.acceptedcartificates = new[] { "CVR:25767535-UID:1100080130597 + CN=TDC TOTALLØSNINGER A/S - TDC Test" };
 *                      Assertions.Add(msgAss);
 */     }
コード例 #3
0
        public void TagShouldExist(string tagKey, Func <IMockSpan, bool> when)
        {
            Assertions.Add(span =>
            {
                if (when(span) && !span.Tags.ContainsKey(tagKey))
                {
                    return($"Tag {tagKey} is missing from span.");
                }

                return(null);
            });
        }
コード例 #4
0
        public void TagShouldNotExist(string tagKey, Func <IMockSpan, bool> when = null)
        {
            when ??= Always;

            Assertions.Add(span =>
            {
                if (when(span) && span.Tags.ContainsKey(tagKey))
                {
                    return($"Tag {tagKey} was found on span, but it was not expected (Value: {span.Tags[tagKey]})");
                }

                return(null);
            });
        }
コード例 #5
0
        public void RegisterCustomExpectation(
            string keyForMessage,
            Func <IMockSpan, string> actual,
            string expected)
        {
            Assertions.Add(span =>
            {
                var actualValue = actual(span);
                if (expected != null && actualValue != expected)
                {
                    return(FailureMessage(name: keyForMessage, actual: actualValue, expected: expected));
                }

                return(null);
            });
        }
コード例 #6
0
        public void RegisterDelegateExpectation(Func <IMockSpan, IEnumerable <string> > expectation)
        {
            if (expectation == null)
            {
                return;
            }

            Assertions.Add(span =>
            {
                var failures = expectation(span)?.ToArray();

                if (failures != null && failures.Any())
                {
                    return(string.Join(",", failures));
                }

                return(null);
            });
        }
コード例 #7
0
        public DGWSPolicy(X509Certificate2 moces)
        {
            cert = moces;

            Assertions.Add(new RequireActionHeaderAssertion());                         // WSE policy

            DGWSAssertion dgwsAss = new DGWSAssertion();

            dgwsAss.GetIDCard = GetCard;
            Assertions.Add(dgwsAss);

            Assertions.Add(new AddressingConverterAssertion());

            MessageSignAssertion msgAss = new MessageSignAssertion();

            msgAss.certificate          = moces;
            msgAss.acceptedcartificates = new[] { "*" };
//			msgAss.acceptedcartificates = new[] { "CVR:25767535-UID:1100080130597 + CN=TDC TOTALLØSNINGER A/S - TDC Test" };
            Assertions.Add(msgAss);
        }
コード例 #8
0
        public DGWSPolicy(DGWSCard10Type card, X509Certificate2 voces)
        {
            this.card = card;

            Assertions.Add(new RequireActionHeaderAssertion());                         // WSE policy

            DGWSAssertion dgwsAss = new DGWSAssertion();

            dgwsAss.GetIDCard = GetIDCard;
            Assertions.Add(dgwsAss);

            Assertions.Add(new AddIDsAssertion());

            Assertions.Add(new AddressingConverterAssertion());

            MessageSignAssertion msgAss = new MessageSignAssertion();

            msgAss.certificate          = voces;
            msgAss.acceptedcartificates = new[] { "*" };
            Assertions.Add(msgAss);
        }
コード例 #9
0
    public DGWSPolicy(X509Certificate2 cardOCES, X509Certificate2 msgOCES, bool sts)
    {
        this.cardOCES = cardOCES;
        this.msgOCES  = msgOCES;

        Assertions.Add(new RequireActionHeaderAssertion());                     // WSE policy

        DGWSAssertion dgwsAss = new DGWSAssertion();

        dgwsAss.Card = GetIDCard(sts);
        Assertions.Add(dgwsAss);

        Assertions.Add(new AddressingConverterAssertion());

        MessageSignAssertion msgAss = new MessageSignAssertion();

        msgAss.certificate = msgOCES;
        //			msgAss.acceptedcartificates = new[] { "CVR:25767535-UID:1100080130597 + CN=TDC TOTALLØSNINGER A/S - TDC Test" };
        msgAss.acceptedcartificates = new[] { "*" };
        Assertions.Add(msgAss);
    }
コード例 #10
0
        public void RegisterTagExpectation(
            string key,
            string expected,
            Func <IMockSpan, bool> when = null)
        {
            when ??= Always;

            Assertions.Add(span =>
            {
                if (!when(span))
                {
                    return(null);
                }

                var actualValue = GetTag(span, key);
                if (expected != null && actualValue != expected)
                {
                    return(FailureMessage(name: key, actual: actualValue, expected: expected));
                }

                return(null);
            });
        }
コード例 #11
0
 public STSPolicy()
 {
     Assertions.Add(new RequireActionHeaderAssertion());                         // WSE policy
 }
コード例 #12
0
 public TpPolicy()
 {
     Assertions.Add(new UsernameOverTransportAssertion());
 }
コード例 #13
0
ファイル: TestCase.cs プロジェクト: vidaj/ExpressiveAsserts
 public void Add(Expression <Func <T, bool> > assertion)
 {
     Assertions.Add(assertion);
 }
コード例 #14
0
 public TpServicePolicy()
 {
     Assertions.Add(new UsernameOverTransportAssertion());
     Assertions.Add(new RequireActionHeaderAssertion());
 }