Пример #1
0
        public async Task Should_Be_Able_To_Create_A_Customer()
        {
            var userCreateDto = new UserCreateDto
            {
                Name         = "CustomerOne",
                Surname      = "Consumer",
                EmailAddress = "*****@*****.**",
                PhoneNumber  = "0760000000",
                UserName     = "******",
                Password     = "******"
            };

            await CustomerAccountAppService.RegisterAsync(userCreateDto);

            var userDto = await IdentityUserAppService.FindByUsernameAsync(userCreateDto.UserName);

            userDto.ShouldNotBeNull();

            userDto.Name.ShouldBe(userCreateDto.Name);
            userDto.Surname.ShouldBe(userCreateDto.Surname);
            userDto.Email.ShouldBe(userCreateDto.EmailAddress);
            userDto.PhoneNumber.ShouldBe(userCreateDto.PhoneNumber);

            var roles = (await IdentityUserAppService.GetRolesAsync(userDto.Id)).Items;

            roles.ShouldContain(role => role.Name == RolesConsts.Customer);

            var customerDto = await CustomerAppService.GetCustomerByUserId(userDto.Id);

            customerDto.ShouldNotBeNull("CustomerEntity must not be null");
            customerDto.Status.ShouldBe(EntityStatusConsts.Active);
        }
Пример #2
0
 public async Task <AppUserDto> Create([FromBody] UserCreateDto dto)
 {
     return(await CustomerAccountAppService.RegisterAsync(dto));
 }