protected void AndGivenASetOfSpecificationsForSource() { _specProvider = new SpecProvider <Dto1>(); _specProvider.Add(a => { if (a.Source.Key == "Key-5") { return(new SpecResult("Arbitrary invalid reason.")); } return(SpecResult.Success); }, "Key", "Description"); _specProvider.MergeFrom(m => m.Contact, new SpecProvider <Contact>()); }
protected void AndGivenAWiredUpContainer() { _cb = new ContainerBuilder(); _cb.RegisterGeneric(typeof(SpecProvider <>)) .As(typeof(IProvideSpecifications <>)) .As(typeof(SpecProvider <>)) .SingleInstance(); _cb.RegisterGeneric(typeof(Processor <,>)) .As(typeof(Processor <,>)); _cb.RegisterGeneric(typeof(ProcessorEngine <>)) .As(typeof(ProcessorEngine <>)); _cb.RegisterGeneric(typeof(ProcessorConfiguration <,>)) .As(typeof(ProcessorConfiguration <,>)); //specialist _cb.Register(m => { var s = new SpecProvider <Dto1>(); s.Add(a => { if (a.Source.Key == "Key-5") { return(new SpecResult("Arbitrary invalid reason.")); } return(SpecResult.Success); }, "Key", "Description"); s.MergeFrom(mq => mq.Contact, m.Resolve <SpecProvider <Contact> >()); return(s); }).AsSelf().AsImplementedInterfaces(); _cb.Register(m => { var s = new SpecProvider <Address>(); s.Add(a => { if (a.ContactId == 0) { return(new SpecResult("Contact Id has not been assigned.")); } return(SpecResult.Success); }, "Key", "Description"); return(s); }).AsSelf().AsImplementedInterfaces(); _cb.Register(m => { var s = new FlowSnapshotRepo <FlowSnapshot>(Environment.CurrentDirectory); return(s); }).AsSelf().AsImplementedInterfaces(); _container = _cb.Build(); }