Example #1
0
        public async Task GetReady()
        {
            var clientMock = new Mock <IPlayerHttpClient>();

            clientMock.Setup(m => m.GetAsync("getReady?code=key", TimeSpan.FromMilliseconds(2345)));

            var configMock = new Mock <IConfiguration>();

            configMock.Setup(m => m["Timeouts:getReady"]).Returns("2345");
            configMock.Setup(m => m["Timeouts:getShot"]).Returns("1234");
            configMock.Setup(m => m["Timeouts:getShots"]).Returns("3456");

            var factoryMock = new Mock <IPlayerHttpClientFactory>();

            factoryMock.Setup(m => m.GetHttpClient("https://someApi.com")).Returns(clientMock.Object);

            var client = new PlayerClient(factoryMock.Object, configMock.Object);
            await client.GetReady("https://someApi.com", "key");

            factoryMock.VerifyAll();
        }