Esempio n. 1
0
        public void TestSetup()
        {
            HelperMethods.InitialiseAutoMapper();

            Mock <IContext> context = new Mock <IContext>();

            context.Setup(x => x.Animals).Returns(mockAnimals);
            context.Setup(x => x.Users).Returns(mockUsers);
            context.Setup(x => x.AnimalTypes).Returns(mockAnimalTypes);


            userRepository = new UserRepository(context.Object);

            userManager = new UserManager(userRepository);

            animalTypeRepository = new AnimalTypeRepository(context.Object);
            animalTypeManager    = new AnimalTypeManager(animalTypeRepository);

            animalRepository = new AnimalRepository(context.Object);

            animalStateManager = new AnimalStateManager();

            animalManager = new AnimalManager(animalRepository, animalTypeManager, animalStateManager);


            animalController = new AnimalController(userManager, animalManager, animalTypeManager);
        }
 public AnimalManager(IAnimalRepository animalRepository,
                      IAnimalTypeManager animalTypeManager,
                      IAnimalStateManager animalStateManager)
 {
     this.animalRepository   = animalRepository;
     this.animalTypeManager  = animalTypeManager;
     this.animalStateManager = animalStateManager;
 }
        public void TestSetup()
        {
            //This is redundant if a previous test executes first. But should be here for safe programming.
            HelperMethods.InitialiseAutoMapper();

            Mock <IContext> context = new Mock <IContext>();

            context.Setup(x => x.Animals).Returns(mockAnimals);
            context.Setup(x => x.AnimalTypes).Returns(mockAnimalTypes);
            context.Setup(x => x.Users).Returns(mockUsers);

            animalRepository     = new AnimalRepository(context.Object);
            animalTypeRepository = new AnimalTypeRepository(context.Object);
            animalTypeManager    = new AnimalTypeManager(animalTypeRepository);
            animalStateManager   = new AnimalStateManager();
            animalManager        = new AnimalManager(animalRepository, animalTypeManager, animalStateManager);
        }