Exemplo n.º 1
0
        public async void TwoPlayerMatch_Success()
        {
            var expected = File.ReadAllText(@"testData/TwoPlayerMatch_initial.json");

            Dictionary <string, StringValues> reqParams = new Dictionary <string, StringValues>();

            reqParams.Add("scoring_mode", new StringValues("Standard"));
            reqParams.Add("max_rounds", new StringValues("0"));
            reqParams.Add("player[]", new StringValues(new string[] { "Van Gerwen", "Taylor" }));

            var request  = TestFactory.CreateHttpRequest(reqParams, new MemoryStream());
            var response = (OkObjectResult)await StartMatch.Run(request, logger);

            Assert.Equal(expected, response.Value);
        }
        public async void TwoPlayerMatch_StartNewGame_Success()
        {
            Dictionary <string, StringValues> reqParams = new Dictionary <string, StringValues>();

            HttpRequest    request;
            OkObjectResult response;

            using (FileStream fs = File.OpenRead(initialBody))
            {
                request  = TestFactory.CreateHttpRequest(reqParams, fs);
                response = (OkObjectResult)await StartNewGame.Run(request, "2b35924a-1f53-487b-814d-035c38c841ed", logger);
            }
            var expected = File.ReadAllText(@"testData/TwoPlayerMatch_newgamestarted.json");

            Assert.Equal(expected, response.Value);
        }
Exemplo n.º 3
0
        public async void TwoPlayerMatch_HitNonscoring_Success()
        {
            Dictionary <string, StringValues> reqParams = new Dictionary <string, StringValues>();

            reqParams.Add("section", new StringValues("1"));
            reqParams.Add("bed", new StringValues("3"));

            HttpRequest    request;
            OkObjectResult response;

            using (FileStream fs = File.OpenRead(initialBody))
            {
                request  = TestFactory.CreateHttpRequest(reqParams, fs);
                response = (OkObjectResult)await ThrowDart.Run(request, "2b35924a-1f53-487b-814d-035c38c841ed", logger);
            }
            Assert.Equal(StatusCodes.Status200OK, response.StatusCode);
        }
Exemplo n.º 4
0
        public async void TwoPlayerMatch_HitSomething_Success()
        {
            Dictionary <string, StringValues> reqParams = new Dictionary <string, StringValues>();

            reqParams.Add("section", new StringValues("20"));
            reqParams.Add("bed", new StringValues("3"));

            HttpRequest    request;
            OkObjectResult response;

            using (FileStream fs = File.OpenRead(initialBody))
            {
                request  = TestFactory.CreateHttpRequest(reqParams, fs);
                response = (OkObjectResult)await ThrowDart.Run(request, "2b35924a-1f53-487b-814d-035c38c841ed", logger);
            }
            var expected = File.ReadAllText(@"testData/TwoPlayerMatch_afterT20only.json");

            Assert.Equal(expected, response.Value);
        }