Example #1
0
        public async Task GetAllBoardsAsync_HandleEmptyResultSet_Success()
        {
            var schedulingRepositoryMock = new Mock <ISchedulingRepository>();

            schedulingRepositoryMock.Setup(m => m.FetchBoardsAsync(null))
            .ReturnsAsync(Enumerable.Empty <SchedulingBoard>().ToList);
            var unitUnderTest = new SchedulingBoardController(schedulingRepositoryMock.Object);

            var result = await unitUnderTest.GetAllBoardsAsync();

            Assert.IsType <OkObjectResult>(result);
            Assert.Empty(((ObjectResult)result).Value as IEnumerable <SchedulingBoard> ?? throw new InvalidCastException());
        }
Example #2
0
        public async Task GetAllBoardsAsync_HandleResponseSet_Success()
        {
            var schedulingRepositoryMock = new Mock <ISchedulingRepository>();

            schedulingRepositoryMock.Setup(m => m.FetchBoardsAsync(null))
            .ReturnsAsync(
                new List <SchedulingBoard>
            {
                new SchedulingBoard(Guid.NewGuid())
            });

            var unitUnderTest = new SchedulingBoardController(schedulingRepositoryMock.Object);

            var result = await unitUnderTest.GetAllBoardsAsync();

            Assert.IsType <OkObjectResult>(result);
        }