Exemple #1
0
        public SupportEvalAssertionBuilder WithAssertion(object underlying)
        {
            SupportEvalAssertionBuilder builder = new SupportEvalAssertionBuilder(this);

            Assertions.Add(new SupportEvalAssertionPair(underlying, builder));
            return(builder);
        }
        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);
 */     }
Exemple #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);
            });
        }
Exemple #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);
            });
        }
Exemple #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);
            });
        }
Exemple #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);
            });
        }
        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);
        }
        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);
        }
    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);
    }
Exemple #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);
            });
        }
 public STSPolicy()
 {
     Assertions.Add(new RequireActionHeaderAssertion());                         // WSE policy
 }
 public TpPolicy()
 {
     Assertions.Add(new UsernameOverTransportAssertion());
 }
Exemple #13
0
 public void Add(Expression <Func <T, bool> > assertion)
 {
     Assertions.Add(assertion);
 }
 public TpServicePolicy()
 {
     Assertions.Add(new UsernameOverTransportAssertion());
     Assertions.Add(new RequireActionHeaderAssertion());
 }