예제 #1
0
        public void Setup()
        {
            RequestRecorder.Reset();

            _arguments = new Mock <IAppArguments>();
            _arguments.Setup(a => a.Method).Returns(HttpMethod.Get);
            _arguments.Setup(a => a.Status).Returns(200);
            _arguments.Setup(a => a.Loop).Returns(1);

            _tokenSource = new CancellationTokenSource();
            Context context = new Context(_arguments.Object, _tokenSource.Token, null);

            _sender = new RequestSender(context);
            _server = new ApiServer();
        }
예제 #2
0
        private RequestInfo VerifyRequest(RequestRecorder recorder, UpdateMode mode)
        {
            var req = recorder.RequireRequest(TimeSpan.FromSeconds(5));

            Assert.Equal("GET", req.Method);

            // Note, we don't check for an exact match of the encoded user string in Req.Path because it is not determinate - the
            // SDK may add custom attributes to the user ("os" etc.) and since we don't canonicalize the JSON representation,
            // properties could be serialized in any order causing the encoding to vary. Also, we don't test REPORT mode here
            // because it is already covered in FeatureFlagRequestorTest.
            Assert.Matches(mode.FlagsPathRegex, req.Path);

            Assert.Equal("", req.Query);
            Assert.Equal(BasicMobileKey, req.Headers["Authorization"]);
            Assert.Equal("", req.Body);

            return(req);
        }
예제 #3
0
 private static void AssertSingleRequestMethod(string name, int count)
 {
     Assert.That(RequestRecorder.GetTotal(), Is.EqualTo(count));
     Assert.That(RequestRecorder.Get(name), Is.EqualTo(count));
 }