public void GetTaskBoard_OnNonExistingTaskBoard_ReturnsNull() { // ARRANGE DbContextOptions <TestDatabaseContext> options = new DbContextOptionsBuilder <TestDatabaseContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; IDatabaseContext dbContext = new TestDatabaseContext(options); TaskBoardRepository repository = new TaskBoardRepository(dbContext); // ACT TaskBoardPublic taskBoardPublic = repository.GetTaskBoard(1); // ASSERT taskBoardPublic.Should().BeNull(); }
public void GetTaskBoard_OnExistingTaskBoard_ReturnsTaskBoard() { // ARRANGE DbContextOptions <TestDatabaseContext> options = new DbContextOptionsBuilder <TestDatabaseContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; IDatabaseContext dbContext = new TestDatabaseContext(options); TaskBoardRepository repository = new TaskBoardRepository(dbContext); TaskBoardConverter converter = new TaskBoardConverter(dbContext); TaskBoard taskBoard = new TaskBoard() { Name = Guid.NewGuid().ToString(), }; dbContext.TaskBoards.Add(taskBoard); dbContext.SaveChanges(); // ACT TaskBoardPublic taskBoardPublic = repository.GetTaskBoard(1); // ASSERT taskBoardPublic.Should().BeEquivalentTo <TaskBoardPublic>(converter.Convert(taskBoard)); }