Exemplo n.º 1
0
        public async Task Test_Idempotency_UsersCreateLegals()
        {
            string key      = DateTime.Now.Ticks.ToString();
            var    userPost = new UserLegalPostDTO("*****@*****.**", "SomeOtherSampleOrg", LegalPersonType.BUSINESS,
                                                   "RepFName", "RepLName", new DateTime(1975, 12, 21, 0, 0, 0), CountryIso.FR, CountryIso.FR);
            await Api.Users.Create(key, userPost);

            var result = await Api.Idempotency.Get(key);

            Assert.IsInstanceOf <UserLegalDTO>(result.Resource);
        }
Exemplo n.º 2
0
        protected UserLegalDTO GetMatrix()
        {
            if (BaseTest._matrix == null)
            {
                UserNaturalDTO   john = this.GetJohn();
                UserLegalPostDTO user = new UserLegalPostDTO(john.Email, "MartixSampleOrg", LegalPersonType.BUSINESS, john.FirstName, john.LastName, john.Birthday, john.Nationality, john.CountryOfResidence);
                user.HeadquartersAddress         = "Some Address";
                user.LegalRepresentativeAddress  = john.Address;
                user.LegalRepresentativeEmail    = john.Email;
                user.LegalRepresentativeBirthday = new DateTime(1975, 12, 21, 0, 0, 0);
                user.Email = john.Email;

                BaseTest._matrix = this.Api.Users.Create(user);
            }
            return(BaseTest._matrix);
        }
        public void WhenCreatingValidLegalUser_ItShouldReturnLegalUserDto()
        {
            // Arrange:
            UserLegalPostDTO user = new UserLegalPostDTO(
                "*****@*****.**",
                "MartixSampleOrg",
                "345",
                LegalPersonType.BUSINESS,
                "JohnUbo",
                "DoeUbo",
                new DateTime(1975, 12, 21, 0, 0, 0),
                CountryIso.PL,
                CountryIso.PL)
            {
                HeadquartersAddress = new Address
                {
                    AddressLine1 = "Address line ubo 1",
                    AddressLine2 = "Address line ubo 2",
                    City         = "CityUbo",
                    Country      = CountryIso.PL,
                    PostalCode   = "11222",
                    Region       = "RegionUbo"
                },

                LegalRepresentativeAddress = new Address
                {
                    AddressLine1 = "Address line ubo 1",
                    AddressLine2 = "Address line ubo 2",
                    City         = "CityUbo",
                    Country      = CountryIso.PL,
                    PostalCode   = "11222",
                    Region       = "RegionUbo"
                },

                LegalRepresentativeEmail    = "*****@*****.**",
                LegalRepresentativeBirthday = new DateTime(1975, 12, 21, 0, 0, 0),
                Email = "*****@*****.**"
            };

            // Act:
            var result = _objectToTest.Create(user).Result;

            // Assert:
            Assert.NotNull(result);
            Assert.IsType <UserLegalDTO>(result);
            Assert.True(!string.IsNullOrEmpty(result.Id));
        }
Exemplo n.º 4
0
        protected UserLegalDTO GetMatrix()
        {
            if (BaseTest._matrix == null)
            {
                UserNaturalDTO   john = this.GetJohn();
                UserLegalPostDTO user = new UserLegalPostDTO(john.Email, "MartixSampleOrg", LegalPersonType.BUSINESS, john.FirstName, john.LastName, john.Birthday, john.Nationality, john.CountryOfResidence);
                user.HeadquartersAddress = new Address {
                    AddressLine1 = "Address line 1", AddressLine2 = "Address line 2", City = "City", Country = CountryIso.PL, PostalCode = "11222", Region = "Region"
                };
                user.LegalRepresentativeAddress  = john.Address;
                user.LegalRepresentativeEmail    = john.Email;
                user.LegalRepresentativeBirthday = new DateTime(1975, 12, 21, 0, 0, 0);
                user.Email = john.Email;

                BaseTest._matrix = this.Api.Users.Create(user);
            }
            return(BaseTest._matrix);
        }
Exemplo n.º 5
0
        public async Task Test_Users_CreateLegal_PassesIfRequiredPropsProvided()
        {
            try
            {
                UserLegalPostDTO userPost = new UserLegalPostDTO("*****@*****.**", "SomeOtherSampleOrg", LegalPersonType.BUSINESS, "RepFName", "RepLName", new DateTime(1975, 12, 21, 0, 0, 0), CountryIso.FR, CountryIso.FR);

                UserLegalDTO userCreated = await this.Api.Users.Create(userPost);

                UserLegalDTO userGet = await this.Api.Users.GetLegal(userCreated.Id);

                Assert.IsTrue(userCreated.Id.Length > 0, "Created successfully after required props set.");

                AssertEqualInputProps(userCreated, userGet);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public void Test_Users_CreateLegal_PassesIfRequiredPropsProvided()
        {
            try
            {
                UserLegalPostDTO userPost = new UserLegalPostDTO("*****@*****.**", "SomeOtherSampleOrg", "77272", LegalPersonType.BUSINESS, "RepFName", "RepLName", new DateTime(1975, 12, 21, 0, 0, 0), CountryIso.FR, CountryIso.FR);

                UserLegalDTO userCreated = _objectToTest.Create(userPost).Result;

                UserLegalDTO userGet = _objectToTest.GetLegal(userCreated.Id).Result;

                Assert.True(userCreated.Id.Length > 0, "Created successfully after required props set.");

                TestHelper.AssertEqualInputProps(userCreated, userGet);
            }
            catch (Exception ex)
            {
                Assert.True(false, ex.Message);
            }
        }
Exemplo n.º 7
0
        protected static UserLegalPostDTO CreateUserLegalPost()
        {
            UserLegalPostDTO user = new UserLegalPostDTO(
                "*****@*****.**",
                "MartixSampleOrg",
                LegalPersonType.BUSINESS,
                "JohnUbo",
                "DoeUbo",
                new DateTime(1975, 12, 21, 0, 0, 0),
                CountryIso.PL,
                CountryIso.PL);

            user.HeadquartersAddress = new Address
            {
                AddressLine1 = "Address line ubo 1",
                AddressLine2 = "Address line ubo 2",
                City         = "CityUbo",
                Country      = CountryIso.PL,
                PostalCode   = "11222",
                Region       = "RegionUbo"
            };

            user.LegalRepresentativeAddress = new Address
            {
                AddressLine1 = "Address line ubo 1",
                AddressLine2 = "Address line ubo 2",
                City         = "CityUbo",
                Country      = CountryIso.PL,
                PostalCode   = "11222",
                Region       = "RegionUbo"
            };

            user.LegalRepresentativeEmail    = "*****@*****.**";
            user.LegalRepresentativeBirthday = new DateTime(1975, 12, 21, 0, 0, 0);
            user.Email = "*****@*****.**";
            return(user);
        }
Exemplo n.º 8
0
 /// <summary>Creates new user.</summary>
 /// <param name="idempotencyKey">Idempotency key for this request.</param>
 /// <param name="user">UserLegal object to be created.</param>
 /// <returns>UserLegal instance returned from API.</returns>
 public UserLegalDTO Create(String idempotencyKey, UserLegalPostDTO user)
 {
     return(this.CreateObject <UserLegalDTO, UserLegalPostDTO>(idempotencyKey, MethodKey.UsersCreateLegals, user));
 }
Exemplo n.º 9
0
 /// <summary>Creates new user.</summary>
 /// <param name="user">UserLegal object to be created.</param>
 /// <returns>UserLegal instance returned from API.</returns>
 public UserLegalDTO Create(UserLegalPostDTO user)
 {
     return(Create(null, user));
 }
Exemplo n.º 10
0
 /// <summary>Creates new user.</summary>
 /// <param name="idempotencyKey">Idempotency key for this request.</param>
 /// <param name="user">UserLegal object to be created.</param>
 /// <returns>UserLegal instance returned from API.</returns>
 public async Task <UserLegalDTO> Create(String idempotencyKey, UserLegalPostDTO user)
 {
     return(await this.CreateObject <UserLegalDTO, UserLegalPostDTO>(idempotencyKey, MethodKey.UsersCreateLegals, user));
 }
Exemplo n.º 11
0
 /// <summary>Creates new user.</summary>
 /// <param name="user">UserLegal object to be created.</param>
 /// <returns>UserLegal instance returned from API.</returns>
 public async Task <UserLegalDTO> Create(UserLegalPostDTO user)
 {
     return(await Create(null, user));
 }
        public async Task <UserLegalDTO> Create(UserLegalPostDTO user)
        {
            var targetUrl = $"{_baseUrl}/users/legal/";

            return(await CreateEntity <UserLegalDTO, UserLegalPostDTO>(targetUrl, user));
        }
Exemplo n.º 13
0
 /// <summary>Creates new user.</summary>
 /// <param name="user">UserLegal object to be created.</param>
 /// <returns>UserLegal instance returned from API.</returns>
 public UserLegalDTO Create(UserLegalPostDTO user)
 {
     return(this.CreateObject <UserLegalDTO, UserLegalPostDTO>(MethodKey.UsersCreateLegals, user));
 }