private ResponseBuilder(SpeciesVitalBuilder speciesVitalsBuilder, SpeciesBuilder speciesBuilder, PetVitalBuilder petVitalBuilder, NopePetBuilder nopePetBuilder, UserSessionBuilder userSessionBuilder)
 {
     SpeciesVitalsBuilder = speciesVitalsBuilder;
     SpeciesBuilder       = speciesBuilder;
     PetVitalBuilder      = petVitalBuilder;
     NopePetBuilder       = nopePetBuilder;
     UserSessionBuilder   = userSessionBuilder;
 }
        public static ResponseBuilder Initialise(IRepository <Animal, AnimalMetric> animalRepository,
                                                 IRepository <Metric, MetricInteraction> metricRepository, IRepository <Pet, PetMetric> petRepository,
                                                 IRepository <Interaction, MetricInteraction> interactionRepository)
        {
            if (IsInitialised)
            {
                throw new Exception("The builders have already been initialised");
            }

            var speciesCareActionBuilder = new SpeciesCareActionBuilder(interactionRepository);
            var speciesVitalsBuilder     = new SpeciesVitalBuilder(speciesCareActionBuilder, metricRepository);
            var speciesBuilder           = new SpeciesBuilder(speciesVitalsBuilder, animalRepository);
            var petVitalBuilder          = new PetVitalBuilder(metricRepository);
            var nopePetBuilder           = new NopePetBuilder(speciesBuilder, petVitalBuilder, petRepository);
            var userSessionBuilder       = new UserSessionBuilder(nopePetBuilder);

            IsInitialised = true;
            return(new ResponseBuilder(speciesVitalsBuilder, speciesBuilder, petVitalBuilder, nopePetBuilder, userSessionBuilder));
        }
Exemple #3
0
 public NopePetBuilder(SpeciesBuilder speciesBuilder, PetVitalBuilder petVitalBuilder, IRepository <Pet, PetMetric> petRepository)
 {
     _petRepository   = petRepository;
     _speciesBuilder  = speciesBuilder;
     _petVitalBuilder = petVitalBuilder;
 }
 public IList <Species> BuildAllSpecies() => SpeciesBuilder.BuildAll();