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(); }
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); }
private static void AssertSingleRequestMethod(string name, int count) { Assert.That(RequestRecorder.GetTotal(), Is.EqualTo(count)); Assert.That(RequestRecorder.Get(name), Is.EqualTo(count)); }