Exemplo n.º 1
0
        [PlatformSpecific(TestPlatforms.OSX | TestPlatforms.Windows)]  // Casing matters on Linux
        public void FileSystemWatcher_OnCreatedWithMismatchedCasingGivesExpectedFullPath()
        {
            using (var fsw = new FileSystemWatcher(TestDirectory))
            {
                AutoResetEvent are      = new AutoResetEvent(false);
                string         fullPath = Path.Combine(TestDirectory.ToUpper(), "Foo.txt");

                fsw.Created += (o, e) =>
                {
                    Assert.True(fullPath.Equals(e.FullPath, StringComparison.OrdinalIgnoreCase));
                    are.Set();
                };

                fsw.EnableRaisingEvents = true;
                using (var file = new TempFile(fullPath))
                {
                    ExpectEvent(are, "created");
                }
            }
        }