public void SetUp() { this.hostPath = Path.GetTempFileName(); using (var streamWriter = File.CreateText(this.hostPath)) streamWriter.WriteLine(); this.hostsWatcher = new HostsWatcher(this.hostPath); this.hostsWatcher.MappingsChanged += this.HostsWatcherMappingsChanged; this.Given(); this.When(); // give filewatcher time to update Thread.Sleep(1000); }