Ejemplo n.º 1
0
        public void FirePassesOnParameters()
        {
            var parameters = new[]
            {
                new NameValuePair("test", "testValue")
            };
            var request          = new IntegrationRequest(BuildCondition.IfModificationExists, "test", null);
            var innerTriggerMock = this.mocks.StrictMock <ITrigger>();

            Expect.Call(innerTriggerMock.Fire()).Return(request);
            var trigger = new ParameterTrigger
            {
                InnerTrigger = innerTriggerMock,
                Parameters   = parameters
            };

            mocks.ReplayAll();
            var actual = trigger.Fire();

            mocks.VerifyAll();
            Assert.AreSame(request, actual);
            Assert.AreEqual(1, request.BuildValues.Count);
            Assert.AreEqual(parameters[0].Value,
                            request.BuildValues[parameters[0].Name]);
        }
Ejemplo n.º 2
0
        public void IntegrationCompletedShouldDelegateToInnerTrigger()
        {
            var innerTriggerMock = this.mocks.Create <ITrigger>(MockBehavior.Strict).Object;

            Mock.Get(innerTriggerMock).Setup(_innerTriggerMock => _innerTriggerMock.IntegrationCompleted()).Verifiable();
            var trigger = new ParameterTrigger
            {
                InnerTrigger = innerTriggerMock
            };

            trigger.IntegrationCompleted();
            mocks.VerifyAll();
        }
Ejemplo n.º 3
0
        public void FireDoesNothingIfInnerTriggerDoesNotFire()
        {
            var innerTriggerMock = this.mocks.Create <ITrigger>(MockBehavior.Strict).Object;

            Mock.Get(innerTriggerMock).Setup(_innerTriggerMock => _innerTriggerMock.Fire()).Returns(() => null).Verifiable();
            var trigger = new ParameterTrigger
            {
                InnerTrigger = innerTriggerMock
            };
            var actual = trigger.Fire();

            mocks.VerifyAll();
            Assert.IsNull(actual);
        }
Ejemplo n.º 4
0
        public void IntegrationCompletedShouldDelegateToInnerTrigger()
        {
            var innerTriggerMock = this.mocks.StrictMock <ITrigger>();

            Expect.Call(() => innerTriggerMock.IntegrationCompleted());
            var trigger = new ParameterTrigger
            {
                InnerTrigger = innerTriggerMock
            };

            mocks.ReplayAll();
            trigger.IntegrationCompleted();
            mocks.VerifyAll();
        }
Ejemplo n.º 5
0
        public void NextBuildShouldReturnInnerTriggerNextBuildIfUnknown()
        {
            var now = DateTime.Now;
            var innerTriggerMock = this.mocks.Create <ITrigger>(MockBehavior.Strict).Object;

            Mock.Get(innerTriggerMock).SetupGet(_innerTriggerMock => _innerTriggerMock.NextBuild).Returns(now).Verifiable();
            var trigger = new ParameterTrigger
            {
                InnerTrigger = innerTriggerMock
            };
            var actual = trigger.NextBuild;

            mocks.VerifyAll();
            Assert.AreEqual(now, actual);
        }
Ejemplo n.º 6
0
        public void FireMandlesMissingParameters()
        {
            var request          = new IntegrationRequest(BuildCondition.IfModificationExists, "test", null);
            var innerTriggerMock = this.mocks.Create <ITrigger>(MockBehavior.Strict).Object;

            Mock.Get(innerTriggerMock).Setup(_innerTriggerMock => _innerTriggerMock.Fire()).Returns(request).Verifiable();
            var trigger = new ParameterTrigger
            {
                InnerTrigger = innerTriggerMock
            };
            var actual = trigger.Fire();

            mocks.VerifyAll();
            Assert.AreSame(request, actual);
            Assert.AreEqual(0, request.BuildValues.Count);
        }
Ejemplo n.º 7
0
        public void FireDoesNothingIfInnerTriggerDoesNotFire()
        {
            var innerTriggerMock = this.mocks.StrictMock <ITrigger>();

            Expect.Call(innerTriggerMock.Fire()).Return(null);
            var trigger = new ParameterTrigger
            {
                InnerTrigger = innerTriggerMock
            };

            mocks.ReplayAll();
            var actual = trigger.Fire();

            mocks.VerifyAll();
            Assert.IsNull(actual);
        }
Ejemplo n.º 8
0
        public void NextBuildShouldReturnInnerTriggerNextBuildIfUnknown()
        {
            var now = DateTime.Now;
            var innerTriggerMock = this.mocks.StrictMock <ITrigger>();

            Expect.Call(innerTriggerMock.NextBuild).Return(now);
            var trigger = new ParameterTrigger
            {
                InnerTrigger = innerTriggerMock
            };

            mocks.ReplayAll();
            var actual = trigger.NextBuild;

            mocks.VerifyAll();
            Assert.AreEqual(now, actual);
        }
Ejemplo n.º 9
0
        public void FireMandlesMissingParameters()
        {
            var request          = new IntegrationRequest(BuildCondition.IfModificationExists, "test", null);
            var innerTriggerMock = this.mocks.StrictMock <ITrigger>();

            Expect.Call(innerTriggerMock.Fire()).Return(request);
            var trigger = new ParameterTrigger
            {
                InnerTrigger = innerTriggerMock
            };

            mocks.ReplayAll();
            var actual = trigger.Fire();

            mocks.VerifyAll();
            Assert.AreSame(request, actual);
            Assert.AreEqual(0, request.BuildValues.Count);
        }
Ejemplo n.º 10
0
        public void FirePassesOnParameters()
        {
            var parameters = new[]
            {
                new NameValuePair("test", "testValue")
            };
            var request          = new IntegrationRequest(BuildCondition.IfModificationExists, "test", null);
            var innerTriggerMock = this.mocks.Create <ITrigger>(MockBehavior.Strict).Object;

            Mock.Get(innerTriggerMock).Setup(_innerTriggerMock => _innerTriggerMock.Fire()).Returns(request).Verifiable();
            var trigger = new ParameterTrigger
            {
                InnerTrigger = innerTriggerMock,
                Parameters   = parameters
            };
            var actual = trigger.Fire();

            mocks.VerifyAll();
            Assert.AreSame(request, actual);
            Assert.AreEqual(1, request.BuildValues.Count);
            Assert.AreEqual(parameters[0].Value,
                            request.BuildValues[parameters[0].Name]);
        }