Exemplo n.º 1
0
        public async void Register_Should_Return_Correctly()
        {
            var expected = new SecurityResponse();

            _provider.SignUp(Arg.Any <SecurityRequest>()).Returns(expected);

            var actual = await _service.Register(new SecurityRequest());

            actual.Should().BeEquivalentTo(expected);
        }
        public async void SignUp_Should_Call_IApiRequestProvider_CreatePostRequest()
        {
            JObject content = null;
            Dictionary <string, string> query = null;

            _requestProvider.CreatePostRequest(Arg.Any <string>(), Arg.Do <JObject>(a => content = a), Arg.Any <Dictionary <string, string> >(), Arg.Do <Dictionary <string, string> >(a => query = a), Arg.Any <Func <JObject, HttpContent> >());

            var request = new SecurityRequest
            {
                Email    = "email",
                Password = "******"
            };
            await _provider.SignUp(request);

            _requestProvider.Received(1).CreatePostRequest($"{_firebaseAuthEndpoint}/accounts:signUp", Arg.Any <JObject>(), Arg.Any <Dictionary <string, string> >(), Arg.Any <Dictionary <string, string> >(), null);

            content.Value <string>("email").Should().Be(request.Email);
            content.Value <string>("password").Should().Be(request.Password);
            content.Value <bool>("returnSecureToken").Should().BeTrue();

            query.Should().ContainKey("key");
            query["key"].Should().Be(_firebaseApiKey);
        }
Exemplo n.º 3
0
 public async Task <SecurityResponse> Register(SecurityRequest request)
 {
     return(await _provider.SignUp(request));
 }