Пример #1
0
        public void Setup()
        {
            _commandActionHandlers = new Mock <ICommandActionHandlers>();
            _logger = new Mock <ILogger>();

            _deleteUserTvShowMapping = new DeleteUserTvShowMapping(_commandActionHandlers.Object, _logger.Object);
        }
        public void Setup()
        {
            var contextOptions = new DbContextOptionsBuilder <ApplicationDbContext>()
                                 .UseInMemoryDatabase(databaseName: $"AssistantDB{Guid.NewGuid()}")
                                 .Options;
            var operationalOptions = Options.Create(new OperationalStoreOptions());

            _context = new ApplicationDbContext(contextOptions, operationalOptions);

            _userId  = Guid.NewGuid().ToString();
            _mapping = new UserTVShowMapping
            {
                Id       = 1,
                UserId   = _userId,
                TVShowId = 1,
                TvShow   = new TvShow
                {
                    TVShowId     = 1,
                    ShowKey      = "show-show",
                    ShowName     = "Show Show",
                    ThumbnailUrl = "URL",
                    Summary      = "Summary"
                }
            };

            _context.AddRange(_mapping);
            _context.SaveChanges();
            _logger = new Mock <ILogger>();
            _commandActionHandlers   = new CommandActionHandlers(_context);
            _deleteUserTvShowMapping = new DeleteUserTvShowMapping(_commandActionHandlers, _logger.Object);
        }