示例#1
0
        public void TestIfUserCanGetHighScores()
        {
            IApplicationData data = Mock.Create <IApplicationData>();

            Score[] scores = { new Score(), new Score(), new Score() };

            Mock.Arrange(() => data.Score.All())
            .Returns(() => scores.AsQueryable());

            var server = new InMemoryHttpServer <Score>(this.inMemoryServerUrl, data);

            var response = server.CreateGetRequest("/api/scores");

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
            Assert.IsNotNull(response.Content);
        }
示例#2
0
        public void TestIfUserCanGetViewUnstartedGames()
        {
            IApplicationData data = Mock.Create <IApplicationData>();

            Game[] games = { new Game(), new Game(), new Game() };

            Mock.Arrange(() => data.Games.All())
            .Returns(() => games.AsQueryable());

            var server = new InMemoryHttpServer <Game>(this.inMemoryServerUrl, data);

            var response = server.CreateGetRequest("/api/games");

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
            Assert.IsNotNull(response.Content);
        }