public void ValidatePerformsValidatorsIteration()
        {
            var iocInstance     = IoCContainer.Instance;
            var iocInstanceMock = new Mock <IIoCContainer>(MockBehavior.Strict);

            IoCContainer.Instance = iocInstanceMock.Object;
            var firstValidatorMock  = new Mock <IValidator <AddBundleRequest> >(MockBehavior.Strict);
            var secondValidatorMock = new Mock <IValidator <AddBundleRequest> >(MockBehavior.Strict);

            iocInstanceMock.Setup(x => x.ResolveAll <IValidator <AddBundleRequest> >()).Returns(
                new List <IValidator <AddBundleRequest> > {
                firstValidatorMock.Object, secondValidatorMock.Object
            });
            var sut = new AddBundleRequest();

            firstValidatorMock.Setup(x => x.Validate(sut));
            secondValidatorMock.Setup(x => x.Validate(sut));

            sut.Validate();

            iocInstanceMock.VerifyAll();
            firstValidatorMock.VerifyAll();
            secondValidatorMock.VerifyAll();
            IoCContainer.Instance = iocInstance;
        }
Exemplo n.º 2
0
        public void Setup()
        {
            this.iocContainerMock = new Mock <IIoCContainer>(MockBehavior.Strict);
            IoCContainer.Instance = this.iocContainerMock.Object;
            this.validator        = new AddBundleRequestValidator();
            iocContainerMock.Setup(x => x.ResolveAll <IValidator <AddBundleRequest> >()).Returns(new List <IValidator <AddBundleRequest> >()
            {
                this.validator
            });

            this.validBundleRequest = new AddBundleRequest
            {
                Code          = "STPLUS",
                BundleSellKey = "1231",
                SellKey       = "1",
                PaxId         = "1"
            };
        }