예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LoggerBase" /> class.
        /// </summary>
        /// <param name="provider">The function that provides the value for the <see cref="TextLogger.Writer" /> property.</param>
        /// <param name="syncRoot">The custom object for thread safe operations.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="provider" /> is <see langword="null" />.
        /// </exception>
        public TextLogger(WriterProvider provider, object syncRoot = null)
            : base(syncRoot: syncRoot)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            _PROVIDER = provider;
        }
예제 #2
0
        public void Initialize()
        {
            var options = new DbContextOptionsBuilder <TodoListContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options;

            _context = new TodoListContext(options);
            new InMemoryDatabasePopulator(_context).PopulateData();

            var dateTimeWrapper = A.Fake <IDateTimeWrapper>();

            A.CallTo(() => dateTimeWrapper.Now).Returns(DEFAULT_DATE_NOW);

            _provider = new WriterProvider(_context, dateTimeWrapper);
        }