public void Setup() { var options = new DbContextOptionsBuilder <GolfDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; _context = new GolfDbContext(options); _createdAt = DateTime.Now; var scores = new List <Score>() { new Score() { Id = new Guid("00000000-0000-0000-0000-000000000001"), PlayerId = new Guid("00000000-0000-0000-0001-000000000000"), Value = 45, GolfRoundId = new Guid("00000000-0000-0001-0000-000000000000"), Created = _createdAt, }, new Score() { Id = new Guid("00000000-0000-0000-0000-000000000002"), PlayerId = new Guid("00000000-0000-0000-0002-000000000000"), Value = 63, GolfRoundId = new Guid("00000000-0000-0001-0000-000000000000"), Created = _createdAt, }, new Score() { Id = new Guid("00000000-0000-0000-0000-000000000003"), PlayerId = new Guid("00000000-0000-0000-0001-000000000000"), Value = 40, GolfRoundId = new Guid("00000000-0000-0002-0000-000000000000"), Created = _createdAt, }, new Score() { Id = new Guid("00000000-0000-0000-0000-000000000004"), PlayerId = new Guid("00000000-0000-0000-0002-000000000000"), Value = 57, GolfRoundId = new Guid("00000000-0000-0003-0000-000000000000"), Created = _createdAt, } }.AsQueryable(); _context.Scores.AddRange(scores); _context.SaveChanges(); _sut = new ScoreAccessLayer(_context); }
public void Setup() { var options = new DbContextOptionsBuilder <GolfDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; _context = new GolfDbContext(options); _createdAt = DateTime.Now; _modifiedAt = DateTime.Now; var players = new List <Player>() { new Player() { Id = new Guid("00000000-0000-0000-0000-000000000001"), UserId = new Guid("00000000-0000-0000-0001-000000000000"), FirstName = "Thashin", LastName = "Naidoo", Handicap = new Decimal(19.3), Created = _createdAt, Modified = _modifiedAt }, new Player() { Id = new Guid("00000000-0000-0000-0000-000000000002"), UserId = new Guid("00000000-0000-0000-0002-000000000000"), FirstName = "Michael", LastName = "Nelmes", Handicap = new Decimal(24.8), Created = _createdAt, Modified = _modifiedAt } }.AsQueryable(); _context.Players.AddRange(players); _context.SaveChanges(); var userOptions = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; var userContext = new ApplicationDbContext(userOptions); userContext.Add(new ApplicationUser() { Id = "00000000-0000-0000-0003-000000000000" }); userContext.SaveChanges(); _sut = new PlayerAccessLayer(_context, userContext); }
public void Setup() { var options = new DbContextOptionsBuilder <GolfDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; _context = new GolfDbContext(options); _createdAt = DateTime.Now; var golfRounds = new List <GolfRound>() { new GolfRound() { Id = new Guid("00000000-0000-0000-0000-000000000001"), Date = _createdAt, CourseId = new Guid("00000000-0000-0000-0001-000000000000"), Created = _createdAt, }, new GolfRound() { Id = new Guid("00000000-0000-0000-0000-000000000002"), Date = _createdAt, CourseId = new Guid("00000000-0000-0000-0002-000000000000"), Created = _createdAt, }, new GolfRound() { Id = new Guid("00000000-0000-0000-0000-000000000003"), Date = _createdAt, CourseId = new Guid("00000000-0000-0000-0001-000000000000"), Created = _createdAt, }, new GolfRound() { Id = new Guid("00000000-0000-0000-0000-000000000004"), Date = _createdAt, CourseId = new Guid("00000000-0000-0000-0003-000000000000"), Created = _createdAt, }, }.AsQueryable(); _context.GolfRounds.AddRange(golfRounds); _context.SaveChanges(); _sut = new GolfRoundAccessLayer(_context); }
public void Setup() { var options = new DbContextOptionsBuilder <GolfDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; _context = new GolfDbContext(options); _createdAt = DateTime.Now; var Handicaps = new List <Handicap>() { new Handicap() { Id = new Guid("00000000-0000-0000-0000-000000000001"), PlayerId = new Guid("00000000-0000-0000-0001-000000000000"), CurrentHandicap = 23, Value = 45, Date = _createdAt }, new Handicap() { Id = new Guid("00000000-0000-0000-0000-000000000002"), PlayerId = new Guid("00000000-0000-0000-0002-000000000000"), CurrentHandicap = 18, Value = 19, Date = _createdAt }, new Handicap() { Id = new Guid("00000000-0000-0000-0000-000000000003"), PlayerId = new Guid("00000000-0000-0000-0001-000000000000"), CurrentHandicap = 20, Value = 15, Date = _createdAt.AddDays(1) } }.AsQueryable(); _context.Handicaps.AddRange(Handicaps); _context.SaveChanges(); _sut = new HandicapAccessLayer(_context); }
public void Setup() { var options = new DbContextOptionsBuilder <GolfDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; _context = new GolfDbContext(options); _createdAt = DateTime.Now; _modifiedAt = DateTime.Now; var players = new List <Player>() { new Player() { Id = new Guid("00000000-0000-0000-0000-000000000001"), UserId = new Guid("00000000-0000-0000-0001-000000000000"), FirstName = "Thashin", LastName = "Naidoo", Handicap = new Decimal(19.3), Created = _createdAt, Modified = _modifiedAt }, new Player() { Id = new Guid("00000000-0000-0000-0000-000000000002"), UserId = new Guid("00000000-0000-0000-0002-000000000000"), FirstName = "Michael", LastName = "Nelmes", Handicap = new Decimal(24.8), Created = _createdAt, Modified = _modifiedAt }, new Player() { Id = new Guid("00000000-0000-0000-0000-000000000003"), UserId = new Guid("00000000-0000-0000-0003-000000000000"), FirstName = "Adam", LastName = "Van Halsdingen", Handicap = new Decimal(44.8), Created = _createdAt, Modified = _modifiedAt }, new Player() { Id = new Guid("00000000-0000-0000-0000-000000000004"), UserId = new Guid("00000000-0000-0000-0004-000000000000"), FirstName = "Jake", LastName = "Hannell", Handicap = null, Created = _createdAt, Modified = _modifiedAt } }.AsQueryable(); var partners = new List <Partner>() { new Partner() { Id = new Guid("00000000-0000-0000-0000-000000000001"), PlayerId = new Guid("00000000-0000-0000-0000-000000000001"), PartnerId = new Guid("00000000-0000-0000-0000-000000000002") }, new Partner() { Id = new Guid("00000000-0000-0000-0000-000000000002"), PlayerId = new Guid("00000000-0000-0000-0000-000000000002"), PartnerId = new Guid("00000000-0000-0000-0000-000000000001") }, new Partner() { Id = new Guid("00000000-0000-0000-0000-000000000003"), PlayerId = new Guid("00000000-0000-0000-0000-000000000002"), PartnerId = new Guid("00000000-0000-0000-0000-000000000003") }, new Partner() { Id = new Guid("00000000-0000-0000-0000-000000000004"), PlayerId = new Guid("00000000-0000-0000-0000-000000000002"), PartnerId = new Guid("00000000-0000-0000-0000-000000000004") }, new Partner() { Id = new Guid("00000000-0000-0000-0000-000000000005"), PlayerId = new Guid("00000000-0000-0000-0000-000000000003"), PartnerId = new Guid("00000000-0000-0000-0000-000000000001") } }.AsQueryable(); _context.Players.AddRange(players); _context.Partners.AddRange(partners); _context.SaveChanges(); _sut = new PartnerAccessLayer(_context); }
public void Setup() { var options = new DbContextOptionsBuilder <GolfDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; _context = new GolfDbContext(options); _createdAt = DateTime.Now; var courses = new List <Course>() { new Course() { Id = new Guid("00000000-0000-0000-0000-000000000001"), Name = "Wembley Golf Course", Created = _createdAt, Holes = "18", Location = "Western Australia", Par = 72, ScratchRating = 70, Slope = 120, TeeName = "Blue Men" }, new Course() { Id = new Guid("00000000-0000-0000-0000-000000000002"), Name = "Point Walter", Created = _createdAt, Holes = "1-9", Location = "Western Australia", Par = 35, ScratchRating = 34, Slope = 115, TeeName = "Blue Men" }, new Course() { Id = new Guid("00000000-0000-0000-0000-000000000003"), Name = "Point Walter", Created = _createdAt, Holes = "18", Location = "Western Australia", Par = 35, ScratchRating = 34, Slope = 115, TeeName = "Blue Men" }, new Course() { Id = new Guid("00000000-0000-0000-0000-000000000004"), Name = "Point Walter", Created = _createdAt, Holes = "1-9", Location = "Western Australia", Par = 35, ScratchRating = 34, Slope = 117, TeeName = "Red Women" } }.AsQueryable(); _context.Courses.AddRange(courses); _context.SaveChanges(); _sut = new CourseAccessLayer(_context); }