Esempio n. 1
0
        public void EditRelease_EditedSuccessfull_returnsRelease()
        {
            var release = CreateSampleRelease();

            mockReleaseEngine.Setup(x => x.EditRelease(release))
            .Returns(true);

            mockReleaseEngine.Setup(x => x.ReleaseExists(release.ReleaseId))
            .Returns(true);

            ReleaseLogic releaseLogic = new ReleaseLogic(mockReleaseEngine.Object);

            bool expected = true;
            bool actual   = releaseLogic.EditRelease(release);

            Assert.Equal(expected, actual);
            mockReleaseEngine.Verify(x => x.EditRelease(release), Times.Once);
        }
Esempio n. 2
0
        public void EditRelease_ReleaseDoesNotExists_ThrowsException()
        {
            var release = CreateSampleRelease();

            mockReleaseEngine.Setup(x => x.EditRelease(release))
            .Returns(true);

            mockReleaseEngine.Setup(x => x.ReleaseExists(release.ReleaseId))
            .Returns(false);

            ReleaseLogic ReleaseLogic = new ReleaseLogic(mockReleaseEngine.Object);

            Action act = () => { ReleaseLogic.EditRelease(release); };

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

            mockReleaseEngine.Verify(x => x.EditRelease(release), Times.Never);
        }