public void ValidatePerformsValidatorsIteration() { var iocInstance = IoCContainer.Instance; var iocInstanceMock = new Mock <IIoCContainer>(MockBehavior.Strict); IoCContainer.Instance = iocInstanceMock.Object; var firstValidatorMock = new Mock <IValidator <AutoAssignSeatRequest> >(MockBehavior.Strict); var secondValidatorMock = new Mock <IValidator <AutoAssignSeatRequest> >(MockBehavior.Strict); iocInstanceMock.Setup(x => x.ResolveAll <IValidator <AutoAssignSeatRequest> >()).Returns( new List <IValidator <AutoAssignSeatRequest> > { firstValidatorMock.Object, secondValidatorMock.Object }); var sut = new AutoAssignSeatRequest(); firstValidatorMock.Setup(x => x.Validate(sut)); secondValidatorMock.Setup(x => x.Validate(sut)); sut.Validate(); iocInstanceMock.VerifyAll(); firstValidatorMock.VerifyAll(); secondValidatorMock.VerifyAll(); IoCContainer.Instance = iocInstance; }
public void Setup() { this.iocContainerMock = new Mock <IIoCContainer>(MockBehavior.Strict); IoCContainer.Instance = this.iocContainerMock.Object; this.validator = new AutoAssignSeatRequestValidator(); iocContainerMock.Setup(x => x.ResolveAll <IValidator <AutoAssignSeatRequest> >()).Returns(new List <IValidator <AutoAssignSeatRequest> >() { this.validator }); this.validServiceRequest = new AutoAssignSeatRequest { SegmentId = "1", Pax = new List <string>() { "1" } }; }