public static UserDtoResult ConvertTo(this ResultObj <UserDto> internalModel)
        {
            var outputRootModel = new UserDtoResult();

            outputRootModel.Success  = internalModel.Success;
            outputRootModel.Data     = internalModel.Data;
            outputRootModel.Messages = internalModel.Messages;
            return(outputRootModel);
        }
示例#2
0
        public UserTest()
        {
            const string VALID_CPF             = "12345678909";
            const string VALID_CPF_UPDATE      = "51955314047";
            const string VALID_PASSWORD        = "******";
            const string VALID_PASSWORD_UPDATE = "teste321";

            Id       = Guid.NewGuid();
            Name     = Faker.Name.FullName();
            Email    = Faker.Internet.Email();
            Cpf      = VALID_CPF;
            Password = BCrypt.Net.BCrypt.HashPassword(VALID_PASSWORD, BCrypt.Net.BCrypt.GenerateSalt());

            ChangedName     = Faker.Name.FullName();
            ChangedEmail    = Faker.Internet.Email();
            ChangedCpf      = VALID_CPF_UPDATE;
            ChangedPassword = BCrypt.Net.BCrypt.HashPassword(VALID_PASSWORD_UPDATE, BCrypt.Net.BCrypt.GenerateSalt());

            for (int i = 0; i < 5; i++)
            {
                var dto = new UserDtoResult()
                {
                    Id    = Guid.NewGuid(),
                    Name  = Faker.Name.FullName(),
                    Email = Faker.Internet.Email(),
                    Cpf   = Cpf
                };

                listUserDtoResult.Add(dto);
            }

            userDto = new UserDto()
            {
                Name     = Name,
                Email    = Email,
                Cpf      = Cpf,
                Password = Password
            };

            userDtoUpdate = new UserDto()
            {
                Name     = ChangedName,
                Email    = ChangedEmail,
                Cpf      = ChangedCpf,
                Password = ChangedPassword
            };

            userDtoResult = new UserDtoResult()
            {
                Id    = Id,
                Name  = Name,
                Email = Email,
                Cpf   = Cpf
            };

            userDtoResultUpdate = new UserDtoResult()
            {
                Id    = Id,
                Name  = ChangedName,
                Email = ChangedEmail,
                Cpf   = ChangedCpf
            };
        }