protected virtual void Dispose(bool disposing) { if (disposing) { // free managed resources if (homiStreamsContextMock != null) { homiStreamsContextMock.Dispose(); homiStreamsContextMock = null; } } }
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); }
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(); }