Esempio n. 1
0
        public void DeleteRelease_ReleaseDeleted_ReturnsSuccessfull()
        {
            var Release = CreateSampleRelease();

            mockReleaseEngine.Setup(x => x.RemoveRelease(Release))
            .Returns(true);

            mockReleaseEngine.Setup(x => x.GetRelease(Release.ReleaseId))
            .Returns(Release);

            ReleaseLogic ReleaseLogic = new ReleaseLogic(mockReleaseEngine.Object);

            bool expected = true;
            bool actual   = ReleaseLogic.RemoveRelease(Release.ReleaseId);

            Assert.Equal(expected, actual);

            mockReleaseEngine.Verify(x => x.RemoveRelease(Release), Times.Once);
        }
Esempio n. 2
0
        public void DeleteRelease_ReleaseDoesNotExists_ThrowsException()
        {
            var Release = CreateSampleRelease();

            mockReleaseEngine.Setup(x => x.RemoveRelease(Release))
            .Returns(true);

            mockReleaseEngine.Setup(x => x.GetRelease(1))
            .Returns((Release)null);

            ReleaseLogic ReleaseLogic = new ReleaseLogic(mockReleaseEngine.Object);
            Action       act          = () => { ReleaseLogic.RemoveRelease(Release.ReleaseId); };

            act.Should().Throw <Exception>()
            .And.Message
            .Should().Be("Release does not exists");

            mockReleaseEngine.Verify(x => x.RemoveRelease(Release), Times.Never);
        }