Example #1
0
        public async Task Should_Get_Album_By_Id()
        {
            mockRepository = new Moq.Mock <Backend.Repository.IAlbumRepository>();
            controller     = new Backend.Controllers.AlbumController(mockRepository.Object);

            Album album = Builder <Album> .CreateNew().Build();

            mockRepository.Setup(x => x.GetById(It.IsAny <Guid>())).ReturnsAsync(album);

            var result = await controller.GetAlbum(Guid.NewGuid());

            result.Should().NotBeNull();
            (result as OkObjectResult).StatusCode.Should().Be(200);
        }
Example #2
0
        public async Task Should_Get_Albums()
        {
            mockRepository = new Moq.Mock <Backend.Repository.IAlbumRepository>();
            controller     = new Backend.Controllers.AlbumController(mockRepository.Object);

            IList <Album> albums = Builder <Album> .CreateListOfSize(10).Build();

            mockRepository.Setup(x => x.GetAll()).ReturnsAsync(albums);

            var result = await controller.Get();

            result.Should().NotBeNull();
            (result as OkObjectResult).StatusCode.Should().Be(200);
        }