Example #1
0
        public async Task Test_Users_GetNatural_FailsForLegalUser()
        {
            UserLegalDTO matrix = null;

            try
            {
                matrix = await this.GetMatrix();
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }

            UserNaturalDTO user = null;

            try
            {
                user = await this.Api.Users.GetNatural(matrix.Id);

                Assert.Fail("GetUser() should throw an exception when called with legal user id.");
            }
            catch (ResponseException)
            {
                Assert.IsNull(user);
            }
        }
Example #2
0
        public async Task Test_Users_Save_Legal()
        {
            try
            {
                UserLegalDTO matrix = await this.GetMatrix();

                UserLegalPutDTO matrixPut = new UserLegalPutDTO
                {
                    Tag                                   = matrix.Tag,
                    Email                                 = matrix.Email,
                    Name                                  = matrix.Name,
                    LegalPersonType                       = matrix.LegalPersonType,
                    HeadquartersAddress                   = matrix.HeadquartersAddress,
                    LegalRepresentativeFirstName          = matrix.LegalRepresentativeFirstName,
                    LegalRepresentativeLastName           = matrix.LegalRepresentativeLastName + " - CHANGED",
                    LegalRepresentativeAddress            = matrix.LegalRepresentativeAddress,
                    LegalRepresentativeEmail              = matrix.LegalRepresentativeEmail,
                    LegalRepresentativeBirthday           = matrix.LegalRepresentativeBirthday,
                    LegalRepresentativeNationality        = matrix.LegalRepresentativeNationality,
                    LegalRepresentativeCountryOfResidence = matrix.LegalRepresentativeCountryOfResidence
                };

                UserLegalDTO userSaved = await this.Api.Users.UpdateLegal(matrixPut, matrix.Id);

                UserLegalDTO userFetched = await this.Api.Users.GetLegal(userSaved.Id);

                Assert.AreEqual(matrixPut.LegalRepresentativeLastName, userFetched.LegalRepresentativeLastName);
                AssertEqualInputProps(userSaved, userFetched);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public void Test_Users_Save_Legal()
        {
            try
            {
                UserLegalDTO matrix = TestHelper.GetMatrix();

                UserLegalPutDTO matrixPut = new UserLegalPutDTO
                {
                    Tag                                   = matrix.Tag,
                    Email                                 = matrix.Email,
                    Name                                  = matrix.Name,
                    LegalPersonType                       = matrix.LegalPersonType,
                    HeadquartersAddress                   = matrix.HeadquartersAddress,
                    LegalRepresentativeFirstName          = matrix.LegalRepresentativeFirstName,
                    LegalRepresentativeLastName           = matrix.LegalRepresentativeLastName + " - CHANGED",
                    LegalRepresentativeAddress            = matrix.LegalRepresentativeAddress,
                    LegalRepresentativeEmail              = matrix.LegalRepresentativeEmail,
                    LegalRepresentativeBirthday           = matrix.LegalRepresentativeBirthday,
                    LegalRepresentativeNationality        = matrix.LegalRepresentativeNationality,
                    LegalRepresentativeCountryOfResidence = matrix.LegalRepresentativeCountryOfResidence
                };

                UserLegalDTO userSaved   = _objectToTest.UpdateLegal(matrixPut, matrix.Id).Result;
                UserLegalDTO userFetched = _objectToTest.GetLegal(userSaved.Id).Result;

                Assert.Equal(matrixPut.LegalRepresentativeLastName, userFetched.LegalRepresentativeLastName);
                TestHelper.AssertEqualInputProps(userSaved, userFetched);
            }
            catch (Exception ex)
            {
                Assert.True(false, ex.Message);
            }
        }
 public void Test_Users_CreateLegal()
 {
     try
     {
         UserLegalDTO matrix = this.GetMatrix();
         Assert.IsTrue(matrix.Id.Length > 0);
         Assert.IsTrue(matrix.PersonType == PersonType.LEGAL);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
 public void Test_Users_CreateLegal()
 {
     try
     {
         UserLegalDTO matrix = TestHelper.GetMatrix();
         Assert.True(matrix.Id.Length > 0);
         Assert.True(matrix.PersonType == PersonType.LEGAL);
     }
     catch (Exception ex)
     {
         Assert.True(false, ex.Message);
     }
 }
Example #6
0
        public async Task Test_Users_GetLegal()
        {
            try
            {
                UserLegalDTO matrix = await this.GetMatrix();

                UserDTO userLegal = await this.Api.Users.GetLegal(matrix.Id);

                AssertEqualInputProps((UserLegalDTO)userLegal, matrix);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public void Test_Users_GetLegal()
        {
            try
            {
                UserLegalDTO matrix = TestHelper.GetMatrix();

                UserDTO userLegal = _objectToTest.GetLegal(matrix.Id).Result;

                TestHelper.AssertEqualInputProps((UserLegalDTO)userLegal, matrix);
            }
            catch (Exception ex)
            {
                Assert.True(false, ex.Message);
            }
        }
Example #8
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 async Task Test_Users_GetNatural_FailsForLegalUser()
        {
            UserLegalDTO matrix = null;

            matrix = TestHelper.GetMatrix();

            ResponseException ex = await Assert.ThrowsAsync <ResponseException>(() => _objectToTest.GetNatural(matrix.Id));

            // Assert:
            Assert.Equal(404, ex.ResponseStatusCode);
            Assert.NotNull(ex.Message);
            Assert.NotNull(ex.ResponseErrorRaw);
            Assert.NotNull(ex.ResponseError);
            Assert.NotEmpty(ex.ResponseError.errors);
            Assert.True(ex.ResponseError.errors.ContainsKey("RessourceNotFound"));
        }
Example #10
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);
        }
Example #11
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);
            }
        }