コード例 #1
0
        public async void Delete_Album_ById_0_Returns_Bad_Request()
        {
            var zeroAlbumId          = 0;
            IHttpActionResult result = await ObjectUnderTest.DelteAlbum(zeroAlbumId);

            result.ShouldNotBeNull();
            result.ShouldNotBeOfType <OkNegotiatedContentResult <bool> >();
            result.ShouldBeOfType <BadRequestResult>();
        }
コード例 #2
0
        public async void Delete_Album_ById_Non_0_Does_Not_Delete_Returns_False()
        {
            var fix         = new Fixture();
            var album       = fix.Create <AlbumModel>();
            var zeroAlbumId = 4;

            album.Id = zeroAlbumId;

            For <IAlbumService>()
            .Setup(s => s.DeleteAlbum(It.IsAny <int>()))
            .Returns(Task.FromResult <bool>(false)).Verifiable();

            IHttpActionResult result = await ObjectUnderTest.DelteAlbum(album.Id);

            var response = result as OkNegotiatedContentResult <bool>;

            result.ShouldNotBeNull();
            result.ShouldNotBeOfType <BadRequestResult>();
            result.ShouldBeOfType <OkNegotiatedContentResult <bool> >();
            response.Content.ShouldBeFalse();
            For <IAlbumService>().Verify();
        }