mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-23 03:39:35 -10:00
Commit migrated from https://github.com/dotnet/corefx/commit/73ab96765fa59e5a1d224ecf804a29379da30c0b
40 lines
1.6 KiB
C#
40 lines
1.6 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
using System;
|
|
using System.IO;
|
|
using Xunit;
|
|
|
|
public partial class RenamedEventArgs_4000_Tests
|
|
{
|
|
private static void ValidateRenamedEventArgs(WatcherChangeTypes changeType, string directory, string name, string oldName)
|
|
{
|
|
RenamedEventArgs args = new RenamedEventArgs(changeType, directory, name, oldName);
|
|
|
|
if (!directory.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal))
|
|
{
|
|
directory += Path.DirectorySeparatorChar;
|
|
}
|
|
|
|
Assert.Equal(changeType, args.ChangeType);
|
|
Assert.Equal(directory + name, args.FullPath);
|
|
Assert.Equal(name, args.Name);
|
|
|
|
Assert.Equal(directory + oldName, args.OldFullPath);
|
|
Assert.Equal(oldName, args.OldName);
|
|
}
|
|
|
|
[Fact]
|
|
public static void RenamedEventArgs_ctor()
|
|
{
|
|
ValidateRenamedEventArgs(WatcherChangeTypes.Changed, "C:" + Path.DirectorySeparatorChar, "foo.txt", "bar.txt");
|
|
ValidateRenamedEventArgs(WatcherChangeTypes.Changed, "C:", "foo.txt", "bar.txt");
|
|
ValidateRenamedEventArgs(WatcherChangeTypes.All, "C:" + Path.DirectorySeparatorChar, "foo.txt", "bar.txt");
|
|
|
|
ValidateRenamedEventArgs((WatcherChangeTypes)0, String.Empty, String.Empty, String.Empty);
|
|
ValidateRenamedEventArgs((WatcherChangeTypes)0, String.Empty, null, null);
|
|
|
|
Assert.Throws<NullReferenceException>(() => new RenamedEventArgs((WatcherChangeTypes)0, null, String.Empty, String.Empty));
|
|
}
|
|
}
|