Пример #1
0
        public void WriteSaml2ProxyRestriction(Saml2TheoryData theoryData)
        {
            TestUtilities.WriteHeader($"{this}.WriteSaml2ProxyRestriction", theoryData);
            var context = new CompareContext($"{this}.WriteSaml2ProxyRestriction, {theoryData.TestId}");

            try
            {
                var ms              = new MemoryStream();
                var writer          = XmlDictionaryWriter.CreateTextWriter(ms, Encoding.UTF8, false);
                var envelopedWriter = new EnvelopedSignatureWriter(writer, Default.AsymmetricSigningCredentials, "ref#1");
                (theoryData.Saml2Serializer as Saml2SerializerPublic).WriteProxyRestrictionPublic(writer, theoryData.ProxyRestriction);

                writer.Flush();
                var xml = Encoding.UTF8.GetString(ms.ToArray());
                IdentityComparer.AreEqual(xml, theoryData.Xml, context);

                theoryData.ExpectedException.ProcessNoException();
            }
            catch (Exception ex)
            {
                theoryData.ExpectedException.ProcessException(ex);
            }

            TestUtilities.AssertFailIfErrors(context);
        }
Пример #2
0
        public void ReadAction(Saml2TheoryData theoryData)
        {
            var context = TestUtilities.WriteHeader($"{this}.ReadAction", theoryData);

            try
            {
                var reader = XmlUtilities.CreateDictionaryReader(theoryData.Xml);
                var action = (theoryData.Saml2Serializer as Saml2SerializerPublic).ReadActionPublic(reader);
                theoryData.ExpectedException.ProcessNoException(context);

                IdentityComparer.AreEqual(action, theoryData.Action, context);
            }
            catch (Exception ex)
            {
                theoryData.ExpectedException.ProcessException(ex, context);
            }

            TestUtilities.AssertFailIfErrors(context);
        }
Пример #3
0
        public void ReadAdvice(Saml2TheoryData theoryData)
        {
            TestUtilities.WriteHeader($"{this}.ReadAdvice", theoryData);
            var context = new CompareContext($"{this}.ReadAdvice, {theoryData.TestId}");

            try
            {
                var reader = XmlUtilities.CreateDictionaryReader(theoryData.Xml);
                var advice = (theoryData.Saml2Serializer as Saml2SerializerPublic).ReadAdvicePublic(reader);
                theoryData.ExpectedException.ProcessNoException();

                IdentityComparer.AreEqual(advice, theoryData.Advice, context);
            }
            catch (Exception ex)
            {
                theoryData.ExpectedException.ProcessException(ex);
            }

            TestUtilities.AssertFailIfErrors(context);
        }