Example #1
0
        public async Task RestorePassword(string phone)
        {
            var result = await FNS.RestorePasswordAsync(phone);

            WriteOutput(result);
            Assert.IsTrue(result.IsSuccess);
        }
Example #2
0
        public async Task Login(string phone, string password)
        {
            var result = await FNS.LoginAsync(phone, password);

            WriteOutput(result);
            Assert.IsTrue(result.IsSuccess);
        }
Example #3
0
        public async Task Registration(string email, string name, string phone)
        {
            var result = await FNS.RegistrationAsync(email, name, phone);

            WriteOutput(result);
            Assert.IsTrue(result.IsSuccess);
        }
Example #4
0
        public async Task Registration(string email, string name, string phone)
        {
            var instance = new FNS(HttpMessageHandlerMock.GetHttpClient(System.Net.HttpStatusCode.NoContent, ""));
            var result   = await instance.RegisterAsync(email, name, phone);

            Assert.IsTrue(result.IsSuccess);
        }
Example #5
0
        private async Task <bool> TrySignIn()
        {
            var phone = GetClearPhone();

            if (string.IsNullOrWhiteSpace(phone) || string.IsNullOrWhiteSpace(Password))
            {
                FailMessage = CommonMessages.UnfilledFields;
                return(false);
            }

            var task = FNS.LoginAsync(phone, Password);

            if (await TryExecute(task))
            {
                var temp = JsonConvert.DeserializeObject <Sign>(task.Result.Message);
                Name            = temp.Name;
                Email           = temp.Email;
                IsAuthorization = true;

                await UpdateUserAccount(Sign);

                return(true);
            }

            return(false);
        }
Example #6
0
        public async Task Login(string phone, string password)
        {
            var instance = new FNS(HttpMessageHandlerMock.GetHttpClient(
                                       HttpStatusCode.OK, MockData.LoginSuccessResponse));
            var result = await instance.LoginAsync(phone, password);

            Assert.IsTrue(result.IsSuccess);
        }
Example #7
0
        public async Task Receive(string fiscalNumber, string fiscalDocument, string fiscalSign,
                                  string phone, string password)
        {
            var result = await FNS.ReceiveAsync(fiscalNumber, fiscalDocument, fiscalSign, phone, password);

            WriteOutput(result);
            Assert.IsTrue(result.IsSuccess);
        }
Example #8
0
        public async Task Check(string fiscalNumber, string fiscalDocument,
                                string fiscalSign, DateTime date, double sum)
        {
            var result = await FNS.VerifyAsync(fiscalNumber, fiscalDocument, fiscalSign, date, sum);

            WriteOutput(result);
            Assert.IsTrue(result.IsSuccess);
        }
Example #9
0
        public async Task RestorePassword(string phone)
        {
            var instance = new FNS(HttpMessageHandlerMock.GetHttpClient(
                                       System.Net.HttpStatusCode.NoContent, ""));
            var result = await instance.RestorePasswordAsync(phone);

            Assert.IsTrue(result.IsSuccess);
        }
Example #10
0
        public async Task ReceiveReceiptIsNotFound(string fiscalNumber, string fiscalDocument, string fiscalSign,
                                                   string phone, string password)
        {
            var instance = new FNS(HttpMessageHandlerMock.GetHttpClient(
                                       HttpStatusCode.NotAcceptable, ""));
            var result = await instance.ReceiveAsync(fiscalNumber, fiscalDocument, fiscalSign, phone, password);

            Assert.AreEqual(HttpStatusCode.NotAcceptable, result.StatusCode);
        }
Example #11
0
        public async Task ReceiveReceiptUserIsNotFound(string fiscalNumber, string fiscalDocument, string fiscalSign,
                                                       string phone, string password)
        {
            var instance = new FNS(HttpMessageHandlerMock.GetHttpClient(
                                       HttpStatusCode.Forbidden, "the user was not found or the specified password was not correct"));
            var result = await instance.ReceiveAsync(fiscalNumber, fiscalDocument, fiscalSign, phone, password);

            Assert.AreEqual(HttpStatusCode.Forbidden, result.StatusCode);
        }
Example #12
0
        public async Task CheckReceiptIsNotFound(string fiscalNumber, string fiscalDocument,
                                                 string fiscalSign, DateTime date, decimal sum)
        {
            var instance = new FNS(HttpMessageHandlerMock.GetHttpClient(
                                       HttpStatusCode.NotAcceptable, ""));
            var result = await instance.CheckAsync(fiscalNumber, fiscalDocument, fiscalSign, date, sum);

            Assert.AreEqual(HttpStatusCode.NotAcceptable, result.StatusCode);
        }
Example #13
0
        public async Task Receive(string fiscalNumber, string fiscalDocument, string fiscalSign,
                                  string phone, string password)
        {
            var instance = new FNS(HttpMessageHandlerMock.GetHttpClient(
                                       HttpStatusCode.OK, MockData.ReceiveReceiptContent));
            var result = await instance.ReceiveAsync(fiscalNumber, fiscalDocument, fiscalSign, phone, password);

            Assert.IsTrue(result.IsSuccess);
        }
Example #14
0
        public async Task CheckReceiptIsFound(string fiscalNumber, string fiscalDocument,
                                              string fiscalSign, DateTime date, decimal sum)
        {
            var instance = new FNS(HttpMessageHandlerMock.GetHttpClient(
                                       System.Net.HttpStatusCode.NoContent, ""));
            var result = await instance.CheckAsync(fiscalNumber, fiscalDocument, fiscalSign, date, sum);

            Assert.IsTrue(result.IsSuccess);
        }
Example #15
0
        public async Task <ReceiptResult> ReceiveAsync(string fiscalNumber, string fiscalDocument, string fiscalSign)
        {
            var user = await _UsersRepository.GetMainUserAsync();

            if (user == null)
            {
                throw new FnsUserNotFoundException("Can't find user to authorize to FNS. Internal server problem. Check db.");
            }

            return(await FNS.ReceiveAsync(fiscalNumber, fiscalDocument, fiscalSign, user.Username, user.Password));
        }
Example #16
0
        private async Task <bool> TryRestorePassword()
        {
            var phone = GetClearPhone();

            if (string.IsNullOrWhiteSpace(phone))
            {
                FailMessage = CommonMessages.UnfilledFields;
                return(false);
            }

            var task = FNS.RestorePasswordAsync(phone);

            return(await TryExecute(task));
        }
        private async Task <bool> TrySignUp()
        {
            var phone = GetClearPhone();

            if (string.IsNullOrWhiteSpace(Email) ||
                string.IsNullOrWhiteSpace(Name) ||
                string.IsNullOrWhiteSpace(phone))
            {
                FailMessage = CommonMessages.UnfilledFields;
                return(false);
            }

            var task = FNS.RegistrationAsync(Email, Name, phone);

            return(await TryExecute(task));
        }
Example #18
0
 public Task <CheckResult> IsReceiptExists(string fiscalNumber, string fiscalDocument, string fiscalSign, DateTime date, decimal sum)
 {
     return(FNS.CheckAsync(fiscalNumber, fiscalDocument, fiscalSign, date, sum));
 }
Example #19
0
        public async Task LoginToFns()
        {
            var login = await FNS.LoginAsync(_FnsUser.Username, _FnsUser.Password);

            Assert.That(login.IsSuccess, Is.EqualTo(true));
        }