public void CreateFakeData(BaseballDBContext database) { _firstPerson = new Fielding() { Pos = "2B", YearId = 2000, A = 20, E = 100, PlayerId = "id" }; _secondPerson = new Fielding() { Pos = "P", YearId = 2001, A = 10, E = 200, PlayerId = "anotherId" }; _duplicatePerson = new Fielding() { Pos = "C", YearId = 1999, A = 18, E = 99, PlayerId = "id" }; _database.Add(_firstPerson); _database.Add(_secondPerson); _database.Add(_duplicatePerson); _database.SaveChanges(); }
public void SetUp() { _options = new DbContextOptionsBuilder<BaseballDBContext>() .UseInMemoryDatabase(databaseName: "PlayerServiceTests") .Options; _database = new BaseballDBContext(_options); _database.Database.EnsureDeleted(); _mockMapper = new Mock<IPlayerMapper>(); _service = new PlayerService(_database, _mockMapper.Object); CreateFakeData(_database); }
public void CreateFakeData(BaseballDBContext database) { _firstPersonPost = new BattingPost() { YearId = 2000, Hr = 20, Ab = 100, PlayerId = "id", Round = "WC" }; _secondPersonPost = new BattingPost() { YearId = 2000, Hr = 10, Ab = 200, PlayerId = "anotherId", Round = "WS" }; _thirdPersonPost = new BattingPost() { YearId = 1999, Hr = 18, Ab = 99, PlayerId = "id", Round = "WC" }; _fourthPersonPost = new BattingPost() { YearId = 1998, Hr = 18, Ab = 20, PlayerId = "fourthId", Round = "WS", Player = new People() { PlayerId = "fourthId", NameFirst = "first", NameGiven = "first middle", NameLast = "last" } }; _database.Add(_firstPersonPost); _database.Add(_secondPersonPost); _database.Add(_thirdPersonPost); _database.Add(_fourthPersonPost); _database.SaveChanges(); }
public void CreateFakeData(BaseballDBContext database) { _firstPerson = new Pitching() { YearId = 2000, Hr = 20, W = 10, PlayerId = "id" }; _secondPerson = new Pitching() { YearId = 2000, Hr = 10, W = 3, PlayerId = "anotherId" }; _thirdPerson = new Pitching() { YearId = 1999, Hr = 18, W = 99, PlayerId = "id" }; _fourthPerson = new Pitching() { YearId = 1998, Hr = 18, W = 20, PlayerId = "fourthId", Player = new People() { PlayerId = "fourthId", NameFirst = "first", NameGiven = "first middle", NameLast = "last" } }; _database.Add(_firstPerson); _database.Add(_secondPerson); _database.Add(_thirdPerson); _database.Add(_fourthPerson); _database.SaveChanges(); }
public void CreateFakeData(BaseballDBContext database) { _firstPerson = new People() { NameFirst = "first", NameLast = "last", PlayerId = "id", NameGiven = "first middle" }; _secondPerson = new People() { NameFirst = "anotherFirst", NameLast = "antherLast", PlayerId = "anotherId", NameGiven = "anotherFirst anotherMiddle" }; _database.Add(_firstPerson); _database.Add(_secondPerson); _database.SaveChanges(); }