Ejemplo n.º 1
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         // free managed resources
         if (homiStreamsContextMock != null)
         {
             homiStreamsContextMock.Dispose();
             homiStreamsContextMock = null;
         }
     }
 }
Ejemplo n.º 2
0
        public ControllerFixture()
        {
            #region Create mock/memory database

            homiStreamsContextMock = new HomiStreamsContextMock();

            homiStreamsContextMock.Genres.AddRange(new Genre[]
            {
                new Genre
                {
                    Id          = 685349,
                    Name        = "Action",
                    Description = "Similar to adventure, and the protagonist usually takes a risky turn, which leads to desperate situations (including explosions, fight scenes, daring escapes, etc.)"
                },
                new Genre
                {
                    Id          = 454673,
                    Name        = "Thriller",
                    Description = "A story that is usually a mix of fear and excitement"
                }
            });
            homiStreamsContextMock.SaveChanges();

            #endregion

            #region Mapper settings with original profiles.

            var mappingConfig = new MapperConfiguration(mc =>
            {
                mc.AddProfile(new MappingProfile());
            });

            mapper = mappingConfig.CreateMapper();

            #endregion

            // Create UserService with Memory Database
            userService = new UserService(testDbContextMock, mapper);

            // Create Controller
            userController = new UserController(userService);
        }
Ejemplo n.º 3
0
 public ContextFixture()
 {
     homiStreamsContextMock = new HomiStreamsContextMock();
     homiStreamsContextMock.Genres.AddRange(new Genre[]
     {
         new Genre
         {
             Id          = 685349,
             Name        = "Action",
             Description = "Similar to adventure, and the protagonist usually takes a risky turn, which leads to desperate situations (including explosions, fight scenes, daring escapes, etc.)"
         },
         new Genre
         {
             Id          = 454673,
             Name        = "Thriller",
             Description = "A story that is usually a mix of fear and excitement"
         }
     });
     homiStreamsContextMock.SaveChanges();
 }