public void WithSuccessIf_False_SuccessFunction_IsNotCalled()
        {
            var mock = IReasonCreatorMock.GetMock();

            Result.WithSuccessIf <int>(false, () => mock.Object.CreateSuccess());

            mock.Verify(m => m.CreateSuccess(), Times.Never);
        }
        public void WithSuccessIf_True_SuccessFunction_IsCalled()
        {
            var mock = IReasonCreatorMock.GetMock();

            Result.WithSuccessIf <int>(true, () => mock.Object.CreateSuccess());

            mock.Verify(m => m.CreateSuccess(), Times.Once);
        }
Beispiel #3
0
        public void WithErrorIf_False_ErrorFunction_IsNotCalled()
        {
            var mock = IReasonCreatorMock.GetMock();

            Result.WithErrorIf(false, () => mock.Object.CreateError());

            mock.Verify(m => m.CreateError(), Times.Never);
        }
Beispiel #4
0
        public void WithErrorIf_True_ErrorFunction_IsCalled()
        {
            var mock = IReasonCreatorMock.GetMock();

            Result.WithErrorIf(true, () => mock.Object.CreateError());

            mock.Verify(m => m.CreateError(), Times.Once);
        }
        public void WithErrorIf_False_OnlySuccessFunction_IsCalled()
        {
            var mock = IReasonCreatorMock.GetMock();

            Result.WithErrorIf <int>(false, () => mock.Object.CreateError(), () => mock.Object.CreateSuccess());

            mock.Verify(m => m.CreateError(), Times.Never);
            mock.Verify(m => m.CreateSuccess(), Times.Once);
        }