public void ValidRegisterShouldCreateANewUser() { // se ruleaza in Package Manager Console pt InMEmoryDatabases : // Install -Package Microsoft.EntityFrameworkCore.InMemory var options = new DbContextOptionsBuilder <ExamenDbContext>() .UseInMemoryDatabase(databaseName: nameof(ValidRegisterShouldCreateANewUser))// "ValidRegisterShouldCreateANewUser") .Options; using (var context = new ExamenDbContext(options)) { var usersService = new UsersService(context, config); var added = new WebApplication3.ViewModels.RegisterPostModel { Email = "*****@*****.**", FirstName = "corina", LastName = "sofron", Password = "******", Username = "******" }; var result = usersService.Register(added); Assert.IsNotNull(result); Assert.AreEqual(added.Username, result.UserName); } }
public ExamenDbContextBuilder ConfigureInMemory() { var options = new DbContextOptionsBuilder <ExamenDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; _context = new ExamenDbContext(options); return(this); }
private void AddArtists(ExamenDbContext context, int quantity) { var ArtistList = A.ListOf <Models.Artist>(quantity); for (int i = 1; i <= quantity; i++) { ArtistList[i - 1].ArtistId = i; } context.Artists.AddRange(ArtistList); context.SaveChanges(); }
private void AddEmployees(ExamenDbContext context, int quantity) { var EmployeeList = A.ListOf <Models.Employee>(quantity); for (int i = 1; i <= quantity; i++) { EmployeeList[i - 1].EmployeeId = i; } context.Employees.AddRange(EmployeeList); context.SaveChanges(); }
private void AddMediaTypes(ExamenDbContext context, int quantity) { var MediaTypeList = A.ListOf <Models.MediaType>(quantity); for (int i = 1; i <= quantity; i++) { MediaTypeList[i - 1].MediaTypeId = i; } context.MediaTypes.AddRange(MediaTypeList); context.SaveChanges(); }
private void AddTracks(ExamenDbContext context, int quantity) { var TrackList = A.ListOf <Models.Track>(quantity); for (int i = 1; i <= quantity; i++) { TrackList[i - 1].TrackId = i; } context.Tracks.AddRange(TrackList); context.SaveChanges(); }
private void AddAlbums(ExamenDbContext context, int quantity) { var AlbumList = A.ListOf <Models.Album>(quantity); for (int i = 1; i <= quantity; i++) { AlbumList[i - 1].AlbumId = i; } context.Albums.AddRange(AlbumList); context.SaveChanges(); }
private void AddCustomers(ExamenDbContext context, int quantity) { var customerList = A.ListOf <Models.Customer>(quantity); for (int i = 1; i <= quantity; i++) { customerList[i - 1].CustomerId = i; } context.Customers.AddRange(customerList); context.SaveChanges(); }
private void AddGenres(ExamenDbContext context, int quantity) { var GenreList = A.ListOf <Models.Genre>(quantity); for (int i = 1; i <= quantity; i++) { GenreList[i - 1].GenreId = i; } context.Genres.AddRange(GenreList); context.SaveChanges(); }
private void AddInvoices(ExamenDbContext context, int quantity) { var InvoiceList = A.ListOf <Models.Invoice>(quantity); for (int i = 1; i <= quantity; i++) { InvoiceList[i - 1].InvoiceId = i; } context.Invoices.AddRange(InvoiceList); context.SaveChanges(); }
private void AddPlayListTracks(ExamenDbContext context, int quantity) { var PlayListTrackList = A.ListOf <Models.PlayListTrack>(quantity); for (int i = 1; i <= quantity; i++) { PlayListTrackList[i - 1].PlaylistId = i; PlayListTrackList[i - 1].TrackId = i; } context.PlayListTracks.AddRange(PlayListTrackList); context.SaveChanges(); }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new ExamenDbContext(serviceProvider.GetRequiredService <DbContextOptions <ExamenDbContext> >())) { // Look for any movies. if (context.Persons.Any()) { return; // DB has been seeded } context.Persons.AddRange( new Person { Name = "Szabi", Surname = "Iamandi", PhoneNumber = "0748105660", Email = "*****@*****.**", }, new Person { Name = "Karina", Surname = "Iamandi", PhoneNumber = "0747036039", Email = "*****@*****.**", }, new Person { Name = "Stefi", Surname = "Iamandi", PhoneNumber = "0740159322", Email = "*****@*****.**", } ); context.SaveChanges(); } }
public UsuariosController(ExamenDbContext context) { _context = context; }
public PackagesService(ExamenDbContext context) { this.context = context; }
public CalibrationsController(ExamenDbContext context) { _context = context; }
public InspectionPlansController(ExamenDbContext context) { _context = context; }
public Repository(ExamenDbContext db) { _db = db; }
public ProductosController(ExamenDbContext context) { _context = context; }
public PeopleController(ExamenDbContext context) { _context = context; }
public EquipmentsController(ExamenDbContext context) { _context = context; }
public UsersService(ExamenDbContext context, IOptions <AppSettings> appSettings) { this.context = context; this.appSettings = appSettings.Value; }
public PersonsController(ExamenDbContext context) { _context = context; }
public PedidosController(ExamenDbContext context) { _context = context; }