Beispiel #1
0
        public void Step1_throws_on_missing_WWW_Authenticate_header()
        {
            var http = SetupStep1(null);

            Assert.That(
                () => Client.Step1(TestData.Credentials, new Client.OtpOptions(), http.Object),
                ExceptionsTest.ThrowsInvalidResponseWithMessage("WWW-Authenticate header"));
        }
Beispiel #2
0
        public void Step2_throws_on_missing_cookies()
        {
            var testCases = new[]
            {
                new string[] {},
                new[] { "sib-auth=auth" },
                new[] { "sib-deviceid=deviceid" },
                new[] { "blah=blah-blah" },
                new[] { "sib-auth=auth", "blah=blah-blah" },
            };

            foreach (var testCase in testCases)
            {
                var http = SetupStep2(testCase);
                Assert.That(() => Client.Step2(TestData.Credentials,
                                               new Client.OtpOptions(),
                                               TestData.AuthInfo,
                                               http.Object),
                            ExceptionsTest.ThrowsInvalidResponseWithMessage("cookie"));
            }
        }
 //
 // Helpers
 //
 private static void VerifyThrows(Action action)
 {
     Assert.That(new TestDelegate(action),
                 ExceptionsTest.ThrowsInvalidResponseWithMessage("Invalid auth info"));
 }