public static UserRole ToUserRole(UserRolePostModel userRolePostModel) { return(new UserRole { Name = userRolePostModel.Name, Description = userRolePostModel.Description }); }
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); } }