Ejemplo n.º 1
0
        public void TestDoesNotExist()
        {
            _source = Create(_fname);
            _taskScheduler.RunOnce();
            _source.GetProperty(Properties.EmptyReason).Should().Be(null);
            _source.GetProperty(Properties.Created).Should().NotBe(DateTime.MinValue);

            _streamWriter?.Dispose();
            _stream?.Dispose();
            File.Delete(_fname);
            _taskScheduler.RunOnce();

            _source.GetProperty(Properties.EmptyReason).Should().BeOfType <SourceDoesNotExist>();
            _source.GetProperty(Properties.Created).Should().BeNull();
        }
Ejemplo n.º 2
0
        public void SetUp()
        {
            _fname = PathEx.GetTempFileName();
            if (File.Exists(_fname))
            {
                File.Delete(_fname);
            }
            _scheduler = new ManualTaskScheduler();

            _stream    = File.Open(_fname, FileMode.Create, FileAccess.Write, FileShare.Read);
            _writer    = new StreamWriter(_stream);
            _logSource = Create(_fname);

            _settings = new DataSource(_fname)
            {
                Id = DataSourceId.CreateNew()
            };
        }
Ejemplo n.º 3
0
        public void Setup()
        {
            _taskScheduler = new ManualTaskScheduler();
            _fname         = PathEx.GetTempFileName();
            if (File.Exists(_fname))
            {
                File.Delete(_fname);
            }

            _stream       = File.Open(_fname, FileMode.Create, FileAccess.Write, FileShare.Read);
            _streamWriter = new StreamWriter(_stream);
            _binaryWriter = new BinaryWriter(_stream);

            _source = Create(_fname);

            _listener      = new Mock <ILogSourceListener>();
            _modifications = new List <LogSourceModification>();
            _listener.Setup(x => x.OnLogFileModified(It.IsAny <ILogSource>(), It.IsAny <LogSourceModification>()))
            .Callback((ILogSource unused, LogSourceModification modification) => _modifications.Add(modification));

            _source.AddListener(_listener.Object, TimeSpan.Zero, 10);
        }