public RolesControllerPutTests(ITestOutputHelper output, Request <Startup> request, DbContextFactory contextFactory)
        {
            this.output  = output;
            this.request = request;
            this.context = contextFactory.Context;

            Description = "New Description";

            var role = new Role {
                Description = "Description"
            };

            context.Roles.Add(role);
            context.SaveChanges();

            Id = role.Id;

            context = contextFactory.GetRefreshContext();

            var user = new User()
            {
                Email    = "",
                Name     = "",
                Lastname = "",
                Id       = 1
            };

            Token = request.Jwt.GenerateToken(user);
        }
Ejemplo n.º 2
0
        public CategoriesControllerDeleteTests(Request <Startup> request, DbContextFactory contextFactory, ITestOutputHelper output)
        {
            this.request = request;
            this.context = contextFactory.Context;
            this.output  = output;

            var category = new Category {
                Description = "Description"
            };

            context.Add(category);
            context.SaveChanges();

            Id = category.Id;

            context = contextFactory.GetRefreshContext();

            var user = new User()
            {
                Email    = "",
                Name     = "",
                Lastname = "",
                Id       = 1
            };

            Token = request.Jwt.GenerateToken(user);
        }
        public UsersControllerTests(ITestOutputHelper output, Request <Startup> request, DbContextFactory contextFactory)
        {
            this.output  = output;
            this.request = request;
            this.context = contextFactory.Context;

            var role = new Role {
                Description = "Description"
            };

            context.Roles.Add(role);
            context.SaveChanges();
            context = contextFactory.GetRefreshContext();

            userResource = new SaveUserResource
            {
                Email    = "*****@*****.**",
                Name     = "12345",
                Lastname = "1233456",
                Password = "******",
            };

            userResource.Roles.Add(role.Id);
        }
 public void Dispose()
 {
     context.Roles.RemoveRange(context.Roles);
     context.SaveChanges();
 }
Ejemplo n.º 5
0
 public void Dispose()
 {
     context.Categories.RemoveRange(context.Categories);
     context.SaveChanges();
 }