コード例 #1
0
        public async Task Test_LoadAnswers_Makes_A_Request_To_The_Api()
        {
            var answers = new[]
            {
                new Answer()
                {
                    Score = 5
                },
                new Answer()
                {
                    Score = -1
                }
            };

            NetworkApi.QuestionAnswers((ids, site, order, sort, page, pagesize, filter) => Task.FromResult(new Response <Answer>()
            {
                Items = answers
            }));

            await Subject.LoadAnswers.Execute();

            Assert.Collection(Subject.Answers,
                              a => Assert.Equal("5", a.Score),
                              a => Assert.Equal("-1", a.Score));
        }
コード例 #2
0
        public async Task Test_AnswersTitle_Pluralizes_The_Label_With_The_Number_Of_Answers_That_Are_Present(int numAnswers, string expected)
        {
            var answers = Enumerable.Range(0, numAnswers)
                          .Select(i => new Answer()
            {
                Score = i
            })
                          .ToArray();

            NetworkApi.QuestionAnswers((ids, site, order, sort, page, pagesize, filter) => Task.FromResult(new Response <Answer>()
            {
                Items = answers
            }));

            await Subject.LoadAnswers.Execute();

            Assert.Equal(expected, Subject.AnswersTitle);
        }