public void EvaluateReturnsFalseIfNoPreviousBuilds()
        {
            var condition = new LastBuildStatusTaskCondition
            {
                Status = IntegrationStatus.Success
            };
            var result = this.mocks.Create <IIntegrationResult>(MockBehavior.Strict).Object;

            Mock.Get(result).Setup(_result => _result.IsInitial()).Returns(true).Verifiable();

            var actual = condition.Eval(result);

            this.mocks.VerifyAll();
            Assert.IsFalse(actual);
        }
        public void EvaluateReturnsFalseIfNoPreviousBuilds()
        {
            var condition = new LastBuildStatusTaskCondition
            {
                Status = IntegrationStatus.Success
            };
            var result = this.mocks.StrictMock <IIntegrationResult>();

            Expect.Call(result.IsInitial()).Return(true);

            this.mocks.ReplayAll();
            var actual = condition.Eval(result);

            this.mocks.VerifyAll();
            Assert.IsFalse(actual);
        }
        public void EvaluateReturnsTrueIfConditionIsMatched()
        {
            var condition = new LastBuildStatusTaskCondition
            {
                Status = IntegrationStatus.Success
            };
            var result = this.mocks.StrictMock <IIntegrationResult>();

            Expect.Call(result.IsInitial()).Return(false);
            Expect.Call(result.LastBuildStatus).Return(IntegrationStatus.Success);

            this.mocks.ReplayAll();
            var actual = condition.Eval(result);

            this.mocks.VerifyAll();
            Assert.IsTrue(actual);
        }
        public void EvaluateReturnsFalseIfConditionIsNotMatched()
        {
            var condition = new LastBuildStatusTaskCondition
            {
                Status      = IntegrationStatus.Success,
                Description = "Not equal test"
            };
            var result = this.mocks.Create <IIntegrationResult>(MockBehavior.Strict).Object;

            Mock.Get(result).Setup(_result => _result.IsInitial()).Returns(false).Verifiable();
            Mock.Get(result).SetupGet(_result => _result.LastBuildStatus).Returns(IntegrationStatus.Failure).Verifiable();

            var actual = condition.Eval(result);

            this.mocks.VerifyAll();
            Assert.IsFalse(actual);
        }
        public void EvaluateReturnsFalseIfConditionIsNotMatched()
        {
            var condition = new LastBuildStatusTaskCondition
            {
                Status      = IntegrationStatus.Success,
                Description = "Not equal test"
            };
            var result = this.mocks.StrictMock <IIntegrationResult>();

            Expect.Call(result.IsInitial()).Return(false);
            Expect.Call(result.LastBuildStatus).Return(IntegrationStatus.Failure);

            this.mocks.ReplayAll();
            var actual = condition.Eval(result);

            this.mocks.VerifyAll();
            Assert.IsFalse(actual);
        }