Esempio n. 1
0
        public void Test_Retries_Execute_And_Can_Complete_Successfully()
        {
            var returnMe = new JsonNumber("0");

            var transport = new FakeJsonTransport();

            transport.SetReturn(this.Fixture.GetBadLoginJson());
            transport.SetReturn(this.Fixture.GetBadLoginJson());
            transport.SetReturn(this.Fixture.GetGoodLoginJson());
            transport.SetReturn(returnMe);

            var loginMan   = new LoginManager("user", "password", transport);
            var retry      = new RpcRetry(transport, loginMan, 3);
            var argMaker   = new AutoTokenArgMaker("fooarg");
            var codeGetter = new NullCodeGetter();
            var result     = retry.Invoke("method", argMaker, codeGetter);

            Assert.AreEqual(result, returnMe);
        }
Esempio n. 2
0
        public void Test_Retries_Execute_And_Can_Complete_Successfully()
        {
            var returnMe = new WebHeaderCollection();

            returnMe.Add("X-Agile-Status", "0");

            var transport = new FakeJsonTransport();

            transport.SetReturn(this.Fixture.GetBadLoginJson());
            transport.SetReturn(this.Fixture.GetBadLoginJson());
            transport.SetReturn(this.Fixture.GetGoodLoginJson());
            transport.SetReturn(returnMe);

            var loginMan   = new LoginManager("user", "password", transport);
            var retry      = new HttpRetry(transport, loginMan, 3);
            var codeGetter = new NullCodeGetter();
            var stream     = new MemoryStream(new byte[] { 100 });
            var result     = retry.Invoke("http://", stream, "", new Dictionary <string, string>());

            Assert.AreEqual(result, returnMe);
        }