Beispiel #1
0
 public static UserRole ToUserRole(UserRolePostModel userRolePostModel)
 {
     return(new UserRole
     {
         Name = userRolePostModel.Name,
         Description = userRolePostModel.Description
     });
 }
Beispiel #2
0
        public void ValidRegisterShouldCreateANewRole()
        {
            var options = new DbContextOptionsBuilder <ExpensesDbContext>()
                          .UseInMemoryDatabase(databaseName: nameof(ValidRegisterShouldCreateANewRole))// "ValidRegisterShouldCreateANewUser")
                          .Options;

            using (var context = new ExpensesDbContext(options))
            {
                UserRoleService userRoleService = new UserRoleService(context);
                var             added           = new Labo2.ViewModels.UserRolePostModel
                {
                    Name        = "Regular",
                    Description = "regular description"
                };
                var result = userRoleService.Create(added);
                Assert.IsNotNull(result);
            }
        }