Esempio n. 1
0
 public PostServices(IAnimaniaConsoleContext context, ILocationServices locationServices, IAnimalTypeServices animalTypeServices, IBreedTypeServices breedTypeServices)
 {
     this.context            = context;
     this.locationServices   = locationServices;
     this.animalTypeServices = animalTypeServices;
     this.breedTypeServices  = breedTypeServices;
 }
Esempio n. 2
0
        public void Initialize()
        {
            var data = new List <AnimalType>
            {
                new AnimalType {
                    Id = 1, AnimalTypeName = "dog"
                },
                new AnimalType {
                    Id = 2, AnimalTypeName = "cat"
                },
            }.AsQueryable();

            var mockSet = new Mock <IDbSet <AnimalType> >();

            mockSet.As <IQueryable <AnimalType> >().Setup(m => m.Provider).Returns(data.Provider);
            mockSet.As <IQueryable <AnimalType> >().Setup(m => m.Expression).Returns(data.Expression);
            mockSet.As <IQueryable <AnimalType> >().Setup(m => m.ElementType).Returns(data.ElementType);
            mockSet.As <IQueryable <AnimalType> >().Setup(m => m.GetEnumerator()).Returns(() => data.GetEnumerator());

            mockContext = new Mock <IAnimaniaConsoleContext>();
            mockContext.Setup(x => x.AnimalTypes).Returns(mockSet.Object);

            animalTypeService = new AnimalTypeServices();
        }