Пример #1
0
        public async void Get_Album_ById_0_Returns_Bad_Request()
        {
            var zeroAlbumId = 0;

            IHttpActionResult model = await ObjectUnderTest.GetAlbumById(zeroAlbumId);

            model.ShouldNotBeNull();
            model.ShouldBeOfType <BadRequestResult>();
            model.ShouldNotBeOfType <OkResult>();
        }
Пример #2
0
        public async void Get_Album_ById_Non_0_Not_Found_Returns_Not_Found()
        {
            var nonZeroAlbumId = 2;

            For <IAlbumService>()
            .Setup(s => s.GetAlbum(It.IsAny <int>()))
            .Returns(Task.FromResult <AlbumModel>(null)).Verifiable();

            IHttpActionResult model = await ObjectUnderTest.GetAlbumById(nonZeroAlbumId);

            model.ShouldNotBeNull();
            model.ShouldNotBeOfType <BadRequestResult>();
            model.ShouldNotBeOfType <OkNegotiatedContentResult <AlbumModel> >();
            model.ShouldBeOfType <NotFoundResult>();
            For <IAlbumService>().Verify();
        }