public void GetProblemsHasCorrectMethodName() { const string expectedMethodName = "contest.problems"; _contest.GetProblems(); _polygonHttpClient.Verify( c => c.RequestAsync <List <PolygonProblem> >(expectedMethodName, It.IsAny <Dictionary <string, string> >(), It.IsAny <CancellationToken>()), Times.Once); }
public void GetProblemsHasCorrectParamsWithNullPin() { _contest = new Contest(_polygonHttpClient.Object, _contestId, null); var expectedParams = new Dictionary <string, string> { { "contestId", _contestId.ToString() }, }; Dictionary <string, string> parameters = null; _polygonHttpClient.Setup(c => c.RequestAsync <List <PolygonProblem> >( It.IsAny <string>(), It.IsAny <Dictionary <string, string> >(), It.IsAny <CancellationToken>())) .Callback <string, Dictionary <string, string>, CancellationToken>( (m, p, c) => parameters = p); _contest.GetProblems(); _polygonHttpClient.Verify( c => c.RequestAsync <It.IsAnyType>(It.IsAny <string>(), It.IsAny <Dictionary <string, string> >(), It.IsAny <CancellationToken>()), Times.Once); Assert.NotNull(parameters); Assert.AreEqual(expectedParams, parameters); }