Exemplo n.º 1
0
        public async Task GetSackAsync_ApiUrl_ValidCode2()
        {
            //Arrange
            var service = new ShardService(new WebApiClient());

            //Act
            var sack = await service.GetSackAsync();

            var code = await service.GetCodeAsync(sack);

            var codeValidity = await service.VerifyCodeAsync(code);

            // Assert
            Assert.True(codeValidity.CodeIsValid, codeValidity.ValidationMessage);
        }
Exemplo n.º 2
0
        public async Task GetCode_Sack_False()
        {
            var service = new ShardService(new WebApiClient());

            SetSack(expectedSack);

            // Act
            string code = await service.GetCodeAsync(expectedSack);

            code = string.Join(string.Empty, code.ToCharArray().OrderByDescending(x => x));
            var codeValidity = await service.VerifyCodeAsync(code);

            // Assert
            Assert.IsFalse(codeValidity.CodeIsValid, codeValidity.ValidationMessage);
        }
Exemplo n.º 3
0
        public async Task GetCode_Sack_True()
        {
            var webApiClient = new WebApiClient(new TestHttpClient(expectedSack));
            var service      = new ShardService(webApiClient);

            SetSack(expectedSack);

            // Act
            string code = await service.GetCodeAsync(expectedSack);

            var codeValidity = await service.VerifyCodeAsync(code);

            // Assert
            Assert.True(codeValidity.CodeIsValid, codeValidity.ValidationMessage);
        }
Exemplo n.º 4
0
        public async Task GetSackAsync_ApiUrl_ValidCode()
        {
            //Arrange
            var service = new ShardService(new WebApiClient());

            //Act
            var isValidCodeTask = await service.GetSackAsync()
                                  .ContinueWith(async(antecedent) =>
            {
                return(await service.GetCodeAsync(antecedent.Result));
            }, TaskContinuationOptions.OnlyOnRanToCompletion)
                                  .ContinueWith(async(antecedent) =>
            {
                return(await service.VerifyCodeAsync(antecedent.Result.Result));
            }, TaskContinuationOptions.OnlyOnRanToCompletion);

            var codeValidity = isValidCodeTask.Result;

            Assert.True(codeValidity.CodeIsValid, codeValidity.ValidationMessage);
        }