<PackageReference Include="Microsoft.DotNet.CodeAnalysis" Version="$(MicrosoftDotNetCodeAnalysisPackageVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.3.0-beta1-final" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.4" />
+ <PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
</ItemGroup>
</Project>
<Rule Id="CA5371" Action="None" /> <!-- Use XmlReader For Schema Read -->
<Rule Id="CA5372" Action="None" /> <!-- Use XmlReader For XPathDocument -->
</Rules>
+ <Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
+ <Rule Id="AD0001" Action="None" /> <!-- Analyzer threw an exception -->
+ <Rule Id="SA0001" Action="None" /> <!-- XML comments -->
+ <Rule Id="SA1000" Action="None" /> <!-- The keyword 'if' should be followed by a space -->
+ <Rule Id="SA1001" Action="None" /> <!-- Commas should be followed by whitespace -->
+ <Rule Id="SA1002" Action="None" /> <!-- Semicolons should not be preceded by a space -->
+ <Rule Id="SA1003" Action="None" /> <!-- Operator should not appear at the end of a line -->
+ <Rule Id="SA1004" Action="None" /> <!-- Documentation line should begin with a space -->
+ <Rule Id="SA1005" Action="None" /> <!-- Single line comment should begin with a space -->
+ <Rule Id="SA1008" Action="None" /> <!-- Opening parenthesis should not be preceded by a space -->
+ <Rule Id="SA1009" Action="None" /> <!-- Closing parenthesis should not be followed by a space -->
+ <Rule Id="SA1010" Action="None" /> <!-- Opening square brackets should not be preceded by a space -->
+ <Rule Id="SA1011" Action="None" /> <!-- Closing square bracket should be followed by a space -->
+ <Rule Id="SA1012" Action="None" /> <!-- Opening brace should be followed by a space -->
+ <Rule Id="SA1013" Action="None" /> <!-- Closing brace should be preceded by a space -->
+ <Rule Id="SA1015" Action="None" /> <!-- Closing generic bracket should not be followed by a space -->
+ <Rule Id="SA1019" Action="None" /> <!-- Member access symbol '.' should not be preceded by a space -->
+ <Rule Id="SA1020" Action="None" /> <!-- Increment symbol '++' should not be preceded by a space -->
+ <Rule Id="SA1021" Action="None" /> <!-- Negative sign should be preceded by a space -->
+ <Rule Id="SA1023" Action="None" /> <!-- Dereference symbol '*' should not be preceded by a space." -->
+ <Rule Id="SA1024" Action="None" /> <!-- Colon should be followed by a space -->
+ <Rule Id="SA1025" Action="None" /> <!-- Code should not contain multiple whitespace characters in a row -->
+ <Rule Id="SA1026" Action="None" /> <!-- The keyword 'new' should not be followed by a space or a blank line -->
+ <Rule Id="SA1028" Action="None" /> <!-- Code should not contain trailing whitespace -->
+ <Rule Id="SA1100" Action="None" /> <!-- Do not prefix calls with base unless local implementation exists -->
+ <Rule Id="SA1101" Action="None" /> <!-- Prefix local calls with this -->
+ <Rule Id="SA1106" Action="None" /> <!-- Code should not contain empty statements -->
+ <Rule Id="SA1107" Action="None" /> <!-- Code should not contain multiple statements on one line -->
+ <Rule Id="SA1108" Action="None" /> <!-- Block statements should not contain embedded comments -->
+ <Rule Id="SA1110" Action="None" /> <!-- Opening parenthesis or bracket should be on declaration line -->
+ <Rule Id="SA1111" Action="None" /> <!-- Closing parenthesis should be on line of last parameter -->
+ <Rule Id="SA1112" Action="None" /> <!-- Closing parenthesis should be on line of opening parenthesis -->
+ <Rule Id="SA1113" Action="None" /> <!-- Comma should be on the same line as previous parameter -->
+ <Rule Id="SA1114" Action="None" /> <!-- Parameter list should follow declaration -->
+ <Rule Id="SA1115" Action="None" /> <!-- The parameter should begin on the line after the previous parameter -->
+ <Rule Id="SA1116" Action="None" /> <!-- Split parameters should start on line after declaration -->
+ <Rule Id="SA1117" Action="None" /> <!-- Parameters should be on same line or separate lines -->
+ <Rule Id="SA1118" Action="None" /> <!-- Parameter should not span multiple lines -->
+ <Rule Id="SA1119" Action="None" /> <!-- Statement should not use unnecessary parenthesis -->
+ <Rule Id="SA1120" Action="None" /> <!-- Comments should contain text -->
+ <Rule Id="SA1122" Action="None" /> <!-- Use string.Empty for empty strings -->
+ <Rule Id="SA1123" Action="None" /> <!-- Region should not be located within a code element -->
+ <Rule Id="SA1124" Action="None" /> <!-- Do not use regions -->
+ <Rule Id="SA1125" Action="None" /> <!-- Use shorthand for nullable types -->
+ <Rule Id="SA1127" Action="None" /> <!-- Generic type constraints should be on their own line -->
+ <Rule Id="SA1128" Action="None" /> <!-- Put constructor initializers on their own line -->
+ <Rule Id="SA1129" Action="None" /> <!-- Do not use default value type constructor -->
+ <Rule Id="SA1130" Action="None" /> <!-- Use lambda syntax -->
+ <Rule Id="SA1131" Action="None" /> <!-- Constant values should appear on the right-hand side of comparisons -->
+ <Rule Id="SA1132" Action="None" /> <!-- Do not combine fields -->
+ <Rule Id="SA1133" Action="None" /> <!-- Do not combine attributes -->
+ <Rule Id="SA1134" Action="None" /> <!-- Each attribute should be placed on its own line of code -->
+ <Rule Id="SA1135" Action="None" /> <!-- Using directive should be qualified -->
+ <Rule Id="SA1136" Action="None" /> <!-- Enum values should be on separate lines -->
+ <Rule Id="SA1137" Action="None" /> <!-- Elements should have the same indentation -->
+ <Rule Id="SA1139" Action="None" /> <!-- Use literal suffix notation instead of casting -->
+ <Rule Id="SA1200" Action="None" /> <!-- Using directive should appear within a namespace declaration -->
+ <Rule Id="SA1201" Action="None" /> <!-- Elements should appear in the correct order -->
+ <Rule Id="SA1202" Action="None" /> <!-- Elements should be ordered by access -->
+ <Rule Id="SA1203" Action="None" /> <!-- Constants should appear before fields -->
+ <Rule Id="SA1204" Action="None" /> <!-- Static elements should appear before instance elements -->
+ <Rule Id="SA1205" Action="None" /> <!-- Partial elements should declare an access modifier -->
+ <Rule Id="SA1206" Action="None" /> <!-- Modifer ordering -->
+ <Rule Id="SA1208" Action="None" /> <!-- Using directive ordering -->
+ <Rule Id="SA1209" Action="None" /> <!-- Using alias directives should be placed after all using namespace directives -->
+ <Rule Id="SA1210" Action="None" /> <!-- Using directives should be ordered alphabetically by the namespaces -->
+ <Rule Id="SA1211" Action="None" /> <!-- Using alias directive ordering -->
+ <Rule Id="SA1212" Action="None" /> <!-- A get accessor appears after a set accessor within a property or indexer -->
+ <Rule Id="SA1214" Action="None" /> <!-- Readonly fields should appear before non-readonly fields -->
+ <Rule Id="SA1216" Action="None" /> <!-- Using static directives should be placed at the correct location -->
+ <Rule Id="SA1300" Action="None" /> <!-- Element should begin with an uppercase letter -->
+ <Rule Id="SA1302" Action="None" /> <!-- Interface names should begin with I -->
+ <Rule Id="SA1303" Action="None" /> <!-- Const field names should begin with upper-case letter -->
+ <Rule Id="SA1304" Action="None" /> <!-- Non-private readonly fields should begin with upper-case letter -->
+ <Rule Id="SA1306" Action="None" /> <!-- Field should begin with lower-case letter -->
+ <Rule Id="SA1307" Action="None" /> <!-- Field should begin with upper-case letter -->
+ <Rule Id="SA1308" Action="None" /> <!-- Field should not begin with the prefix 's_' -->
+ <Rule Id="SA1309" Action="None" /> <!-- Field names should not begin with underscore -->
+ <Rule Id="SA1310" Action="None" /> <!-- Field should not contain an underscore -->
+ <Rule Id="SA1311" Action="None" /> <!-- Static readonly fields should begin with upper-case letter -->
+ <Rule Id="SA1312" Action="None" /> <!-- Variable should begin with lower-case letter -->
+ <Rule Id="SA1313" Action="None" /> <!-- Parameter should begin with lower-case letter -->
+ <Rule Id="SA1314" Action="None" /> <!-- Type parameter names should begin with T -->
+ <Rule Id="SA1400" Action="None" /> <!-- Element should declare an access modifier -->
+ <Rule Id="SA1401" Action="None" /> <!-- Fields should be private -->
+ <Rule Id="SA1402" Action="None" /> <!-- File may only contain a single type -->
+ <Rule Id="SA1403" Action="None" /> <!-- File may only contain a single namespace -->
+ <Rule Id="SA1404" Action="None" /> <!-- Code analysis suppression should have justification -->
+ <Rule Id="SA1405" Action="None" /> <!-- Debug.Assert should provide message text -->
+ <Rule Id="SA1407" Action="None" /> <!-- Arithmetic expressions should declare precedence -->
+ <Rule Id="SA1408" Action="None" /> <!-- Conditional expressions should declare precedence -->
+ <Rule Id="SA1411" Action="None" /> <!-- Attribute constructor should not use unnecessary parenthesis -->
+ <Rule Id="SA1413" Action="None" /> <!-- Use trailing comma in multi-line initializers -->
+ <Rule Id="SA1500" Action="None" /> <!-- Braces for multi-line statements should not share line -->
+ <Rule Id="SA1501" Action="None" /> <!-- Statement should not be on a single line -->
+ <Rule Id="SA1502" Action="None" /> <!-- Element should not be on a single line -->
+ <Rule Id="SA1503" Action="None" /> <!-- Braces should not be omitted -->
+ <Rule Id="SA1504" Action="None" /> <!-- All accessors should be single-line or multi-line -->
+ <Rule Id="SA1505" Action="None" /> <!-- An opening brace should not be followed by a blank line -->
+ <Rule Id="SA1506" Action="None" /> <!-- Element documentation headers should not be followed by blank line -->
+ <Rule Id="SA1507" Action="None" /> <!-- Code should not contain multiple blank lines in a row -->
+ <Rule Id="SA1508" Action="None" /> <!-- A closing brace should not be preceded by a blank line -->
+ <Rule Id="SA1509" Action="None" /> <!-- Opening braces should not be preceded by blank line -->
+ <Rule Id="SA1510" Action="None" /> <!-- 'else' statement should not be preceded by a blank line -->
+ <Rule Id="SA1512" Action="None" /> <!-- Single-line comments should not be followed by blank line -->
+ <Rule Id="SA1513" Action="None" /> <!-- Closing brace should be followed by blank line -->
+ <Rule Id="SA1514" Action="None" /> <!-- Element documentation header should be preceded by blank line -->
+ <Rule Id="SA1515" Action="None" /> <!-- Single-line comment should be preceded by blank line -->
+ <Rule Id="SA1516" Action="None" /> <!-- Elements should be separated by blank line -->
+ <Rule Id="SA1517" Action="None" /> <!-- Code should not contain blank lines at start of file -->
+ <Rule Id="SA1518" Action="None" /> <!-- Code should not contain blank lines at the end of the file -->
+ <Rule Id="SA1519" Action="None" /> <!-- Braces should not be omitted from multi-line child statement -->
+ <Rule Id="SA1520" Action="None" /> <!-- Use braces consistently -->
+ <Rule Id="SA1600" Action="None" /> <!-- Elements should be documented -->
+ <Rule Id="SA1601" Action="None" /> <!-- Partial elements should be documented -->
+ <Rule Id="SA1602" Action="None" /> <!-- Enumeration items should be documented -->
+ <Rule Id="SA1604" Action="None" /> <!-- Element documentation should have summary -->
+ <Rule Id="SA1605" Action="None" /> <!-- Partial element documentation should have summary -->
+ <Rule Id="SA1606" Action="None" /> <!-- Element documentation should have summary text -->
+ <Rule Id="SA1608" Action="None" /> <!-- Element documentation should not have default summary -->
+ <Rule Id="SA1610" Action="None" /> <!-- Property documentation should have value text -->
+ <Rule Id="SA1611" Action="None" /> <!-- The documentation for parameter 'message' is missing -->
+ <Rule Id="SA1612" Action="None" /> <!-- The parameter documentation is at incorrect position -->
+ <Rule Id="SA1614" Action="None" /> <!-- Element parameter documentation should have text -->
+ <Rule Id="SA1615" Action="None" /> <!-- Element return value should be documented -->
+ <Rule Id="SA1616" Action="None" /> <!-- Element return value documentation should have text -->
+ <Rule Id="SA1617" Action="None" /> <!-- Void return value should not be documented -->
+ <Rule Id="SA1618" Action="None" /> <!-- The documentation for type parameter is missing -->
+ <Rule Id="SA1619" Action="None" /> <!-- The documentation for type parameter is missing -->
+ <Rule Id="SA1622" Action="None" /> <!-- Generic type parameter documentation should have text -->
+ <Rule Id="SA1623" Action="None" /> <!-- Property documentation text -->
+ <Rule Id="SA1624" Action="None" /> <!-- Because the property only contains a visible get accessor, the documentation summary text should begin with 'Gets' -->
+ <Rule Id="SA1625" Action="None" /> <!-- Element documentation should not be copied and pasted -->
+ <Rule Id="SA1626" Action="None" /> <!-- Single-line comments should not use documentation style slashes -->
+ <Rule Id="SA1627" Action="None" /> <!-- The documentation text within the \'exception\' tag should not be empty -->
+ <Rule Id="SA1629" Action="None" /> <!-- Documentation text should end with a period -->
+ <Rule Id="SA1633" Action="None" /> <!-- File should have header -->
+ <Rule Id="SA1642" Action="None" /> <!-- Constructor summary documentation should begin with standard text -->
+ <Rule Id="SA1643" Action="None" /> <!-- Destructor summary documentation should begin with standard text -->
+ <Rule Id="SA1649" Action="None" /> <!-- File name should match first type name -->
+ </Rules>
<Rules AnalyzerId="xunit.analyzers" RuleNamespace="xunit.analyzers">
<Rule Id="xUnit1019" Action="None" /> <!-- MemberData must reference a member providing a valid data type -->
<Rule Id="xUnit1024" Action="None" /> <!-- Test methods cannot have overloads -->
/// Returns basic info about thread. If tis is 0, it will return
/// info for process e.g. main thread.
/// </returns>
- public unsafe static proc_stats GetThreadInfo(int pid, int tid)
+ public static unsafe proc_stats GetThreadInfo(int pid, int tid)
{
proc_stats ret = new proc_stats();
kinfo_proc* info = null;
using Microsoft.Win32.SafeHandles;
-using CFAbsoluteTime=System.Double;
+#pragma warning disable SA1121 // we don't want to simplify built-ins here as we're using aliasing
+using CFAbsoluteTime = System.Double;
internal static partial class Interop
{
using Microsoft.Win32.SafeHandles;
+#pragma warning disable SA1121 // we don't want to simplify built-ins here as we're using aliasing
using CFStringRef = System.IntPtr;
using CFArrayRef = System.IntPtr;
using FSEventStreamRef = System.IntPtr;
{
internal static partial class AppleCrypto
{
- internal unsafe static void GetRandomBytes(byte* pbBuffer, int count)
+ internal static unsafe void GetRandomBytes(byte* pbBuffer, int count)
{
Debug.Assert(count >= 0);
}
[DllImport(Libraries.AppleCryptoNative)]
- private unsafe static extern int AppleCryptoNative_GetRandomBytes(byte* buf, int num, out int errorCode);
+ private static extern unsafe int AppleCryptoNative_GetRandomBytes(byte* buf, int num, out int errorCode);
}
}
{
internal static partial class Sys
{
- internal unsafe static uint[] GetGroupList(string userName, uint primaryGroupId)
+ internal static unsafe uint[] GetGroupList(string userName, uint primaryGroupId)
{
const int InitialGroupsLength =
#if DEBUG
private const int StackBufferSize = 256;
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Stat", SetLastError = true)]
- internal unsafe static extern int Stat(ref byte path, out FileStatus output);
+ internal static extern unsafe int Stat(ref byte path, out FileStatus output);
- internal unsafe static int Stat(ReadOnlySpan<char> path, out FileStatus output)
+ internal static unsafe int Stat(ReadOnlySpan<char> path, out FileStatus output)
{
byte* buffer = stackalloc byte[StackBufferSize];
var converter = new ValueUtf8Converter(new Span<byte>(buffer, StackBufferSize));
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LStat", SetLastError = true)]
internal static extern int LStat(ref byte path, out FileStatus output);
- internal unsafe static int LStat(ReadOnlySpan<char> path, out FileStatus output)
+ internal static unsafe int LStat(ReadOnlySpan<char> path, out FileStatus output)
{
byte* buffer = stackalloc byte[StackBufferSize];
var converter = new ValueUtf8Converter(new Span<byte>(buffer, StackBufferSize));
/// Returns 0 on success; otherwise, returns -1
/// </returns>
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_UTimensat", SetLastError = true)]
- internal static unsafe extern int UTimensat(string path, TimeSpec* times);
+ internal static extern unsafe int UTimensat(string path, TimeSpec* times);
}
}
internal static partial class OpenSsl
{
private static readonly Ssl.SslCtxSetVerifyCallback s_verifyClientCertificate = VerifyClientCertificate;
- private unsafe static readonly Ssl.SslCtxSetAlpnCallback s_alpnServerCallback = AlpnServerSelectCallback;
+ private static unsafe readonly Ssl.SslCtxSetAlpnCallback s_alpnServerCallback = AlpnServerSelectCallback;
private static readonly IdnMapping s_idnMapping = new IdnMapping();
#region internal methods
{
internal static partial class Crypto
{
- internal unsafe static bool GetRandomBytes(byte* pbBuffer, int count)
+ internal static unsafe bool GetRandomBytes(byte* pbBuffer, int count)
{
Debug.Assert(count >= 0);
[DllImport(Libraries.CryptoNative)]
[return: MarshalAs(UnmanagedType.Bool)]
- private unsafe static extern bool CryptoNative_GetRandomBytes(byte* buf, int num);
+ private static extern unsafe bool CryptoNative_GetRandomBytes(byte* buf, int num);
}
}
internal static extern int SslCtxSetAlpnProtos(SafeSslContextHandle ctx, IntPtr protos, int len);
[DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslCtxSetAlpnSelectCb")]
- internal static unsafe extern void SslCtxSetAlpnSelectCb(SafeSslContextHandle ctx, SslCtxSetAlpnCallback callback, IntPtr arg);
+ internal static extern unsafe void SslCtxSetAlpnSelectCb(SafeSslContextHandle ctx, SslCtxSetAlpnCallback callback, IntPtr arg);
internal static unsafe int SslCtxSetAlpnProtos(SafeSslContextHandle ctx, List<SslApplicationProtocol> protocols)
{
internal static extern void SslCtxSetVerify(SafeSslContextHandle ctx, SslCtxSetVerifyCallback callback);
[DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SetCiphers")]
- internal static unsafe extern bool SetCiphers(SafeSslContextHandle ctx, byte* cipherList, byte* cipherSuites);
+ internal static extern unsafe bool SetCiphers(SafeSslContextHandle ctx, byte* cipherList, byte* cipherSuites);
[DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SetEncryptionPolicy")]
internal static extern bool SetEncryptionPolicy(SafeSslContextHandle ctx, EncryptionPolicy policy);
internal partial class Advapi32
{
[DllImport(Libraries.Advapi32, SetLastError = true)]
- internal unsafe static extern bool AdjustTokenPrivileges(
+ internal static extern unsafe bool AdjustTokenPrivileges(
SafeTokenHandle TokenHandle,
bool DisableAllPrivileges,
TOKEN_PRIVILEGE* NewState,
internal partial class Advapi32
{
[DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
- internal extern unsafe static bool ControlService(SafeServiceHandle serviceHandle, int control, SERVICE_STATUS* pStatus);
+ internal extern static unsafe bool ControlService(SafeServiceHandle serviceHandle, int control, SERVICE_STATUS* pStatus);
}
}
internal static partial class Advapi32
{
[DllImport(Interop.Libraries.Advapi32, SetLastError = true)]
- internal unsafe static extern bool GetTokenInformation(
+ internal static extern unsafe bool GetTokenInformation(
SafeAccessTokenHandle TokenHandle,
TOKEN_INFORMATION_CLASS TokenInformationClass,
void* TokenInformation,
internal partial class Advapi32
{
[DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
- public unsafe extern static bool SetServiceStatus(IntPtr serviceStatusHandle, SERVICE_STATUS* status);
+ public extern static unsafe bool SetServiceStatus(IntPtr serviceStatusHandle, SERVICE_STATUS* status);
}
}
/// <param name="function">Identifies the function to be performed by the driver. Values of less than 0x800 are reserved for Microsoft. Values of 0x800 and higher can be used by vendors.</param>
/// <param name="method">Indicates how the system will pass data between the caller of DeviceIoControl (or IoBuildDeviceIoControlRequest) and the driver that handles the IRP.</param>
/// <param name="access">Indicates the type of access that a caller must request when opening the file object that represents the device (see IRP_MJ_CREATE).</param>
- internal unsafe static uint CTL_CODE(
+ internal static unsafe uint CTL_CODE(
ushort deviceType,
ushort function,
byte method,
{
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd317762.aspx
[DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
- public unsafe static extern int CompareStringOrdinal(
+ public static extern unsafe int CompareStringOrdinal(
ref char lpString1,
int cchCount1,
ref char lpString2,
/// WARNING: The private methods do not implicitly handle long paths. Use CreateFile.
/// </summary>
[DllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)]
- private unsafe static extern IntPtr CreateFilePrivate(
+ private static extern unsafe IntPtr CreateFilePrivate(
string lpFileName,
int dwDesiredAccess,
FileShare dwShareMode,
int dwFlagsAndAttributes,
IntPtr hTemplateFile);
- internal unsafe static SafeFileHandle CreateFile(
+ internal static unsafe SafeFileHandle CreateFile(
string lpFileName,
int dwDesiredAccess,
FileShare dwShareMode,
}
}
- internal unsafe static SafeFileHandle CreateFile(
+ internal static unsafe SafeFileHandle CreateFile(
string lpFileName,
int dwDesiredAccess,
FileShare dwShareMode,
}
}
- internal unsafe static IntPtr CreateFile_IntPtr(
+ internal static unsafe IntPtr CreateFile_IntPtr(
string lpFileName,
int dwDesiredAccess,
FileShare dwShareMode,
{
// https://msdn.microsoft.com/en-us/library/windows/desktop/hh449422.aspx
[DllImport(Libraries.Kernel32, EntryPoint = "CreateFile2", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
- internal unsafe static extern IntPtr CreateFile2(
+ internal static extern unsafe IntPtr CreateFile2(
string lpFileName,
int dwDesiredAccess,
FileShare dwShareMode,
}
}
- internal unsafe static IntPtr CreateFile_IntPtr(
+ internal static unsafe IntPtr CreateFile_IntPtr(
string lpFileName,
int dwDesiredAccess,
FileShare dwShareMode,
public const int FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000;
[DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = true)]
- public static unsafe extern int FormatMessage(
+ public static extern unsafe int FormatMessage(
int dwFlags,
SafeLibraryHandle lpSource,
uint dwMessageId,
internal partial class Kernel32
{
[DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
- internal unsafe static extern uint GetConsoleTitleW(char* title, uint nSize);
+ internal static extern unsafe uint GetConsoleTitleW(char* title, uint nSize);
}
}
internal partial class Kernel32
{
[DllImport(Libraries.Kernel32, SetLastError = true)]
- internal unsafe static extern bool GetNamedPipeInfo(
+ internal static extern unsafe bool GetNamedPipeInfo(
SafePipeHandle hNamedPipe,
uint* lpFlags,
uint* lpOutBufferSize,
internal partial class Kernel32
{
[DllImport(Libraries.Kernel32, EntryPoint = "GetVolumeInformationW", CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
- internal static unsafe extern bool GetVolumeInformation(string drive, char* volumeName, int volumeNameBufLen, int* volSerialNumber, int* maxFileNameLen, out int fileSystemFlags, char* fileSystemName, int fileSystemNameBufLen);
+ internal static extern unsafe bool GetVolumeInformation(string drive, char* volumeName, int volumeNameBufLen, int* volSerialNumber, int* maxFileNameLen, out int fileSystemFlags, char* fileSystemName, int fileSystemNameBufLen);
internal const uint FILE_SUPPORTS_ENCRYPTION = 0x00020000;
}
internal partial class Kernel32
{
[DllImport(Libraries.Kernel32, EntryPoint = "ReadDirectoryChangesW", CharSet = CharSet.Unicode, SetLastError = true)]
- internal static unsafe extern bool ReadDirectoryChangesW(
+ internal static extern unsafe bool ReadDirectoryChangesW(
SafeFileHandle hDirectory,
byte[] lpBuffer,
uint nBufferLength,
}
[DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static unsafe extern bool SetFileCompletionNotificationModes(SafeHandle handle, FileCompletionNotificationModes flags);
+ internal static extern unsafe bool SetFileCompletionNotificationModes(SafeHandle handle, FileCompletionNotificationModes flags);
}
}
/// <summary>
/// Gets the next info pointer or null if there are no more.
/// </summary>
- public unsafe static FILE_FULL_DIR_INFORMATION* GetNextInfo(FILE_FULL_DIR_INFORMATION* info)
+ public static unsafe FILE_FULL_DIR_INFORMATION* GetNextInfo(FILE_FULL_DIR_INFORMATION* info)
{
if (info == null)
return null;
// https://msdn.microsoft.com/en-us/library/bb432380.aspx
// https://msdn.microsoft.com/en-us/library/windows/hardware/ff566424.aspx
[DllImport(Libraries.NtDll, CharSet = CharSet.Unicode, ExactSpelling = true)]
- private unsafe static extern int NtCreateFile(
+ private static extern unsafe int NtCreateFile(
out IntPtr FileHandle,
DesiredAccess DesiredAccess,
ref OBJECT_ATTRIBUTES ObjectAttributes,
void* EaBuffer,
uint EaLength);
- internal unsafe static (int status, IntPtr handle) CreateFile(
+ internal static unsafe (int status, IntPtr handle) CreateFile(
ReadOnlySpan<char> path,
IntPtr rootDirectory,
CreateDisposition createDisposition,
// https://msdn.microsoft.com/en-us/library/windows/hardware/ff556633.aspx
// https://msdn.microsoft.com/en-us/library/windows/hardware/ff567047.aspx
[DllImport(Libraries.NtDll, CharSet = CharSet.Unicode, ExactSpelling = true)]
- public unsafe static extern int NtQueryDirectoryFile(
+ public static extern unsafe int NtQueryDirectoryFile(
IntPtr FileHandle,
IntPtr Event,
IntPtr ApcRoutine,
internal partial class NtDll
{
[DllImport(Libraries.NtDll, CharSet = CharSet.Unicode)]
- internal static unsafe extern int NtQuerySystemInformation(int query, void* dataPtr, int size, out int returnedSize);
+ internal static extern unsafe int NtQuerySystemInformation(int query, void* dataPtr, int size, out int returnedSize);
internal const int NtQuerySystemProcessInformation = 5;
internal const uint STATUS_INFO_LENGTH_MISMATCH = 0xC0000004;
{
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680600(v=vs.85).aspx
[DllImport(Libraries.NtDll, ExactSpelling = true)]
- public unsafe static extern uint RtlNtStatusToDosError(
+ public static extern unsafe uint RtlNtStatusToDosError(
int Status);
}
}
internal partial class PerfCounter
{
[DllImport(Libraries.PerfCounter, CharSet = CharSet.Unicode)]
- public static unsafe extern int FormatFromRawValue(
+ public static extern unsafe int FormatFromRawValue(
uint dwCounterType,
uint dwFormat,
ref long pTimeBase,
internal const uint SEE_MASK_FLAG_NO_UI = 0x00000400;
[DllImport(Libraries.Shell32, ExactSpelling = true, CharSet = CharSet.Unicode, SetLastError = true)]
- internal unsafe static extern bool ShellExecuteExW(
+ internal static extern unsafe bool ShellExecuteExW(
SHELLEXECUTEINFO* pExecInfo);
}
-}
\ No newline at end of file
+}
{
internal partial class User32
{
- [DllImport(Libraries.User32, EntryPoint = "SendMessageTimeoutW")]
+ [DllImport(Libraries.User32, EntryPoint = "SendMessageTimeoutW")]
public static extern IntPtr SendMessageTimeout(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam, int flags, int timeout, out IntPtr pdwResult);
}
}
internal static partial class Winsock
{
[DllImport(Interop.Libraries.Ws2_32, SetLastError = true)]
- internal static unsafe extern bool WSAGetOverlappedResult(
+ internal static extern unsafe bool WSAGetOverlappedResult(
[In] SafeSocketHandle socketHandle,
[In] NativeOverlapped* overlapped,
[Out] out uint bytesTransferred,
internal static partial class Winsock
{
[DllImport(Interop.Libraries.Ws2_32, SetLastError = true)]
- internal static unsafe extern SocketError WSARecv(
+ internal static extern unsafe SocketError WSARecv(
SafeHandle socketHandle,
WSABuffer* buffer,
int bufferCount,
internal static partial class Winsock
{
[DllImport(Interop.Libraries.Ws2_32, SetLastError = true)]
- private static unsafe extern SocketError WSARecvFrom(
+ private static extern unsafe SocketError WSARecvFrom(
SafeHandle socketHandle,
WSABuffer* buffers,
int bufferCount,
internal static partial class Winsock
{
[DllImport(Interop.Libraries.Ws2_32, SetLastError = true)]
- private static unsafe extern SocketError WSASendTo(
+ private static extern unsafe SocketError WSASendTo(
SafeHandle socketHandle,
WSABuffer* buffers,
int bufferCount,
{
#if DEBUG
bool compValue = s_connectionStringValidKeyRegex.IsMatch(keyname);
- Debug.Assert(((0 < keyname.Length) && (';' != keyname[0]) && !Char.IsWhiteSpace(keyname[0]) && (-1 == keyname.IndexOf('\u0000'))) == compValue, "IsValueValid mismatch with regex");
+ Debug.Assert(((0 < keyname.Length) && (';' != keyname[0]) && !char.IsWhiteSpace(keyname[0]) && (-1 == keyname.IndexOf('\u0000'))) == compValue, "IsValueValid mismatch with regex");
#endif
// string.Contains(char) is .NetCore2.1+ specific
return ((0 < keyname.Length) && (';' != keyname[0]) && !char.IsWhiteSpace(keyname[0]) && (-1 == keyname.IndexOf('\u0000')));
=> throw ADP.ConnectionAlreadyOpen(State);
}
- sealed internal class DbConnectionClosedBusy : DbConnectionBusy
+ internal sealed class DbConnectionClosedBusy : DbConnectionBusy
{
// Closed Connection, Currently Busy - changing connection string
internal static readonly DbConnectionInternal SingletonInstance = new DbConnectionClosedBusy(); // singleton object
}
}
- sealed internal class DbConnectionOpenBusy : DbConnectionBusy
+ internal sealed class DbConnectionOpenBusy : DbConnectionBusy
{
// Open Connection, Currently Busy - closing connection
internal static readonly DbConnectionInternal SingletonInstance = new DbConnectionOpenBusy(); // singleton object
}
}
- sealed internal class DbConnectionClosedConnecting : DbConnectionBusy
+ internal sealed class DbConnectionClosedConnecting : DbConnectionBusy
{
// Closed Connection, Currently Connecting
}
}
- sealed internal class DbConnectionClosedNeverOpened : DbConnectionClosed
+ internal sealed class DbConnectionClosedNeverOpened : DbConnectionClosed
{
// Closed Connection, Has Never Been Opened
}
}
- sealed internal class DbConnectionClosedPreviouslyOpened : DbConnectionClosed
+ internal sealed class DbConnectionClosedPreviouslyOpened : DbConnectionClosed
{
// Closed Connection, Has Previously Been Opened
// and once no pools remain, change state from Active->Idle->Disabled
// Once Disabled, factory can remove its reference to the pool entry
- sealed internal class DbConnectionPoolGroup
+ internal sealed class DbConnectionPoolGroup
{
private readonly DbConnectionOptions _connectionOptions;
private readonly DbConnectionPoolKey _poolKey;
// else pool entry has been disabled so don't create new pools
Debug.Assert(PoolGroupStateDisabled == _state, "state should be disabled");
- // don't need to call connectionFactory.QueuePoolForRelease(newPool) because
- // pool callbacks were delayed and no risk of connections being created
+ // don't need to call connectionFactory.QueuePoolForRelease(newPool) because
+ // pool callbacks were delayed and no risk of connections being created
newPool.Shutdown();
}
}
/// <summary>
/// Returns a string from the given span, terminating the string at null if present.
/// </summary>
- internal unsafe static string GetStringFromFixedBuffer(this ReadOnlySpan<char> span)
+ internal static unsafe string GetStringFromFixedBuffer(this ReadOnlySpan<char> span)
{
fixed (char* c = &MemoryMarshal.GetReference(span))
{
/// <summary>
/// Gets the null-terminated string length of the given span.
/// </summary>
- internal unsafe static int GetFixedBufferStringLength(this ReadOnlySpan<char> span)
+ internal static unsafe int GetFixedBufferStringLength(this ReadOnlySpan<char> span)
{
int length = span.IndexOf('\0');
return length < 0 ? span.Length : length;
/// Returns true if the given string equals the given span.
/// The span's logical length is to the first null if present.
/// </summary>
- internal unsafe static bool FixedBufferEqualsString(this ReadOnlySpan<char> span, string value)
+ internal static unsafe bool FixedBufferEqualsString(this ReadOnlySpan<char> span, string value)
{
if (value == null || value.Length > span.Length)
return false;
// RFC 5952 Section 4.2.3
// Longest consecutive sequence of zero segments, minimum 2.
// On equal, first sequence wins. <-1, -1> for no compression.
- internal unsafe static (int longestSequenceStart, int longestSequenceLength) FindCompressionRange(
+ internal static unsafe (int longestSequenceStart, int longestSequenceLength) FindCompressionRange(
ReadOnlySpan<ushort> numbers)
{
int longestSequenceLength = 0, longestSequenceStart = -1, currentSequenceLength = 0;
// Returns true if the IPv6 address should be formatted with an embedded IPv4 address:
// ::192.168.1.1
- internal unsafe static bool ShouldHaveIpv4Embedded(ReadOnlySpan<ushort> numbers)
+ internal static unsafe bool ShouldHaveIpv4Embedded(ReadOnlySpan<ushort> numbers)
{
// 0:0 : 0:0 : x:x : x.x.x.x
if (numbers[0] == 0 && numbers[1] == 0 && numbers[2] == 0 && numbers[3] == 0 && numbers[6] != 0)
// Remarks: MUST NOT be used unless all input indexes are verified and trusted.
// start must be next to '[' position, or error is reported
- internal unsafe static bool IsValidStrict(char* name, int start, ref int end)
+ internal static unsafe bool IsValidStrict(char* name, int start, ref int end)
{
int sequenceCount = 0;
int sequenceLength = 0;
{
private string m_key;
private string m_value;
-
+
public AssemblyMetadataAttribute(string key, string value)
{
m_key = key;
{
get { return m_key; }
}
-
+
public string Value
{
get { return m_value;}
}
}
-}
\ No newline at end of file
+}
}
}
- public unsafe static bool IsProcessElevated()
+ public static unsafe bool IsProcessElevated()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
{
public class TestLogging : ITestOutputHelper
{
- private readonly static TestLogging s_instance = new TestLogging();
+ private static readonly TestLogging s_instance = new TestLogging();
private TestLogging()
{
// See the LICENSE file in the project root for more information.
using System;
-using System.Diagnostics; //Assert
+using System.Diagnostics;
[assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAssembly]
// See the LICENSE file in the project root for more information.
using System;
-using System.Diagnostics; //StackFrame
+using System.Diagnostics;
using System.IO;
using System.Text;
{
set
{
- //Set the static Error interface...
+ //Set the static Error interface...
s_rIError = value;
//Setup the standard c# Console to log to LTM instead...
if (TestConsole != null)
{
//ITestConsole.Log
- TestConsole.Log(Common.Format(actual), //actual
- Common.Format(expected), //expected
- source, //source
- message, //message
- details, //details
- tagCONSOLEFLAGS.CONSOLE_TEXT, //flags
+ TestConsole.Log(Common.Format(actual), //actual
+ Common.Format(expected), //expected
+ source, //source
+ message, //message
+ details, //details
+ tagCONSOLEFLAGS.CONSOLE_TEXT, //flags
"fake_filename",
999
);
using System;
using System.IO;
-using System.Text; //Encoding
-using System.Diagnostics; //TraceListener
+using System.Text;
+using System.Diagnostics;
namespace OLEDB.Test.ModuleCore
{
// See the LICENSE file in the project root for more information.
using System;
-using System.Collections.Generic; //StackTrace
+using System.Collections.Generic;
using System.Diagnostics;
namespace OLEDB.Test.ModuleCore
// See the LICENSE file in the project root for more information.
using System;
-using System.Diagnostics; //Assert
+using System.Diagnostics;
using System.IO;
using System.Collections.Generic;
// These two methods get/set the ErrorLevel property. This property affects the
// behavior of the 'Validate' method. The enum values have the following
// effects on that method:
- // HR_STRICT: The 'hrActual' parameter MUST match the 'hrExpected' parameter,
- // or else the error count in incremented.
- // HR_SUCCEED: The 'hrActual' MUST be a success code, or else the error count
- // is incremented.
- // HR_FAIL: The 'hrActual' MUST be an error code, or else the error count
- // is incremented.
- // HR_OPTIONAL:The error count will not be incremented, regardless of the
- // parameters passed in to 'Validate.'
+ // HR_STRICT: The 'hrActual' parameter MUST match the 'hrExpected' parameter,
+ // or else the error count in incremented.
+ // HR_SUCCEED: The 'hrActual' MUST be a success code, or else the error count
+ // is incremented.
+ // HR_FAIL: The 'hrActual' MUST be an error code, or else the error count
+ // is incremented.
+ // HR_OPTIONAL:The error count will not be incremented, regardless of the
+ // parameters passed in to 'Validate.'
//
tagERRORLEVEL GetErrorLevel();
void SetErrorLevel(tagERRORLEVEL ErrorLevel);
// the provider they are running against (if any.)
//
// The properties are described as follows:
- // >Name: The name the provider gives itself. For Kagera this is MSDASQL.
- // >FriendlyName: A special name the user has given this provider configuration.
- // >InitString: A string which contains initialization data. The interpretation
- // of this string is Test Module-specific -- so you simply must
- // make users of LTM aware of what your particular Test Module
- // wants to see in this string.
- // >MachineName: If you will be testing a remote provider, the user will pass
- // the machine name the provider is located on to you through
- // this property.
- // >CLSID: This is the CLSID of the provider you are to run against.
- // >CLSCTX: This tells you whether the provider will be InProc, Local, or
- // Remote (values of this property are identical to the values
- // of the CLSCTX enumeration in wtypes.h)
+ // >Name: The name the provider gives itself. For Kagera this is MSDASQL.
+ // >FriendlyName: A special name the user has given this provider configuration.
+ // >InitString: A string which contains initialization data. The interpretation
+ // of this string is Test Module-specific -- so you simply must
+ // make users of LTM aware of what your particular Test Module
+ // wants to see in this string.
+ // >MachineName: If you will be testing a remote provider, the user will pass
+ // the machine name the provider is located on to you through
+ // this property.
+ // >CLSID: This is the CLSID of the provider you are to run against.
+ // >CLSCTX: This tells you whether the provider will be InProc, Local, or
+ // Remote (values of this property are identical to the values
+ // of the CLSCTX enumeration in wtypes.h)
string GetName();
void SetName(string bstrProviderName);
string GetFriendlyName();
{
var xml = "books.xml";
var testExpression = @"
- /bookstore/child ::
+ /bookstore/child ::
book
";
var expected = new XPathResult(0,
/// This class is used to write out XML tokens. This tool can write
/// well-formed as well as non well-formed file. This writer does not
/// guarantee well-formedness. It does not implement XmlWriter.
-/// The class can write tokens by explicit API calls as well as parse
-/// a pattern string to generate these tokens.
+/// The class can write tokens by explicit API calls as well as parse
+/// a pattern string to generate these tokens.
/// </summary>
namespace XmlCoreTest.Common
{
/// Writing text.
/// Note : This is basically equivalent to WriteRaw and the string may contain any number of embedded tags.
- /// No checking is performed on them either.
+ /// No checking is performed on them either.
public void PutText(string myStr)
{
_q.Append(myStr);
/// <summary>
/// This method is a convenience method and a shortcut to create an XML string. Each character in the pattern
- /// maps to a particular Put/Open function and calls it for you. For e.g. XEAA/ will call PutDecl, OpenElement,
- /// PutAttribute, PutAttribute and CloseElement for you.
- /// The following is the list of all allowed characters and their function mappings :
+ /// maps to a particular Put/Open function and calls it for you. For e.g. XEAA/ will call PutDecl, OpenElement,
+ /// PutAttribute, PutAttribute and CloseElement for you.
+ /// The following is the list of all allowed characters and their function mappings :
///
- ///'X' : PutDecl()
- ///'E' : OpenElement()
- ///'M' : CloseEmptyElement()
- ///'/' : CloseElement()
- ///'e' : PutEndElement()
- ///'A' : PutAttribute()
- ///'P' : PutPI()
- ///'T' : PutText()
- ///'C' : PutComment()
- ///'R' : PutRoot()
- ///'r' : PutEndRoot()
- ///'B' : PutEndRoot()
- ///'W' : PutWhiteSpace()
+ ///'X' : PutDecl()
+ ///'E' : OpenElement()
+ ///'M' : CloseEmptyElement()
+ ///'/' : CloseElement()
+ ///'e' : PutEndElement()
+ ///'A' : PutAttribute()
+ ///'P' : PutPI()
+ ///'T' : PutText()
+ ///'C' : PutComment()
+ ///'R' : PutRoot()
+ ///'r' : PutEndRoot()
+ ///'B' : PutEndRoot()
+ ///'W' : PutWhiteSpace()
///
/// </summary>
/// <param name="pattern">String containing the pattern which you want to use to create
// See the LICENSE file in the project root for more information.
/// This class is primarily used to test buffer boundary integrity of readers.
-/// This class constructs a memory stream from the given buffer boundary length such that
-/// the required tag completely lies exactly on the start and end of buffer boundary.
+/// This class constructs a memory stream from the given buffer boundary length such that
+/// the required tag completely lies exactly on the start and end of buffer boundary.
/// The class makes up the additional bytes by filling in whitespace if so.
-/// The first buffer length consists of the XML Decl and the Root Start (done by PrepareStream() )
+/// The first buffer length consists of the XML Decl and the Root Start (done by PrepareStream() )
/// The next buffer length consists of the actual start and end text with the variable content stretched
/// out to end at the buffer boundary.
///
/// <summary>
- /// This class contains helper methods for Readers.
- /// ConvertToBinaryStream : Converts the given xml string to the binary equivalent of the string and returns it
- /// using a memory stream.
+ /// This class contains helper methods for Readers.
+ /// ConvertToBinaryStream : Converts the given xml string to the binary equivalent of the string and returns it
+ /// using a memory stream.
/// Common usage pattern would be something like :
/// XmlReader.Create( new MemoryStream(ReaderHelper.ConvertToBinaryStream("<elem>abc</elem>", true, false)), "baseUri", readerSettings );
/// </summary>
// See the LICENSE file in the project root for more information.
/// This class is primarily used to test buffer boundary integrity of readers.
-/// This class constructs a memory stream from the given buffer boundary length such that
-/// the required tag completely lies exactly on the start and end of buffer boundary.
+/// This class constructs a memory stream from the given buffer boundary length such that
+/// the required tag completely lies exactly on the start and end of buffer boundary.
/// The class makes up the additional bytes by filling in whitespace if so.
-/// The first buffer length consists of the XML Decl and the Root Start (done by PrepareStream() )
+/// The first buffer length consists of the XML Decl and the Root Start (done by PrepareStream() )
/// The next buffer length consists of the actual start and end text with the variable content stretched
/// out to end at the buffer boundary.
///
}
/// <summary>
- /// This class contains helper methods for Readers.
- /// ConvertToBinaryStream : Converts the given xml string to the binary equivalent of the string and returns it
- /// using a memory stream.
+ /// This class contains helper methods for Readers.
+ /// ConvertToBinaryStream : Converts the given xml string to the binary equivalent of the string and returns it
+ /// using a memory stream.
/// Common usage pattern would be something like :
/// XmlReader.Create( new MemoryStream(ReaderHelper.ConvertToBinaryStream("<elem>abc</elem>", true, false)), "baseUri", readerSettings );
/// </summary>
Async = 1024,
NoAsync = 2048,
- UTF8Writer = 1, // V2 writer with Encoding.UTF8
+ UTF8Writer = 1, // V2 writer with Encoding.UTF8
UnicodeWriter = 2, // V2 writer with Encoding.Unicode
CustomWriter = 4, // CustomWriter implemented in this same folder
- CharCheckingWriter = 8, // CharCheckingWriter implemented in this same folder
+ CharCheckingWriter = 8, // CharCheckingWriter implemented in this same folder
UTF8WriterIndent = 16, // UTF8WriterIndent implemented in this same folder
UnicodeWriterIndent = 32, // UnicodeWriterIndent implemented in this same folder
WrappedWriter = 64 // WrappedWriter implemented in this same folder
{
XmlDiffAttribute current1 = elem1.FirstAttribute;
XmlDiffAttribute current2 = elem2.FirstAttribute;
- // NodePosition result = 0;
+ // NodePosition result = 0;
int nCompare = 0;
while (current1 != null && current2 != null && nCompare == 0)
{
Assert.Equal(0, string.Compare(emptyValue, s, StringComparison.OrdinalIgnoreCase));
ReadOnlySpan<char> span = value.AsSpan();
- ReadOnlySpan<char> emptySlice = value.AsSpan(2, 0);
+ ReadOnlySpan<char> emptySlice = value.AsSpan(2, 0);
Assert.True(0 < span.CompareTo(emptySlice, StringComparison.Ordinal));
Assert.True(0 < span.CompareTo(emptySlice, StringComparison.CurrentCulture));
Assert.True(0 < span.CompareTo(emptySlice, StringComparison.InvariantCultureIgnoreCase));
Assert.True(0 < span.CompareTo(emptySlice, StringComparison.OrdinalIgnoreCase));
- span = value.AsSpan(1, 0);
+ span = value.AsSpan(1, 0);
Assert.Equal(0, span.CompareTo(emptySlice, StringComparison.Ordinal));
Assert.Equal(0, span.CompareTo(emptySlice, StringComparison.CurrentCulture));
Assert.Equal(0, string.Compare(s1, s2, StringComparison.OrdinalIgnoreCase));
ReadOnlySpan<char> span = value.AsSpan(1, 3);
- ReadOnlySpan<char> slice = value.AsSpan(3, 3);
+ ReadOnlySpan<char> slice = value.AsSpan(3, 3);
Assert.Equal(0, span.CompareTo(slice, StringComparison.Ordinal));
Assert.Equal(0, span.CompareTo(slice, StringComparison.CurrentCulture));
Assert.Equal(0, string.Compare(s1, s2, StringComparison.OrdinalIgnoreCase));
ReadOnlySpan<char> span = sa.AsSpan(0, 3);
- ReadOnlySpan<char> slice = sb.AsSpan(0, 3);
+ ReadOnlySpan<char> slice = sb.AsSpan(0, 3);
Assert.Equal(0, span.CompareTo(slice, StringComparison.Ordinal));
Assert.Equal(0, span.CompareTo(slice, StringComparison.CurrentCulture));
[Fact]
public static void SameSpanContains_StringComparison()
- {
+ {
string s1 = "456";
Assert.True(s1.Contains(s1));
[Fact]
public static void ContainsUnknownComparisonType_StringComparison()
- {
+ {
ReadOnlySpan<char> span = "456".AsSpan();
SpanTestHelpers.AssertThrows<ArgumentException, char>(span, (_span) => _span.Contains(_span, StringComparison.CurrentCulture - 1));
SpanTestHelpers.AssertThrows<ArgumentException, char>(span, (_span) => _span.Contains(_span, StringComparison.OrdinalIgnoreCase + 1));
int result = s1.CompareTo(s1);
Assert.Equal(0, result);
- ReadOnlySpan<char> first = s1.AsSpan(0, 3);
+ ReadOnlySpan<char> first = s1.AsSpan(0, 3);
result = first.SequenceCompareTo<char>(s1.AsSpan());
Assert.Equal(0, result);
}
Assert.True(result > 0);
}
- [Fact]
+ [Fact]
public static void SequenceCompareToWithSingleMismatch_Char()
{
for (int length = 1; length < 32; length++)
string s1 = new string(first);
string s2 = new string(second);
- int result = string.Compare(s1, s2, StringComparison.Ordinal);
+ int result = string.Compare(s1, s2, StringComparison.Ordinal);
Assert.True(result < 0);
result = string.Compare(s2, s1, StringComparison.Ordinal);
}
}
- [Fact]
+ [Fact]
public static void SequenceCompareToNoMatch_Char()
{
for (int length = 1; length < 32; length++)
[Fact]
public static void SameSpanEndsWith_Char()
- {
+ {
string s = "456";
bool b = s.EndsWith(s);
Assert.True(b);
{
string value = "456";
- string s1 = value.Substring(0, 3);
+ string s1 = value.Substring(0, 3);
string s2 = value.Substring(1, 2);
bool b = s1.EndsWith(s2);
Assert.True(b);
Assert.True(s1.EndsWith(s2, StringComparison.InvariantCultureIgnoreCase));
Assert.True(s1.EndsWith(s2, StringComparison.OrdinalIgnoreCase));
- ReadOnlySpan<char> span = value.AsSpan(0, 3);
+ ReadOnlySpan<char> span = value.AsSpan(0, 3);
ReadOnlySpan<char> slice = value.AsSpan(1 ,2);
Assert.True(span.EndsWith(slice, StringComparison.Ordinal));
AssertExtensions.Throws<ArgumentException>("comparisonType", () => s.StartsWith("H", StringComparison.OrdinalIgnoreCase + 1));
}
- [Fact]
- public static void ZeroLengthStartsWith_Char()
- {
- var a = new char[3];
-
- string s1 = new string(a);
- string s2 = new string(a, 2, 0);
- bool b = s1.StartsWith(s2);
- Assert.True(b);
-
+ [Fact]
+ public static void ZeroLengthStartsWith_Char()
+ {
+ var a = new char[3];
+
+ string s1 = new string(a);
+ string s2 = new string(a, 2, 0);
+ bool b = s1.StartsWith(s2);
+ Assert.True(b);
+
ReadOnlySpan<char> span = s1.AsSpan();
- ReadOnlySpan<char> slice = s2.AsSpan();
- b = span.StartsWith<char>(slice);
- Assert.True(b);
- }
-
- [Fact]
- public static void SameSpanStartsWith_Char()
- {
- string s1 = "456";
- bool b = s1.StartsWith(s1);
+ ReadOnlySpan<char> slice = s2.AsSpan();
+ b = span.StartsWith<char>(slice);
+ Assert.True(b);
+ }
+
+ [Fact]
+ public static void SameSpanStartsWith_Char()
+ {
+ string s1 = "456";
+ bool b = s1.StartsWith(s1);
Assert.True(b);
- ReadOnlySpan<char> span = s1.AsSpan();
- b = span.StartsWith<char>(span);
- Assert.True(b);
- }
-
- [Fact]
- public static void LengthMismatchStartsWith_Char()
- {
- char[] a = { '4', '5', '6' };
-
- string s1 = new string(a, 0, 2);
- string s2 = new string(a, 0, 3);
- bool b = s1.StartsWith(s2);
+ ReadOnlySpan<char> span = s1.AsSpan();
+ b = span.StartsWith<char>(span);
+ Assert.True(b);
+ }
+
+ [Fact]
+ public static void LengthMismatchStartsWith_Char()
+ {
+ char[] a = { '4', '5', '6' };
+
+ string s1 = new string(a, 0, 2);
+ string s2 = new string(a, 0, 3);
+ bool b = s1.StartsWith(s2);
Assert.False(b);
ReadOnlySpan<char> span = s1.AsSpan();
- ReadOnlySpan<char> slice = s2.AsSpan();
- b = span.StartsWith<char>(slice);
- Assert.False(b);
- }
-
- [Fact]
- public static void StartsWithMatch_Char()
- {
- char[] a = { '4', '5', '6' };
-
- string s1 = new string(a, 0, 3);
- string s2 = new string(a, 0, 2);
- bool b = s1.StartsWith(s2);
- Assert.True(b);
-
- var span = new ReadOnlySpan<char>(a, 0, 3);
- var slice = new ReadOnlySpan<char>(a, 0, 2);
- b = span.StartsWith<char>(slice);
- Assert.True(b);
- }
-
- [Fact]
- public static void StartsWithMatchDifferentSpans_Char()
- {
- char[] a = { '4', '5', '6' };
- char[] b = { '4', '5', '6' };
-
- string s1 = "456";
- string s2 = "456";
- bool c = s1.StartsWith(s2);
+ ReadOnlySpan<char> slice = s2.AsSpan();
+ b = span.StartsWith<char>(slice);
+ Assert.False(b);
+ }
+
+ [Fact]
+ public static void StartsWithMatch_Char()
+ {
+ char[] a = { '4', '5', '6' };
+
+ string s1 = new string(a, 0, 3);
+ string s2 = new string(a, 0, 2);
+ bool b = s1.StartsWith(s2);
+ Assert.True(b);
+
+ var span = new ReadOnlySpan<char>(a, 0, 3);
+ var slice = new ReadOnlySpan<char>(a, 0, 2);
+ b = span.StartsWith<char>(slice);
+ Assert.True(b);
+ }
+
+ [Fact]
+ public static void StartsWithMatchDifferentSpans_Char()
+ {
+ char[] a = { '4', '5', '6' };
+ char[] b = { '4', '5', '6' };
+
+ string s1 = "456";
+ string s2 = "456";
+ bool c = s1.StartsWith(s2);
Assert.True(c);
ReadOnlySpan<char> span = s1.AsSpan();
- ReadOnlySpan<char> slice = s2.AsSpan();
- c = span.StartsWith<char>(slice);
- Assert.True(c);
- }
-
- [Fact]
- public static void StartsWithNoMatch_Char()
- {
- for (int length = 1; length < 32; length++)
- {
- for (int mismatchIndex = 0; mismatchIndex < length; mismatchIndex++)
- {
- var first = new char[length];
- var second = new char[length];
- for (int i = 0; i < length; i++)
- {
- first[i] = second[i] = (char)(i + 1);
- }
-
- second[mismatchIndex] = (char)(second[mismatchIndex] + 1);
-
- string s1 = new string(first);
- string s2 = new string(second);
- bool b = s1.StartsWith(s2, StringComparison.Ordinal);
- Assert.False(b);
-
- var firstSpan = s1.AsSpan();
- var secondSpan = s2.AsSpan();
- b = firstSpan.StartsWith<char>(secondSpan);
- Assert.False(b);
- }
- }
- }
-
- [Fact]
- public static void MakeSureNoStartsWithChecksGoOutOfRange_Char()
- {
- for (int length = 0; length < 100; length++)
- {
- var first = new char[length + 2];
- first[0] = '9';
- first[length + 1] = '9';
- var second = new char[length + 2];
- second[0] = 'a';
- second[length + 1] = 'a';
-
- string s1 = new string(first, 1, length);
- string s2 = new string(second, 1, length);
- bool b = s1.StartsWith(s2);
+ ReadOnlySpan<char> slice = s2.AsSpan();
+ c = span.StartsWith<char>(slice);
+ Assert.True(c);
+ }
+
+ [Fact]
+ public static void StartsWithNoMatch_Char()
+ {
+ for (int length = 1; length < 32; length++)
+ {
+ for (int mismatchIndex = 0; mismatchIndex < length; mismatchIndex++)
+ {
+ var first = new char[length];
+ var second = new char[length];
+ for (int i = 0; i < length; i++)
+ {
+ first[i] = second[i] = (char)(i + 1);
+ }
+
+ second[mismatchIndex] = (char)(second[mismatchIndex] + 1);
+
+ string s1 = new string(first);
+ string s2 = new string(second);
+ bool b = s1.StartsWith(s2, StringComparison.Ordinal);
+ Assert.False(b);
+
+ var firstSpan = s1.AsSpan();
+ var secondSpan = s2.AsSpan();
+ b = firstSpan.StartsWith<char>(secondSpan);
+ Assert.False(b);
+ }
+ }
+ }
+
+ [Fact]
+ public static void MakeSureNoStartsWithChecksGoOutOfRange_Char()
+ {
+ for (int length = 0; length < 100; length++)
+ {
+ var first = new char[length + 2];
+ first[0] = '9';
+ first[length + 1] = '9';
+ var second = new char[length + 2];
+ second[0] = 'a';
+ second[length + 1] = 'a';
+
+ string s1 = new string(first, 1, length);
+ string s2 = new string(second, 1, length);
+ bool b = s1.StartsWith(s2);
Assert.True(b);
ReadOnlySpan<char> span1 = s1.AsSpan();
- ReadOnlySpan<char> span2 = s2.AsSpan();
- b = span1.StartsWith<char>(span2);
- Assert.True(b);
- }
- }
-
- [Fact]
- public static void ZeroLengthStartsWith_StringComparison()
- {
- var a = new char[3];
-
- string s1 = new string(a);
- string s2 = new string(a, 2, 0);
- Assert.True(s1.StartsWith(s2, StringComparison.Ordinal));
-
- Assert.True(s1.StartsWith(s2, StringComparison.CurrentCulture));
- Assert.True(s1.StartsWith(s2, StringComparison.CurrentCultureIgnoreCase));
- Assert.True(s1.StartsWith(s2, StringComparison.InvariantCulture));
- Assert.True(s1.StartsWith(s2, StringComparison.InvariantCultureIgnoreCase));
- Assert.True(s1.StartsWith(s2, StringComparison.OrdinalIgnoreCase));
-
- s1 = string.Empty;
- Assert.True(s1.StartsWith(s2, StringComparison.Ordinal));
-
- Assert.True(s1.StartsWith(s2, StringComparison.CurrentCulture));
- Assert.True(s1.StartsWith(s2, StringComparison.CurrentCultureIgnoreCase));
- Assert.True(s1.StartsWith(s2, StringComparison.InvariantCulture));
- Assert.True(s1.StartsWith(s2, StringComparison.InvariantCultureIgnoreCase));
+ ReadOnlySpan<char> span2 = s2.AsSpan();
+ b = span1.StartsWith<char>(span2);
+ Assert.True(b);
+ }
+ }
+
+ [Fact]
+ public static void ZeroLengthStartsWith_StringComparison()
+ {
+ var a = new char[3];
+
+ string s1 = new string(a);
+ string s2 = new string(a, 2, 0);
+ Assert.True(s1.StartsWith(s2, StringComparison.Ordinal));
+
+ Assert.True(s1.StartsWith(s2, StringComparison.CurrentCulture));
+ Assert.True(s1.StartsWith(s2, StringComparison.CurrentCultureIgnoreCase));
+ Assert.True(s1.StartsWith(s2, StringComparison.InvariantCulture));
+ Assert.True(s1.StartsWith(s2, StringComparison.InvariantCultureIgnoreCase));
+ Assert.True(s1.StartsWith(s2, StringComparison.OrdinalIgnoreCase));
+
+ s1 = string.Empty;
+ Assert.True(s1.StartsWith(s2, StringComparison.Ordinal));
+
+ Assert.True(s1.StartsWith(s2, StringComparison.CurrentCulture));
+ Assert.True(s1.StartsWith(s2, StringComparison.CurrentCultureIgnoreCase));
+ Assert.True(s1.StartsWith(s2, StringComparison.InvariantCulture));
+ Assert.True(s1.StartsWith(s2, StringComparison.InvariantCultureIgnoreCase));
Assert.True(s1.StartsWith(s2, StringComparison.OrdinalIgnoreCase));
ReadOnlySpan<char> span = s1.AsSpan();
- ReadOnlySpan<char> slice = s2.AsSpan();
- Assert.True(span.StartsWith(slice, StringComparison.Ordinal));
-
- Assert.True(span.StartsWith(slice, StringComparison.CurrentCulture));
- Assert.True(span.StartsWith(slice, StringComparison.CurrentCultureIgnoreCase));
- Assert.True(span.StartsWith(slice, StringComparison.InvariantCulture));
- Assert.True(span.StartsWith(slice, StringComparison.InvariantCultureIgnoreCase));
- Assert.True(span.StartsWith(slice, StringComparison.OrdinalIgnoreCase));
-
- span = ReadOnlySpan<char>.Empty;
- Assert.True(span.StartsWith(slice, StringComparison.Ordinal));
-
- Assert.True(span.StartsWith(slice, StringComparison.CurrentCulture));
- Assert.True(span.StartsWith(slice, StringComparison.CurrentCultureIgnoreCase));
- Assert.True(span.StartsWith(slice, StringComparison.InvariantCulture));
- Assert.True(span.StartsWith(slice, StringComparison.InvariantCultureIgnoreCase));
- Assert.True(span.StartsWith(slice, StringComparison.OrdinalIgnoreCase));
- }
-
- [Fact]
- public static void SameSpanStartsWith_StringComparison()
- {
- string s1 = "456";
- Assert.True(s1.StartsWith(s1, StringComparison.Ordinal));
-
- Assert.True(s1.StartsWith(s1, StringComparison.CurrentCulture));
- Assert.True(s1.StartsWith(s1, StringComparison.CurrentCultureIgnoreCase));
- Assert.True(s1.StartsWith(s1, StringComparison.InvariantCulture));
- Assert.True(s1.StartsWith(s1, StringComparison.InvariantCultureIgnoreCase));
+ ReadOnlySpan<char> slice = s2.AsSpan();
+ Assert.True(span.StartsWith(slice, StringComparison.Ordinal));
+
+ Assert.True(span.StartsWith(slice, StringComparison.CurrentCulture));
+ Assert.True(span.StartsWith(slice, StringComparison.CurrentCultureIgnoreCase));
+ Assert.True(span.StartsWith(slice, StringComparison.InvariantCulture));
+ Assert.True(span.StartsWith(slice, StringComparison.InvariantCultureIgnoreCase));
+ Assert.True(span.StartsWith(slice, StringComparison.OrdinalIgnoreCase));
+
+ span = ReadOnlySpan<char>.Empty;
+ Assert.True(span.StartsWith(slice, StringComparison.Ordinal));
+
+ Assert.True(span.StartsWith(slice, StringComparison.CurrentCulture));
+ Assert.True(span.StartsWith(slice, StringComparison.CurrentCultureIgnoreCase));
+ Assert.True(span.StartsWith(slice, StringComparison.InvariantCulture));
+ Assert.True(span.StartsWith(slice, StringComparison.InvariantCultureIgnoreCase));
+ Assert.True(span.StartsWith(slice, StringComparison.OrdinalIgnoreCase));
+ }
+
+ [Fact]
+ public static void SameSpanStartsWith_StringComparison()
+ {
+ string s1 = "456";
+ Assert.True(s1.StartsWith(s1, StringComparison.Ordinal));
+
+ Assert.True(s1.StartsWith(s1, StringComparison.CurrentCulture));
+ Assert.True(s1.StartsWith(s1, StringComparison.CurrentCultureIgnoreCase));
+ Assert.True(s1.StartsWith(s1, StringComparison.InvariantCulture));
+ Assert.True(s1.StartsWith(s1, StringComparison.InvariantCultureIgnoreCase));
Assert.True(s1.StartsWith(s1, StringComparison.OrdinalIgnoreCase));
- ReadOnlySpan<char> span = s1.AsSpan();
- Assert.True(span.StartsWith(span, StringComparison.Ordinal));
-
- Assert.True(span.StartsWith(span, StringComparison.CurrentCulture));
- Assert.True(span.StartsWith(span, StringComparison.CurrentCultureIgnoreCase));
- Assert.True(span.StartsWith(span, StringComparison.InvariantCulture));
- Assert.True(span.StartsWith(span, StringComparison.InvariantCultureIgnoreCase));
- Assert.True(span.StartsWith(span, StringComparison.OrdinalIgnoreCase));
- }
-
- [Fact]
- public static void LengthMismatchStartsWith_StringComparison()
- {
- string value = "456";
-
- string s1 = value.Substring(0, 2);
- string s2 = value.Substring(0, 3);
- Assert.False(s1.StartsWith(s2, StringComparison.Ordinal));
-
- Assert.False(s1.StartsWith(s2, StringComparison.CurrentCulture));
- Assert.False(s1.StartsWith(s2, StringComparison.CurrentCultureIgnoreCase));
- Assert.False(s1.StartsWith(s2, StringComparison.InvariantCulture));
- Assert.False(s1.StartsWith(s2, StringComparison.InvariantCultureIgnoreCase));
+ ReadOnlySpan<char> span = s1.AsSpan();
+ Assert.True(span.StartsWith(span, StringComparison.Ordinal));
+
+ Assert.True(span.StartsWith(span, StringComparison.CurrentCulture));
+ Assert.True(span.StartsWith(span, StringComparison.CurrentCultureIgnoreCase));
+ Assert.True(span.StartsWith(span, StringComparison.InvariantCulture));
+ Assert.True(span.StartsWith(span, StringComparison.InvariantCultureIgnoreCase));
+ Assert.True(span.StartsWith(span, StringComparison.OrdinalIgnoreCase));
+ }
+
+ [Fact]
+ public static void LengthMismatchStartsWith_StringComparison()
+ {
+ string value = "456";
+
+ string s1 = value.Substring(0, 2);
+ string s2 = value.Substring(0, 3);
+ Assert.False(s1.StartsWith(s2, StringComparison.Ordinal));
+
+ Assert.False(s1.StartsWith(s2, StringComparison.CurrentCulture));
+ Assert.False(s1.StartsWith(s2, StringComparison.CurrentCultureIgnoreCase));
+ Assert.False(s1.StartsWith(s2, StringComparison.InvariantCulture));
+ Assert.False(s1.StartsWith(s2, StringComparison.InvariantCultureIgnoreCase));
Assert.False(s1.StartsWith(s2, StringComparison.OrdinalIgnoreCase));
ReadOnlySpan<char> span = s1.AsSpan();
- ReadOnlySpan<char> slice = s2.AsSpan();
- Assert.False(span.StartsWith(slice, StringComparison.Ordinal));
-
- Assert.False(span.StartsWith(slice, StringComparison.CurrentCulture));
- Assert.False(span.StartsWith(slice, StringComparison.CurrentCultureIgnoreCase));
- Assert.False(span.StartsWith(slice, StringComparison.InvariantCulture));
- Assert.False(span.StartsWith(slice, StringComparison.InvariantCultureIgnoreCase));
- Assert.False(span.StartsWith(slice, StringComparison.OrdinalIgnoreCase));
- }
-
- [Fact]
- public static void StartsWithMatch_StringComparison()
- {
- string value = "456";
-
- string s1 = value.Substring(0, 3);
- string s2 = value.Substring(0, 2);
- Assert.True(s1.StartsWith(s2, StringComparison.Ordinal));
-
- Assert.True(s1.StartsWith(s2, StringComparison.CurrentCulture));
- Assert.True(s1.StartsWith(s2, StringComparison.CurrentCultureIgnoreCase));
- Assert.True(s1.StartsWith(s2, StringComparison.InvariantCulture));
- Assert.True(s1.StartsWith(s2, StringComparison.InvariantCultureIgnoreCase));
+ ReadOnlySpan<char> slice = s2.AsSpan();
+ Assert.False(span.StartsWith(slice, StringComparison.Ordinal));
+
+ Assert.False(span.StartsWith(slice, StringComparison.CurrentCulture));
+ Assert.False(span.StartsWith(slice, StringComparison.CurrentCultureIgnoreCase));
+ Assert.False(span.StartsWith(slice, StringComparison.InvariantCulture));
+ Assert.False(span.StartsWith(slice, StringComparison.InvariantCultureIgnoreCase));
+ Assert.False(span.StartsWith(slice, StringComparison.OrdinalIgnoreCase));
+ }
+
+ [Fact]
+ public static void StartsWithMatch_StringComparison()
+ {
+ string value = "456";
+
+ string s1 = value.Substring(0, 3);
+ string s2 = value.Substring(0, 2);
+ Assert.True(s1.StartsWith(s2, StringComparison.Ordinal));
+
+ Assert.True(s1.StartsWith(s2, StringComparison.CurrentCulture));
+ Assert.True(s1.StartsWith(s2, StringComparison.CurrentCultureIgnoreCase));
+ Assert.True(s1.StartsWith(s2, StringComparison.InvariantCulture));
+ Assert.True(s1.StartsWith(s2, StringComparison.InvariantCultureIgnoreCase));
Assert.True(s1.StartsWith(s2, StringComparison.OrdinalIgnoreCase));
ReadOnlySpan<char> span = s1.AsSpan();
- ReadOnlySpan<char> slice = s2.AsSpan();
- Assert.True(span.StartsWith(slice, StringComparison.Ordinal));
-
- Assert.True(span.StartsWith(slice, StringComparison.CurrentCulture));
- Assert.True(span.StartsWith(slice, StringComparison.CurrentCultureIgnoreCase));
- Assert.True(span.StartsWith(slice, StringComparison.InvariantCulture));
- Assert.True(span.StartsWith(slice, StringComparison.InvariantCultureIgnoreCase));
- Assert.True(span.StartsWith(slice, StringComparison.OrdinalIgnoreCase));
+ ReadOnlySpan<char> slice = s2.AsSpan();
+ Assert.True(span.StartsWith(slice, StringComparison.Ordinal));
+
+ Assert.True(span.StartsWith(slice, StringComparison.CurrentCulture));
+ Assert.True(span.StartsWith(slice, StringComparison.CurrentCultureIgnoreCase));
+ Assert.True(span.StartsWith(slice, StringComparison.InvariantCulture));
+ Assert.True(span.StartsWith(slice, StringComparison.InvariantCultureIgnoreCase));
+ Assert.True(span.StartsWith(slice, StringComparison.OrdinalIgnoreCase));
}
[Theory]
{
char[] expectedSource = { 'a', 'B', 'c' };
char[] a = { 'a', 'B', 'c' };
- var expectedDestination = new char[1] { 'a' };
+ var expectedDestination = new char[1] { 'a' };
Span<char> destination = new char[1] { 'a' };
string emptyString = new string(a, 2, 0);
Assert.Equal("", emptyString.ToLowerInvariant());
- ReadOnlySpan<char> source = emptyString.AsSpan();
+ ReadOnlySpan<char> source = emptyString.AsSpan();
Assert.Equal(source.Length, source.ToLower(destination, CultureInfo.CurrentCulture));
Assert.Equal(source.Length, source.ToLowerInvariant(destination));
Assert.Equal(expectedDestination, destination.ToArray());
Assert.Equal(expectedSource, a);
- emptyString = string.Empty;
+ emptyString = string.Empty;
Assert.Equal("", emptyString.ToLowerInvariant());
source = emptyString.AsSpan();
{
var expectedDestination = new char[3] { 'b', 'c', 'b' };
- {
+ {
char[] a = { 'a', 'B', 'c', 'B', 'c', 'B' };
string s1 = new string(a, 1, 3);
{
var expectedSource = new char[3] { 'a', 'B', 'c' };
- string s1 = "aBc";
+ string s1 = "aBc";
var expectedDestinationString = "abc";
Assert.Equal(expectedDestinationString, s1.ToLowerInvariant());
{
char[] expectedSource = { 'a', 'B', 'c' };
char[] a = { 'a', 'B', 'c' };
- var expectedDestination = new char[1] { 'a' };
+ var expectedDestination = new char[1] { 'a' };
Span<char> destination = new char[1] { 'a' };
- string emptyString = new string(a, 2, 0);
- Assert.Equal("", emptyString.ToUpperInvariant());
+ string emptyString = new string(a, 2, 0);
+ Assert.Equal("", emptyString.ToUpperInvariant());
- ReadOnlySpan<char> source = emptyString.AsSpan();
+ ReadOnlySpan<char> source = emptyString.AsSpan();
Assert.Equal(source.Length, source.ToUpper(destination, CultureInfo.CurrentCulture));
Assert.Equal(source.Length, source.ToUpperInvariant(destination));
Assert.Equal(expectedDestination, destination.ToArray());
Assert.Equal(expectedSource, a);
- emptyString = string.Empty;
+ emptyString = string.Empty;
Assert.Equal("", emptyString.ToUpperInvariant());
source = emptyString.AsSpan();
{
var expectedDestination = new char[3] { 'B', 'C', 'B' };
- {
+ {
char[] a = { 'a', 'b', 'C', 'b', 'C', 'b' };
- string s1 = new string(a, 1, 3);
+ string s1 = new string(a, 1, 3);
Assert.Equal(expectedDestination, s1.ToUpper(CultureInfo.CurrentCulture).ToArray());
var source = new ReadOnlySpan<char>(a, 1, 3);
{
char[] a = { 'a', 'b', 'C', 'b', 'C', 'b' };
- string s1 = new string(a, 1, 3);
+ string s1 = new string(a, 1, 3);
Assert.Equal(expectedDestination, s1.ToUpperInvariant().ToArray());
var source = new ReadOnlySpan<char>(a, 1, 3);
{
var expectedSource = new char[3] { 'a', 'B', 'c' };
- string s1 = "aBc";
+ string s1 = "aBc";
var expectedDestinationString = "ABC";
Assert.Equal(expectedDestinationString, s1.ToUpperInvariant());
a[0] = 'c';
a[length - 1] = 'c';
- string s1 = new string(a);
+ string s1 = new string(a);
string trimResultString = s1.Trim(chars);
string trimStartResultString = s1.TrimStart(chars);
string trimEndResultString = s1.TrimEnd(chars);
Thread.CurrentThread.CurrentCulture = backupCulture;
s1 = "\u0069\u00df\u0049\u03b4"; // ißIδ
- s2 = "\u0069\u03b4\u03b4\u0049"; // iδδI
+ s2 = "\u0069\u03b4\u03b4\u0049"; // iδδI
Assert.False(s1.StartsWith(s2, StringComparison.Ordinal));
Assert.False(s1.StartsWith(s2, StringComparison.InvariantCulture));
out argInfos);
CallSiteBinder binder;
- if (String.IsNullOrEmpty(methodName))
+ if (string.IsNullOrEmpty(methodName))
{
//null or empty indicates delegate invocation.
binder = new CSharpInvokeBinder(
public static dynamic ValueTypeDelegate() => (Func<PrivateValueType>)(() => new PrivateValueType());
- public unsafe static dynamic PointerArray() => new PrivateValueType*[4];
+ public static unsafe dynamic PointerArray() => new PrivateValueType*[4];
public static dynamic PrivateInterfaceDelegate() => (Func<IPrivateInterface>)(() => null);
dFirst.DoNothing();
dynamic d = new DerivedOuterHidingNested();
Assert.Equal(42, d.Inner());
- }
+ }
[Fact]
public void CannotCallOperatorDirectly()
return span.SequenceEqual(value);
}
- public unsafe static string Create<TState>(int length, TState state, SpanAction<char, TState> action)
+ public static unsafe string Create<TState>(int length, TState state, SpanAction<char, TState> action)
{
if (action == null)
throw new ArgumentNullException(nameof(action));
return result;
}
- internal unsafe static string Concat(ReadOnlySpan<char> str0, ReadOnlySpan<char> str1)
+ internal static unsafe string Concat(ReadOnlySpan<char> str0, ReadOnlySpan<char> str1)
{
var result = new string('\0', checked(str0.Length + str1.Length));
fixed (char* resultPtr = result)
return result;
}
- internal unsafe static string Concat(ReadOnlySpan<char> str0, ReadOnlySpan<char> str1, ReadOnlySpan<char> str2)
+ internal static unsafe string Concat(ReadOnlySpan<char> str0, ReadOnlySpan<char> str1, ReadOnlySpan<char> str2)
{
var result = new string('\0', checked(str0.Length + str1.Length + str2.Length));
fixed (char* resultPtr = result)
[SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
private static volatile IntPtr s_processWinStation = IntPtr.Zero;
private static volatile bool s_isUserInteractive = false;
- private unsafe static bool UserInteractive
+ private static unsafe bool UserInteractive
{
get
{
{
public partial class CompilerResults
{
- private Evidence _evidence;
+ private Evidence _evidence;
[Obsolete("CAS policy is obsolete and will be removed in a future release of the .NET Framework. Please see https://go2.microsoft.com/fwlink/?LinkId=131738 for more information.")]
public Evidence Evidence
namespace System.CodeDom.Tests
{
- public class CodeArgumentReferenceExpressionTests : CodeObjectTestBase<CodeArgumentReferenceExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var argumentReference = new CodeArgumentReferenceExpression();
- Assert.Empty(argumentReference.ParameterName);
- }
+ public class CodeArgumentReferenceExpressionTests : CodeObjectTestBase<CodeArgumentReferenceExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var argumentReference = new CodeArgumentReferenceExpression();
+ Assert.Empty(argumentReference.ParameterName);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Ctor_String(string parameterName)
- {
- var argumentReference = new CodeArgumentReferenceExpression(parameterName);
- Assert.Equal(parameterName ?? string.Empty, argumentReference.ParameterName);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Ctor_String(string parameterName)
+ {
+ var argumentReference = new CodeArgumentReferenceExpression(parameterName);
+ Assert.Equal(parameterName ?? string.Empty, argumentReference.ParameterName);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void ParameterName_Set_Get_ReturnsExpected(string parameterName)
- {
- var argumentReference = new CodeArgumentReferenceExpression();
- argumentReference.ParameterName = parameterName;
- Assert.Equal(parameterName ?? string.Empty, argumentReference.ParameterName);
- }
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void ParameterName_Set_Get_ReturnsExpected(string parameterName)
+ {
+ var argumentReference = new CodeArgumentReferenceExpression();
+ argumentReference.ParameterName = parameterName;
+ Assert.Equal(parameterName ?? string.Empty, argumentReference.ParameterName);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeArrayCreateExpressionTests : CodeObjectTestBase<CodeArrayCreateExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var arrayCreate = new CodeArrayCreateExpression();
- Assert.Equal(typeof(void).FullName, arrayCreate.CreateType.BaseType);
- Assert.Empty(arrayCreate.Initializers);
+ public class CodeArrayCreateExpressionTests : CodeObjectTestBase<CodeArrayCreateExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var arrayCreate = new CodeArrayCreateExpression();
+ Assert.Equal(typeof(void).FullName, arrayCreate.CreateType.BaseType);
+ Assert.Empty(arrayCreate.Initializers);
- Assert.Equal(0, arrayCreate.Size);
- Assert.Null(arrayCreate.SizeExpression);
- }
+ Assert.Equal(0, arrayCreate.Size);
+ Assert.Null(arrayCreate.SizeExpression);
+ }
- public static IEnumerable<object[]> TypeString_TestData()
- {
- yield return new object[] { null, "System.Void" };
- yield return new object[] { "", "System.Void" };
- yield return new object[] { "Int32", "Int32" };
- }
+ public static IEnumerable<object[]> TypeString_TestData()
+ {
+ yield return new object[] { null, "System.Void" };
+ yield return new object[] { "", "System.Void" };
+ yield return new object[] { "Int32", "Int32" };
+ }
- [Theory]
- [MemberData(nameof(TypeString_TestData))]
- public void Ctor_String_EmptyParamsCodeExpression(string type, string expectedBaseType)
- {
- CodeExpression[] initializers = new CodeExpression[0];
- var arrayCreate = new CodeArrayCreateExpression(type, initializers);
- Assert.Equal(expectedBaseType, arrayCreate.CreateType.BaseType);
- Assert.Equal(initializers, arrayCreate.Initializers.Cast<CodeExpression>());
- Assert.Equal(0, arrayCreate.Size);
- Assert.Null(arrayCreate.SizeExpression);
- }
+ [Theory]
+ [MemberData(nameof(TypeString_TestData))]
+ public void Ctor_String_EmptyParamsCodeExpression(string type, string expectedBaseType)
+ {
+ CodeExpression[] initializers = new CodeExpression[0];
+ var arrayCreate = new CodeArrayCreateExpression(type, initializers);
+ Assert.Equal(expectedBaseType, arrayCreate.CreateType.BaseType);
+ Assert.Equal(initializers, arrayCreate.Initializers.Cast<CodeExpression>());
+ Assert.Equal(0, arrayCreate.Size);
+ Assert.Null(arrayCreate.SizeExpression);
+ }
- [Theory]
- [MemberData(nameof(TypeString_TestData))]
- public void Ctor_String_NonEmptyParamsCodeExpression(string type, string expectedBaseType)
- {
- CodeExpression[] initializers = new CodeExpression[] { new CodePrimitiveExpression("Value1"), new CodePrimitiveExpression("Value2") };
- var arrayCreate = new CodeArrayCreateExpression(type, initializers);
- Assert.Equal(expectedBaseType, arrayCreate.CreateType.BaseType);
- Assert.Equal(initializers, arrayCreate.Initializers.Cast<CodeExpression>());
- Assert.Equal(0, arrayCreate.Size);
- Assert.Null(arrayCreate.SizeExpression);
- }
+ [Theory]
+ [MemberData(nameof(TypeString_TestData))]
+ public void Ctor_String_NonEmptyParamsCodeExpression(string type, string expectedBaseType)
+ {
+ CodeExpression[] initializers = new CodeExpression[] { new CodePrimitiveExpression("Value1"), new CodePrimitiveExpression("Value2") };
+ var arrayCreate = new CodeArrayCreateExpression(type, initializers);
+ Assert.Equal(expectedBaseType, arrayCreate.CreateType.BaseType);
+ Assert.Equal(initializers, arrayCreate.Initializers.Cast<CodeExpression>());
+ Assert.Equal(0, arrayCreate.Size);
+ Assert.Null(arrayCreate.SizeExpression);
+ }
- public static IEnumerable<object[]> Type_TestData()
- {
- yield return new object[] { typeof(int), "System.Int32" };
- yield return new object[] { typeof(List<>), "System.Collections.Generic.List`1" };
- yield return new object[] { typeof(void), "System.Void" };
- }
+ public static IEnumerable<object[]> Type_TestData()
+ {
+ yield return new object[] { typeof(int), "System.Int32" };
+ yield return new object[] { typeof(List<>), "System.Collections.Generic.List`1" };
+ yield return new object[] { typeof(void), "System.Void" };
+ }
- [Theory]
- [MemberData(nameof(Type_TestData))]
- public void Ctor_Type_EmptyParamsCodeExpression(Type type, string expectedBaseType)
- {
- CodeExpression[] initializers = new CodeExpression[0];
- var arrayCreate = new CodeArrayCreateExpression(type, initializers);
- Assert.Equal(expectedBaseType, arrayCreate.CreateType.BaseType);
- Assert.Equal(initializers, arrayCreate.Initializers.Cast<CodeExpression>());
- Assert.Equal(0, arrayCreate.Size);
- Assert.Null(arrayCreate.SizeExpression);
- }
+ [Theory]
+ [MemberData(nameof(Type_TestData))]
+ public void Ctor_Type_EmptyParamsCodeExpression(Type type, string expectedBaseType)
+ {
+ CodeExpression[] initializers = new CodeExpression[0];
+ var arrayCreate = new CodeArrayCreateExpression(type, initializers);
+ Assert.Equal(expectedBaseType, arrayCreate.CreateType.BaseType);
+ Assert.Equal(initializers, arrayCreate.Initializers.Cast<CodeExpression>());
+ Assert.Equal(0, arrayCreate.Size);
+ Assert.Null(arrayCreate.SizeExpression);
+ }
- [Theory]
- [MemberData(nameof(Type_TestData))]
- public void Ctor_Type_NonEmptyParamsCodeExpression(Type type, string expectedBaseType)
- {
- CodeExpression[] initializers = new CodeExpression[] { new CodePrimitiveExpression("Value1"), new CodePrimitiveExpression("Value2") };
- var arrayCreate = new CodeArrayCreateExpression(type, initializers);
- Assert.Equal(expectedBaseType, arrayCreate.CreateType.BaseType);
- Assert.Equal(initializers, arrayCreate.Initializers.Cast<CodeExpression>());
- Assert.Equal(0, arrayCreate.Size);
- Assert.Null(arrayCreate.SizeExpression);
- }
+ [Theory]
+ [MemberData(nameof(Type_TestData))]
+ public void Ctor_Type_NonEmptyParamsCodeExpression(Type type, string expectedBaseType)
+ {
+ CodeExpression[] initializers = new CodeExpression[] { new CodePrimitiveExpression("Value1"), new CodePrimitiveExpression("Value2") };
+ var arrayCreate = new CodeArrayCreateExpression(type, initializers);
+ Assert.Equal(expectedBaseType, arrayCreate.CreateType.BaseType);
+ Assert.Equal(initializers, arrayCreate.Initializers.Cast<CodeExpression>());
+ Assert.Equal(0, arrayCreate.Size);
+ Assert.Null(arrayCreate.SizeExpression);
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Ctor_CodeTypeReference_ParamsCodeExpression(CodeTypeReference type)
- {
- CodeExpression[] initializers = new CodeExpression[0];
- var arrayCreate = new CodeArrayCreateExpression(type, initializers);
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, arrayCreate.CreateType.BaseType);
- Assert.Equal(initializers, arrayCreate.Initializers.Cast<CodeExpression>());
- Assert.Equal(0, arrayCreate.Size);
- Assert.Null(arrayCreate.SizeExpression);
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Ctor_CodeTypeReference_ParamsCodeExpression(CodeTypeReference type)
+ {
+ CodeExpression[] initializers = new CodeExpression[0];
+ var arrayCreate = new CodeArrayCreateExpression(type, initializers);
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, arrayCreate.CreateType.BaseType);
+ Assert.Equal(initializers, arrayCreate.Initializers.Cast<CodeExpression>());
+ Assert.Equal(0, arrayCreate.Size);
+ Assert.Null(arrayCreate.SizeExpression);
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Ctor_CodeTypeReference_NonEmptyParamsCodeExpression(CodeTypeReference type)
- {
- CodeExpression[] initializers = new CodeExpression[] { new CodePrimitiveExpression("Value1"), new CodePrimitiveExpression("Value2") };
- var arrayCreate = new CodeArrayCreateExpression(type, initializers);
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, arrayCreate.CreateType.BaseType);
- Assert.Equal(initializers, arrayCreate.Initializers.Cast<CodeExpression>());
- Assert.Equal(0, arrayCreate.Size);
- Assert.Null(arrayCreate.SizeExpression);
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Ctor_CodeTypeReference_NonEmptyParamsCodeExpression(CodeTypeReference type)
+ {
+ CodeExpression[] initializers = new CodeExpression[] { new CodePrimitiveExpression("Value1"), new CodePrimitiveExpression("Value2") };
+ var arrayCreate = new CodeArrayCreateExpression(type, initializers);
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, arrayCreate.CreateType.BaseType);
+ Assert.Equal(initializers, arrayCreate.Initializers.Cast<CodeExpression>());
+ Assert.Equal(0, arrayCreate.Size);
+ Assert.Null(arrayCreate.SizeExpression);
+ }
- [Theory]
- [MemberData(nameof(TypeString_TestData))]
- public void Ctor_String_Int(string type, string expectedBaseType)
- {
- foreach (int size in new int[] { -1, 0, 1 })
- {
- var arrayCreate = new CodeArrayCreateExpression(type, size);
- Assert.Equal(expectedBaseType, arrayCreate.CreateType.BaseType);
- Assert.Empty(arrayCreate.Initializers);
- Assert.Equal(size, arrayCreate.Size);
- Assert.Null(arrayCreate.SizeExpression);
- }
- }
+ [Theory]
+ [MemberData(nameof(TypeString_TestData))]
+ public void Ctor_String_Int(string type, string expectedBaseType)
+ {
+ foreach (int size in new int[] { -1, 0, 1 })
+ {
+ var arrayCreate = new CodeArrayCreateExpression(type, size);
+ Assert.Equal(expectedBaseType, arrayCreate.CreateType.BaseType);
+ Assert.Empty(arrayCreate.Initializers);
+ Assert.Equal(size, arrayCreate.Size);
+ Assert.Null(arrayCreate.SizeExpression);
+ }
+ }
- [Theory]
- [MemberData(nameof(Type_TestData))]
- public void Ctor_Type_Int(Type type, string expectedBaseType)
- {
- foreach (int size in new int[] { -1, 0, 1 })
- {
- var arrayCreate = new CodeArrayCreateExpression(type, size);
- Assert.Equal(expectedBaseType, arrayCreate.CreateType.BaseType);
- Assert.Empty(arrayCreate.Initializers);
- Assert.Equal(size, arrayCreate.Size);
- Assert.Null(arrayCreate.SizeExpression);
- }
- }
+ [Theory]
+ [MemberData(nameof(Type_TestData))]
+ public void Ctor_Type_Int(Type type, string expectedBaseType)
+ {
+ foreach (int size in new int[] { -1, 0, 1 })
+ {
+ var arrayCreate = new CodeArrayCreateExpression(type, size);
+ Assert.Equal(expectedBaseType, arrayCreate.CreateType.BaseType);
+ Assert.Empty(arrayCreate.Initializers);
+ Assert.Equal(size, arrayCreate.Size);
+ Assert.Null(arrayCreate.SizeExpression);
+ }
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Ctor_CodeTypeReference_Int(CodeTypeReference type)
- {
- foreach (int size in new int[] { -1, 0, 1 })
- {
- var arrayCreate = new CodeArrayCreateExpression(type, size);
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, arrayCreate.CreateType.BaseType);
- Assert.Empty(arrayCreate.Initializers);
- Assert.Equal(size, arrayCreate.Size);
- Assert.Null(arrayCreate.SizeExpression);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Ctor_CodeTypeReference_Int(CodeTypeReference type)
+ {
+ foreach (int size in new int[] { -1, 0, 1 })
+ {
+ var arrayCreate = new CodeArrayCreateExpression(type, size);
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, arrayCreate.CreateType.BaseType);
+ Assert.Empty(arrayCreate.Initializers);
+ Assert.Equal(size, arrayCreate.Size);
+ Assert.Null(arrayCreate.SizeExpression);
+ }
+ }
- [Theory]
- [MemberData(nameof(TypeString_TestData))]
- public void Ctor_String_CodeExpression(string type, string expectedBaseType)
- {
- foreach (CodeExpression sizeExpression in new CodeExpression[] { null, new CodePrimitiveExpression("Value") })
- {
- var arrayCreate = new CodeArrayCreateExpression(type, sizeExpression);
- Assert.Equal(expectedBaseType, arrayCreate.CreateType.BaseType);
- Assert.Empty(arrayCreate.Initializers);
- Assert.Equal(0, arrayCreate.Size);
- Assert.Equal(sizeExpression, arrayCreate.SizeExpression);
- }
- }
+ [Theory]
+ [MemberData(nameof(TypeString_TestData))]
+ public void Ctor_String_CodeExpression(string type, string expectedBaseType)
+ {
+ foreach (CodeExpression sizeExpression in new CodeExpression[] { null, new CodePrimitiveExpression("Value") })
+ {
+ var arrayCreate = new CodeArrayCreateExpression(type, sizeExpression);
+ Assert.Equal(expectedBaseType, arrayCreate.CreateType.BaseType);
+ Assert.Empty(arrayCreate.Initializers);
+ Assert.Equal(0, arrayCreate.Size);
+ Assert.Equal(sizeExpression, arrayCreate.SizeExpression);
+ }
+ }
- [Theory]
- [MemberData(nameof(Type_TestData))]
- public void Ctor_Type_CodeExpression(Type type, string expectedBaseType)
- {
- foreach (CodeExpression sizeExpression in new CodeExpression[] { null, new CodePrimitiveExpression("Value") })
- {
- var arrayCreate = new CodeArrayCreateExpression(type, sizeExpression);
- Assert.Equal(expectedBaseType, arrayCreate.CreateType.BaseType);
- Assert.Empty(arrayCreate.Initializers);
- Assert.Equal(0, arrayCreate.Size);
- Assert.Equal(sizeExpression, arrayCreate.SizeExpression);
- }
- }
+ [Theory]
+ [MemberData(nameof(Type_TestData))]
+ public void Ctor_Type_CodeExpression(Type type, string expectedBaseType)
+ {
+ foreach (CodeExpression sizeExpression in new CodeExpression[] { null, new CodePrimitiveExpression("Value") })
+ {
+ var arrayCreate = new CodeArrayCreateExpression(type, sizeExpression);
+ Assert.Equal(expectedBaseType, arrayCreate.CreateType.BaseType);
+ Assert.Empty(arrayCreate.Initializers);
+ Assert.Equal(0, arrayCreate.Size);
+ Assert.Equal(sizeExpression, arrayCreate.SizeExpression);
+ }
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Ctor_CodeTypeReference_CodeExpression(CodeTypeReference type)
- {
- foreach (CodeExpression sizeExpression in new CodeExpression[] { null, new CodePrimitiveExpression("Value") })
- {
- var arrayCreate = new CodeArrayCreateExpression(type, sizeExpression);
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, arrayCreate.CreateType.BaseType);
- Assert.Empty(arrayCreate.Initializers);
- Assert.Equal(0, arrayCreate.Size);
- Assert.Equal(sizeExpression, arrayCreate.SizeExpression);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Ctor_CodeTypeReference_CodeExpression(CodeTypeReference type)
+ {
+ foreach (CodeExpression sizeExpression in new CodeExpression[] { null, new CodePrimitiveExpression("Value") })
+ {
+ var arrayCreate = new CodeArrayCreateExpression(type, sizeExpression);
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, arrayCreate.CreateType.BaseType);
+ Assert.Empty(arrayCreate.Initializers);
+ Assert.Equal(0, arrayCreate.Size);
+ Assert.Equal(sizeExpression, arrayCreate.SizeExpression);
+ }
+ }
- [Fact]
- public void Ctor_NullType_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeArrayCreateExpression((Type)null, new CodePrimitiveExpression()));
- AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeArrayCreateExpression((Type)null, new CodePrimitiveExpression[0]));
- AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeArrayCreateExpression((Type)null, 0));
- }
+ [Fact]
+ public void Ctor_NullType_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeArrayCreateExpression((Type)null, new CodePrimitiveExpression()));
+ AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeArrayCreateExpression((Type)null, new CodePrimitiveExpression[0]));
+ AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeArrayCreateExpression((Type)null, 0));
+ }
- [Fact]
- public void Ctor_NullTypeInitializers_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeArrayCreateExpression("", (CodePrimitiveExpression[])null));
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeArrayCreateExpression(typeof(void), (CodePrimitiveExpression[])null));
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeArrayCreateExpression(new CodeTypeReference(), (CodePrimitiveExpression[])null));
- }
+ [Fact]
+ public void Ctor_NullTypeInitializers_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeArrayCreateExpression("", (CodePrimitiveExpression[])null));
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeArrayCreateExpression(typeof(void), (CodePrimitiveExpression[])null));
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeArrayCreateExpression(new CodeTypeReference(), (CodePrimitiveExpression[])null));
+ }
- [Fact]
- public void Ctor_NullTypeInInitalizers_ThrowsArgumentNullException()
- {
- CodePrimitiveExpression[] initializers = new CodePrimitiveExpression[] { null };
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeArrayCreateExpression("", initializers));
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeArrayCreateExpression(typeof(void), initializers));
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeArrayCreateExpression(new CodeTypeReference(), initializers));
- }
+ [Fact]
+ public void Ctor_NullTypeInInitalizers_ThrowsArgumentNullException()
+ {
+ CodePrimitiveExpression[] initializers = new CodePrimitiveExpression[] { null };
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeArrayCreateExpression("", initializers));
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeArrayCreateExpression(typeof(void), initializers));
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeArrayCreateExpression(new CodeTypeReference(), initializers));
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void CreateType_Set_Get_ReturnsExpected(CodeTypeReference value)
- {
- var arrayCreate = new CodeArrayCreateExpression();
- arrayCreate.CreateType = value;
- Assert.Equal((value ?? new CodeTypeReference("")).BaseType, arrayCreate.CreateType.BaseType);
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void CreateType_Set_Get_ReturnsExpected(CodeTypeReference value)
+ {
+ var arrayCreate = new CodeArrayCreateExpression();
+ arrayCreate.CreateType = value;
+ Assert.Equal((value ?? new CodeTypeReference("")).BaseType, arrayCreate.CreateType.BaseType);
+ }
- [Fact]
- public void Initializers_AddMultiple_ReturnsExpected()
- {
- var arrayCreate = new CodeArrayCreateExpression();
+ [Fact]
+ public void Initializers_AddMultiple_ReturnsExpected()
+ {
+ var arrayCreate = new CodeArrayCreateExpression();
- CodeExpression expression1 = new CodePrimitiveExpression("Value1");
- arrayCreate.Initializers.Add(expression1);
- Assert.Equal(new CodeExpression[] { expression1 }, arrayCreate.Initializers.Cast<CodeExpression>());
+ CodeExpression expression1 = new CodePrimitiveExpression("Value1");
+ arrayCreate.Initializers.Add(expression1);
+ Assert.Equal(new CodeExpression[] { expression1 }, arrayCreate.Initializers.Cast<CodeExpression>());
- CodeExpression expression2 = new CodePrimitiveExpression("Value2");
- arrayCreate.Initializers.Add(expression2);
- Assert.Equal(new CodeExpression[] { expression1, expression2 }, arrayCreate.Initializers.Cast<CodeExpression>());
- }
+ CodeExpression expression2 = new CodePrimitiveExpression("Value2");
+ arrayCreate.Initializers.Add(expression2);
+ Assert.Equal(new CodeExpression[] { expression1, expression2 }, arrayCreate.Initializers.Cast<CodeExpression>());
+ }
- [Theory]
- [InlineData(-1)]
- [InlineData(0)]
- [InlineData(1)]
- public void Size_Set_Get_ReturnsExpected(int value)
- {
- var arrayCreate = new CodeArrayCreateExpression();
- arrayCreate.Size = value;
- Assert.Equal(value, arrayCreate.Size);
- }
+ [Theory]
+ [InlineData(-1)]
+ [InlineData(0)]
+ [InlineData(1)]
+ public void Size_Set_Get_ReturnsExpected(int value)
+ {
+ var arrayCreate = new CodeArrayCreateExpression();
+ arrayCreate.Size = value;
+ Assert.Equal(value, arrayCreate.Size);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void SizeExpression_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var arrayCreate = new CodeArrayCreateExpression();
- arrayCreate.SizeExpression = value;
- Assert.Equal(value, arrayCreate.SizeExpression);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void SizeExpression_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var arrayCreate = new CodeArrayCreateExpression();
+ arrayCreate.SizeExpression = value;
+ Assert.Equal(value, arrayCreate.SizeExpression);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeArrayIndexerExpressionTests : CodeObjectTestBase<CodeArrayIndexerExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var arrayIndexer = new CodeArrayIndexerExpression();
- Assert.Null(arrayIndexer.TargetObject);
- Assert.Empty(arrayIndexer.Indices);
- }
+ public class CodeArrayIndexerExpressionTests : CodeObjectTestBase<CodeArrayIndexerExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var arrayIndexer = new CodeArrayIndexerExpression();
+ Assert.Null(arrayIndexer.TargetObject);
+ Assert.Empty(arrayIndexer.Indices);
+ }
- public static IEnumerable<object[]> Ctor_TestData()
- {
- yield return new object[] { null, new CodeExpression[0] };
- yield return new object[] { new CodePrimitiveExpression("Value1"), new CodeExpression[] { new CodePrimitiveExpression("Value2") } };
- }
+ public static IEnumerable<object[]> Ctor_TestData()
+ {
+ yield return new object[] { null, new CodeExpression[0] };
+ yield return new object[] { new CodePrimitiveExpression("Value1"), new CodeExpression[] { new CodePrimitiveExpression("Value2") } };
+ }
- [Theory]
- [MemberData(nameof(Ctor_TestData))]
- public void Ctor(CodeExpression targetObject, CodeExpression[] indices)
- {
- var arrayIndexer = new CodeArrayIndexerExpression(targetObject, indices);
- Assert.Equal(targetObject, arrayIndexer.TargetObject);
- Assert.Equal(indices, arrayIndexer.Indices.Cast<CodeExpression>());
- }
+ [Theory]
+ [MemberData(nameof(Ctor_TestData))]
+ public void Ctor(CodeExpression targetObject, CodeExpression[] indices)
+ {
+ var arrayIndexer = new CodeArrayIndexerExpression(targetObject, indices);
+ Assert.Equal(targetObject, arrayIndexer.TargetObject);
+ Assert.Equal(indices, arrayIndexer.Indices.Cast<CodeExpression>());
+ }
- [Fact]
- public void Ctor_NullIndices_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeArrayIndexerExpression(new CodeExpression(), null));
- }
+ [Fact]
+ public void Ctor_NullIndices_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeArrayIndexerExpression(new CodeExpression(), null));
+ }
- [Fact]
- public void Ctor_NullObjectInIndices_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeArrayIndexerExpression(new CodeExpression(), new CodeExpression[] { null }));
- }
+ [Fact]
+ public void Ctor_NullObjectInIndices_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeArrayIndexerExpression(new CodeExpression(), new CodeExpression[] { null }));
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var arrayIndexer = new CodeArrayIndexerExpression();
- arrayIndexer.TargetObject = value;
- Assert.Equal(value, arrayIndexer.TargetObject);
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var arrayIndexer = new CodeArrayIndexerExpression();
+ arrayIndexer.TargetObject = value;
+ Assert.Equal(value, arrayIndexer.TargetObject);
+ }
- [Fact]
- public void Indices_AddMultiple_ReturnsExpected()
- {
- var arrayIndexer = new CodeArrayIndexerExpression();
+ [Fact]
+ public void Indices_AddMultiple_ReturnsExpected()
+ {
+ var arrayIndexer = new CodeArrayIndexerExpression();
- CodeExpression expression1 = new CodePrimitiveExpression("Value1");
- arrayIndexer.Indices.Add(expression1);
- Assert.Equal(new CodeExpression[] { expression1 }, arrayIndexer.Indices.Cast<CodeExpression>());
+ CodeExpression expression1 = new CodePrimitiveExpression("Value1");
+ arrayIndexer.Indices.Add(expression1);
+ Assert.Equal(new CodeExpression[] { expression1 }, arrayIndexer.Indices.Cast<CodeExpression>());
- CodeExpression expression2 = new CodePrimitiveExpression("Value2");
- arrayIndexer.Indices.Add(expression2);
- Assert.Equal(new CodeExpression[] { expression1, expression2 }, arrayIndexer.Indices.Cast<CodeExpression>());
- }
- }
+ CodeExpression expression2 = new CodePrimitiveExpression("Value2");
+ arrayIndexer.Indices.Add(expression2);
+ Assert.Equal(new CodeExpression[] { expression1, expression2 }, arrayIndexer.Indices.Cast<CodeExpression>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeAssignStatementTests : CodeStatementTestBase<CodeAssignStatement>
- {
- [Fact]
- public void Ctor_Default()
- {
- var assign = new CodeAssignStatement();
- Assert.Null(assign.Left);
- Assert.Null(assign.Right);
- }
+ public class CodeAssignStatementTests : CodeStatementTestBase<CodeAssignStatement>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var assign = new CodeAssignStatement();
+ Assert.Null(assign.Left);
+ Assert.Null(assign.Right);
+ }
- public static IEnumerable<object[]> Ctor_TestData()
- {
- yield return new object[] { null, null };
- yield return new object[] { new CodePrimitiveExpression("Value1"), null };
- yield return new object[] { null, new CodePrimitiveExpression("Value2") };
- yield return new object[] { new CodePrimitiveExpression("Value1"), new CodePrimitiveExpression("Value2") };
- }
+ public static IEnumerable<object[]> Ctor_TestData()
+ {
+ yield return new object[] { null, null };
+ yield return new object[] { new CodePrimitiveExpression("Value1"), null };
+ yield return new object[] { null, new CodePrimitiveExpression("Value2") };
+ yield return new object[] { new CodePrimitiveExpression("Value1"), new CodePrimitiveExpression("Value2") };
+ }
- [Theory]
- [MemberData(nameof(Ctor_TestData))]
- public void Ctor_CodeExpression_CodeExpression(CodeExpression left, CodeExpression right)
- {
- var assign = new CodeAssignStatement(left, right);
- Assert.Equal(left, assign.Left);
- Assert.Equal(right, assign.Right);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_TestData))]
+ public void Ctor_CodeExpression_CodeExpression(CodeExpression left, CodeExpression right)
+ {
+ var assign = new CodeAssignStatement(left, right);
+ Assert.Equal(left, assign.Left);
+ Assert.Equal(right, assign.Right);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Left_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var assign = new CodeAssignStatement();
- assign.Left = value;
- Assert.Equal(value, assign.Left);
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Left_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var assign = new CodeAssignStatement();
+ assign.Left = value;
+ Assert.Equal(value, assign.Left);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Right_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var assign = new CodeAssignStatement();
- assign.Right = value;
- Assert.Equal(value, assign.Right);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Right_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var assign = new CodeAssignStatement();
+ assign.Right = value;
+ Assert.Equal(value, assign.Right);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeAttachEventStatementTests : CodeStatementTestBase<CodeAttachEventStatement>
- {
- [Fact]
- public void Ctor_Default()
- {
- var attachEvent = new CodeAttachEventStatement();
- Assert.Empty(attachEvent.Event.EventName);
- Assert.Null(attachEvent.Event.TargetObject);
- Assert.Null(attachEvent.Listener);
- }
+ public class CodeAttachEventStatementTests : CodeStatementTestBase<CodeAttachEventStatement>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var attachEvent = new CodeAttachEventStatement();
+ Assert.Empty(attachEvent.Event.EventName);
+ Assert.Null(attachEvent.Event.TargetObject);
+ Assert.Null(attachEvent.Listener);
+ }
- public static IEnumerable<object[]> Ctor_CodeExpression_String_CodeExpression_TestData()
- {
- yield return new object[] { null, null, null };
- yield return new object[] { new CodePrimitiveExpression("Value1"), "EventName", new CodePrimitiveExpression("Value2") };
- }
+ public static IEnumerable<object[]> Ctor_CodeExpression_String_CodeExpression_TestData()
+ {
+ yield return new object[] { null, null, null };
+ yield return new object[] { new CodePrimitiveExpression("Value1"), "EventName", new CodePrimitiveExpression("Value2") };
+ }
- [Theory]
- [MemberData(nameof(Ctor_CodeExpression_String_CodeExpression_TestData))]
- public void Ctor_CodeExpression_String_CodeExpression(CodeExpression targetObject, string eventName, CodeExpression listener)
- {
- var attachEvent = new CodeAttachEventStatement(targetObject, eventName, listener);
- Assert.Equal(targetObject, attachEvent.Event.TargetObject);
- Assert.Equal(eventName ?? string.Empty, attachEvent.Event.EventName);
- Assert.Equal(listener, attachEvent.Listener);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_CodeExpression_String_CodeExpression_TestData))]
+ public void Ctor_CodeExpression_String_CodeExpression(CodeExpression targetObject, string eventName, CodeExpression listener)
+ {
+ var attachEvent = new CodeAttachEventStatement(targetObject, eventName, listener);
+ Assert.Equal(targetObject, attachEvent.Event.TargetObject);
+ Assert.Equal(eventName ?? string.Empty, attachEvent.Event.EventName);
+ Assert.Equal(listener, attachEvent.Listener);
+ }
- public static IEnumerable<object[]> CodeEventReferenceExpression_CodeExpression_TestData()
- {
- yield return new object[] { null, null };
- yield return new object[] { new CodeEventReferenceExpression(null, null), null };
- yield return new object[] { new CodeEventReferenceExpression(new CodePrimitiveExpression("Value1"), "EventName"), new CodePrimitiveExpression("Value2") };
- }
+ public static IEnumerable<object[]> CodeEventReferenceExpression_CodeExpression_TestData()
+ {
+ yield return new object[] { null, null };
+ yield return new object[] { new CodeEventReferenceExpression(null, null), null };
+ yield return new object[] { new CodeEventReferenceExpression(new CodePrimitiveExpression("Value1"), "EventName"), new CodePrimitiveExpression("Value2") };
+ }
- [Theory]
- [MemberData(nameof(CodeEventReferenceExpression_CodeExpression_TestData))]
- public void Ctor_CodeEventReferenceExpression_CodeExpression(CodeEventReferenceExpression eventExpresion, CodeExpression listener)
- {
- var attachEvent = new CodeAttachEventStatement(eventExpresion, listener);
- Assert.Equal((eventExpresion ?? new CodeEventReferenceExpression()).TargetObject, attachEvent.Event.TargetObject);
- Assert.Equal((eventExpresion ?? new CodeEventReferenceExpression()).EventName, attachEvent.Event.EventName);
- Assert.Equal(listener, attachEvent.Listener);
- }
+ [Theory]
+ [MemberData(nameof(CodeEventReferenceExpression_CodeExpression_TestData))]
+ public void Ctor_CodeEventReferenceExpression_CodeExpression(CodeEventReferenceExpression eventExpresion, CodeExpression listener)
+ {
+ var attachEvent = new CodeAttachEventStatement(eventExpresion, listener);
+ Assert.Equal((eventExpresion ?? new CodeEventReferenceExpression()).TargetObject, attachEvent.Event.TargetObject);
+ Assert.Equal((eventExpresion ?? new CodeEventReferenceExpression()).EventName, attachEvent.Event.EventName);
+ Assert.Equal(listener, attachEvent.Listener);
+ }
- [Theory]
- [MemberData(nameof(CodeEventReferenceExpression_CodeExpression_TestData))]
- public void Event_Set_Get_ReturnsExpected(CodeEventReferenceExpression value, CodeExpression _)
- {
- var attachEvent = new CodeAttachEventStatement();
- attachEvent.Event = value;
- Assert.Equal((value ?? new CodeEventReferenceExpression()).TargetObject, attachEvent.Event.TargetObject);
- Assert.Equal((value ?? new CodeEventReferenceExpression()).EventName, attachEvent.Event.EventName);
- }
+ [Theory]
+ [MemberData(nameof(CodeEventReferenceExpression_CodeExpression_TestData))]
+ public void Event_Set_Get_ReturnsExpected(CodeEventReferenceExpression value, CodeExpression _)
+ {
+ var attachEvent = new CodeAttachEventStatement();
+ attachEvent.Event = value;
+ Assert.Equal((value ?? new CodeEventReferenceExpression()).TargetObject, attachEvent.Event.TargetObject);
+ Assert.Equal((value ?? new CodeEventReferenceExpression()).EventName, attachEvent.Event.EventName);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Listener_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var attachEvent = new CodeAttachEventStatement();
- attachEvent.Listener = value;
- Assert.Equal(value, attachEvent.Listener);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Listener_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var attachEvent = new CodeAttachEventStatement();
+ attachEvent.Listener = value;
+ Assert.Equal(value, attachEvent.Listener);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeAttributeArgumentTests : CodeDomTestBase
- {
- [Fact]
- public void Ctor_Default()
- {
- var argument = new CodeAttributeArgument();
- Assert.Empty(argument.Name);
- Assert.Null(argument.Value);
- }
+ public class CodeAttributeArgumentTests : CodeDomTestBase
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var argument = new CodeAttributeArgument();
+ Assert.Empty(argument.Name);
+ Assert.Null(argument.Value);
+ }
- public static IEnumerable<object[]> Ctor_TestData()
- {
- yield return new object[] { null, null };
- yield return new object[] { "", new CodePrimitiveExpression("Value1") };
- yield return new object[] { "Value1", new CodePrimitiveExpression("Value1") };
- }
+ public static IEnumerable<object[]> Ctor_TestData()
+ {
+ yield return new object[] { null, null };
+ yield return new object[] { "", new CodePrimitiveExpression("Value1") };
+ yield return new object[] { "Value1", new CodePrimitiveExpression("Value1") };
+ }
- [Theory]
- [MemberData(nameof(Ctor_TestData))]
- public void Ctor(string name, CodeExpression value)
- {
- if (string.IsNullOrEmpty(name))
- {
- var argument1 = new CodeAttributeArgument(value);
- Assert.Empty(argument1.Name);
- Assert.Equal(value, argument1.Value);
- }
- var argument2 = new CodeAttributeArgument(name, value);
- Assert.Equal(name ?? string.Empty, argument2.Name);
- Assert.Equal(value, argument2.Value);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_TestData))]
+ public void Ctor(string name, CodeExpression value)
+ {
+ if (string.IsNullOrEmpty(name))
+ {
+ var argument1 = new CodeAttributeArgument(value);
+ Assert.Empty(argument1.Name);
+ Assert.Equal(value, argument1.Value);
+ }
+ var argument2 = new CodeAttributeArgument(name, value);
+ Assert.Equal(name ?? string.Empty, argument2.Name);
+ Assert.Equal(value, argument2.Value);
+ }
- [Theory]
- [InlineData(null)]
- [InlineData("")]
- [InlineData("Name")]
- public void Name_Set_Get_ReturnsExpected(string value)
- {
- var argument = new CodeAttributeArgument();
- argument.Name = value;
- Assert.Equal(value ?? string.Empty, argument.Name);
- }
+ [Theory]
+ [InlineData(null)]
+ [InlineData("")]
+ [InlineData("Name")]
+ public void Name_Set_Get_ReturnsExpected(string value)
+ {
+ var argument = new CodeAttributeArgument();
+ argument.Name = value;
+ Assert.Equal(value ?? string.Empty, argument.Name);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Value_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var argument = new CodeAttributeArgument();
- argument.Value = value;
- Assert.Equal(value, argument.Value);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Value_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var argument = new CodeAttributeArgument();
+ argument.Value = value;
+ Assert.Equal(value, argument.Value);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeAttributeDeclarationTests : CodeDomTestBase
- {
- [Fact]
- public void Ctor_Default()
- {
- var declaration = new CodeAttributeDeclaration();
- Assert.Empty(declaration.Name);
- Assert.Empty(declaration.Arguments);
- Assert.Null(declaration.AttributeType);
- }
+ public class CodeAttributeDeclarationTests : CodeDomTestBase
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var declaration = new CodeAttributeDeclaration();
+ Assert.Empty(declaration.Name);
+ Assert.Empty(declaration.Arguments);
+ Assert.Null(declaration.AttributeType);
+ }
- public static IEnumerable<object[]> Ctor_String_TestData()
- {
- yield return new object[] { null, new CodePrimitiveExpression[0] };
- yield return new object[] { "", new CodePrimitiveExpression[0] };
- yield return new object[] { "Value1", new CodeAttributeArgument[0] };
- yield return new object[] { "Value1", new CodeAttributeArgument[] { new CodeAttributeArgument("Name", new CodePrimitiveExpression("Value")) } };
- yield return new object[] { "Value1", new CodeAttributeArgument[] { new CodeAttributeArgument() } };
- }
+ public static IEnumerable<object[]> Ctor_String_TestData()
+ {
+ yield return new object[] { null, new CodePrimitiveExpression[0] };
+ yield return new object[] { "", new CodePrimitiveExpression[0] };
+ yield return new object[] { "Value1", new CodeAttributeArgument[0] };
+ yield return new object[] { "Value1", new CodeAttributeArgument[] { new CodeAttributeArgument("Name", new CodePrimitiveExpression("Value")) } };
+ yield return new object[] { "Value1", new CodeAttributeArgument[] { new CodeAttributeArgument() } };
+ }
- [Theory]
- [MemberData(nameof(Ctor_String_TestData))]
- public void Ctor_String(string name, CodeAttributeArgument[] arguments)
- {
- if (arguments.Length == 0)
- {
- var declaration1 = new CodeAttributeDeclaration(name);
- Assert.Equal(name ?? string.Empty, declaration1.Name);
- Assert.Empty(declaration1.Arguments);
- Assert.Equal(new CodeTypeReference(name).BaseType, declaration1.AttributeType.BaseType);
- }
- var declaration2 = new CodeAttributeDeclaration(name, arguments);
- Assert.Equal(name ?? string.Empty, declaration2.Name);
- Assert.Equal(arguments, declaration2.Arguments.Cast<CodeAttributeArgument>());
- Assert.Equal(new CodeTypeReference(name).BaseType, declaration2.AttributeType.BaseType);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_String_TestData))]
+ public void Ctor_String(string name, CodeAttributeArgument[] arguments)
+ {
+ if (arguments.Length == 0)
+ {
+ var declaration1 = new CodeAttributeDeclaration(name);
+ Assert.Equal(name ?? string.Empty, declaration1.Name);
+ Assert.Empty(declaration1.Arguments);
+ Assert.Equal(new CodeTypeReference(name).BaseType, declaration1.AttributeType.BaseType);
+ }
+ var declaration2 = new CodeAttributeDeclaration(name, arguments);
+ Assert.Equal(name ?? string.Empty, declaration2.Name);
+ Assert.Equal(arguments, declaration2.Arguments.Cast<CodeAttributeArgument>());
+ Assert.Equal(new CodeTypeReference(name).BaseType, declaration2.AttributeType.BaseType);
+ }
- public static IEnumerable<object[]> Ctor_CodeTypeReference_TestData()
- {
- yield return new object[] { null, null };
- yield return new object[] { new CodeTypeReference(typeof(int)), new CodeAttributeArgument[0] };
- yield return new object[] { new CodeTypeReference("System.Void"), new CodeAttributeArgument[] { new CodeAttributeArgument("Name", new CodePrimitiveExpression("Value")) } };
- yield return new object[] { new CodeTypeReference("System.Void"), new CodeAttributeArgument[] { new CodeAttributeArgument() } };
- }
+ public static IEnumerable<object[]> Ctor_CodeTypeReference_TestData()
+ {
+ yield return new object[] { null, null };
+ yield return new object[] { new CodeTypeReference(typeof(int)), new CodeAttributeArgument[0] };
+ yield return new object[] { new CodeTypeReference("System.Void"), new CodeAttributeArgument[] { new CodeAttributeArgument("Name", new CodePrimitiveExpression("Value")) } };
+ yield return new object[] { new CodeTypeReference("System.Void"), new CodeAttributeArgument[] { new CodeAttributeArgument() } };
+ }
- [Theory]
- [MemberData(nameof(Ctor_CodeTypeReference_TestData))]
- public void Ctor_CodeTypeReference(CodeTypeReference attributeType, CodeAttributeArgument[] arguments)
- {
- if (arguments == null || arguments.Length == 0)
- {
- var declaration1 = new CodeAttributeDeclaration(attributeType);
- Assert.Equal(attributeType?.BaseType ?? string.Empty, declaration1.Name);
- Assert.Equal(attributeType, declaration1.AttributeType);
- Assert.Empty(declaration1.Arguments);
- }
- var declaration2 = new CodeAttributeDeclaration(attributeType, arguments);
- Assert.Equal(attributeType?.BaseType ?? string.Empty, declaration2.Name);
- Assert.Equal(attributeType, declaration2.AttributeType);
- Assert.Equal(arguments ?? new CodeAttributeArgument[0], declaration2.Arguments.Cast<CodeAttributeArgument>());
- }
+ [Theory]
+ [MemberData(nameof(Ctor_CodeTypeReference_TestData))]
+ public void Ctor_CodeTypeReference(CodeTypeReference attributeType, CodeAttributeArgument[] arguments)
+ {
+ if (arguments == null || arguments.Length == 0)
+ {
+ var declaration1 = new CodeAttributeDeclaration(attributeType);
+ Assert.Equal(attributeType?.BaseType ?? string.Empty, declaration1.Name);
+ Assert.Equal(attributeType, declaration1.AttributeType);
+ Assert.Empty(declaration1.Arguments);
+ }
+ var declaration2 = new CodeAttributeDeclaration(attributeType, arguments);
+ Assert.Equal(attributeType?.BaseType ?? string.Empty, declaration2.Name);
+ Assert.Equal(attributeType, declaration2.AttributeType);
+ Assert.Equal(arguments ?? new CodeAttributeArgument[0], declaration2.Arguments.Cast<CodeAttributeArgument>());
+ }
- [Fact]
- public void Ctor_NullArguments_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeAttributeDeclaration("name", null));
- }
+ [Fact]
+ public void Ctor_NullArguments_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeAttributeDeclaration("name", null));
+ }
- [Fact]
- public void Ctor_NullObjectInArguments_ThrowsArgumentNullException()
- {
- CodeAttributeArgument[] arguments = new CodeAttributeArgument[] { null };
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeAttributeDeclaration("name", arguments));
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeAttributeDeclaration(new CodeTypeReference(), arguments));
- }
+ [Fact]
+ public void Ctor_NullObjectInArguments_ThrowsArgumentNullException()
+ {
+ CodeAttributeArgument[] arguments = new CodeAttributeArgument[] { null };
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeAttributeDeclaration("name", arguments));
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeAttributeDeclaration(new CodeTypeReference(), arguments));
+ }
- [Theory]
- [InlineData(null)]
- [InlineData("")]
- [InlineData("Name")]
- public void Name_Set_Get_ReturnsExpected(string value)
- {
- var declaration = new CodeAttributeDeclaration();
- declaration.Name = value;
- Assert.Equal(value ?? string.Empty, declaration.Name);
- }
+ [Theory]
+ [InlineData(null)]
+ [InlineData("")]
+ [InlineData("Name")]
+ public void Name_Set_Get_ReturnsExpected(string value)
+ {
+ var declaration = new CodeAttributeDeclaration();
+ declaration.Name = value;
+ Assert.Equal(value ?? string.Empty, declaration.Name);
+ }
- [Fact]
- public void Arguments_AddMultiple_ReturnsExpected()
- {
- var declaration = new CodeAttributeDeclaration();
+ [Fact]
+ public void Arguments_AddMultiple_ReturnsExpected()
+ {
+ var declaration = new CodeAttributeDeclaration();
- CodeAttributeArgument argument1 = new CodeAttributeArgument(new CodePrimitiveExpression("Value1"));
- declaration.Arguments.Add(argument1);
- Assert.Equal(new CodeAttributeArgument[] { argument1 }, declaration.Arguments.Cast<CodeAttributeArgument>());
+ CodeAttributeArgument argument1 = new CodeAttributeArgument(new CodePrimitiveExpression("Value1"));
+ declaration.Arguments.Add(argument1);
+ Assert.Equal(new CodeAttributeArgument[] { argument1 }, declaration.Arguments.Cast<CodeAttributeArgument>());
- CodeAttributeArgument argument2 = new CodeAttributeArgument(new CodePrimitiveExpression("Value2"));
- declaration.Arguments.Add(argument2);
- Assert.Equal(new CodeAttributeArgument[] { argument1, argument2 }, declaration.Arguments.Cast<CodeAttributeArgument>());
- }
- }
+ CodeAttributeArgument argument2 = new CodeAttributeArgument(new CodePrimitiveExpression("Value2"));
+ declaration.Arguments.Add(argument2);
+ Assert.Equal(new CodeAttributeArgument[] { argument1, argument2 }, declaration.Arguments.Cast<CodeAttributeArgument>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeBinaryOperatorExpressionTests : CodeObjectTestBase<CodeBinaryOperatorExpression>
- {
- [Fact]
- public void Ctor_HasNullLeftRightAndOperator()
- {
- var binaryOperator = new CodeBinaryOperatorExpression();
- Assert.Null(binaryOperator.Left);
- Assert.Null(binaryOperator.Right);
- Assert.Equal(CodeBinaryOperatorType.Add, binaryOperator.Operator);
- }
+ public class CodeBinaryOperatorExpressionTests : CodeObjectTestBase<CodeBinaryOperatorExpression>
+ {
+ [Fact]
+ public void Ctor_HasNullLeftRightAndOperator()
+ {
+ var binaryOperator = new CodeBinaryOperatorExpression();
+ Assert.Null(binaryOperator.Left);
+ Assert.Null(binaryOperator.Right);
+ Assert.Equal(CodeBinaryOperatorType.Add, binaryOperator.Operator);
+ }
- public static IEnumerable<object[]> Ctor_TestData()
- {
- yield return new object[] { null, (CodeBinaryOperatorType)(-1), null };
- yield return new object[] { new CodePrimitiveExpression("Value1"), CodeBinaryOperatorType.Add, null };
- yield return new object[] { null, CodeBinaryOperatorType.Add | CodeBinaryOperatorType.BitwiseAnd, new CodePrimitiveExpression("Value2") };
- yield return new object[] { new CodePrimitiveExpression("Value1"), (CodeBinaryOperatorType)int.MaxValue, new CodePrimitiveExpression("Value2") };
- }
+ public static IEnumerable<object[]> Ctor_TestData()
+ {
+ yield return new object[] { null, (CodeBinaryOperatorType)(-1), null };
+ yield return new object[] { new CodePrimitiveExpression("Value1"), CodeBinaryOperatorType.Add, null };
+ yield return new object[] { null, CodeBinaryOperatorType.Add | CodeBinaryOperatorType.BitwiseAnd, new CodePrimitiveExpression("Value2") };
+ yield return new object[] { new CodePrimitiveExpression("Value1"), (CodeBinaryOperatorType)int.MaxValue, new CodePrimitiveExpression("Value2") };
+ }
- [Theory]
- [MemberData(nameof(Ctor_TestData))]
- public void Ctor_CodeExpression_CodeBinaryOperatorType_CodeExpression(CodeExpression left, CodeBinaryOperatorType operatorType, CodeExpression right)
- {
- var binaryOperator = new CodeBinaryOperatorExpression(left, operatorType, right);
- Assert.Equal(left, binaryOperator.Left);
- Assert.Equal(operatorType, binaryOperator.Operator);
- Assert.Equal(right, binaryOperator.Right);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_TestData))]
+ public void Ctor_CodeExpression_CodeBinaryOperatorType_CodeExpression(CodeExpression left, CodeBinaryOperatorType operatorType, CodeExpression right)
+ {
+ var binaryOperator = new CodeBinaryOperatorExpression(left, operatorType, right);
+ Assert.Equal(left, binaryOperator.Left);
+ Assert.Equal(operatorType, binaryOperator.Operator);
+ Assert.Equal(right, binaryOperator.Right);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Left_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var binaryOperator = new CodeBinaryOperatorExpression();
- binaryOperator.Left = value;
- Assert.Equal(value, binaryOperator.Left);
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Left_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var binaryOperator = new CodeBinaryOperatorExpression();
+ binaryOperator.Left = value;
+ Assert.Equal(value, binaryOperator.Left);
+ }
- [Theory]
- [InlineData((CodeBinaryOperatorType)(-1))]
- [InlineData(CodeBinaryOperatorType.Add)]
- [InlineData(CodeBinaryOperatorType.Add | CodeBinaryOperatorType.BitwiseAnd)]
- [InlineData((CodeBinaryOperatorType)int.MaxValue)]
- public void Operator_Set_Get_ReturnsExpected(CodeBinaryOperatorType value)
- {
- var binaryOperator = new CodeBinaryOperatorExpression();
- binaryOperator.Operator = value;
- Assert.Equal(value, binaryOperator.Operator);
- }
+ [Theory]
+ [InlineData((CodeBinaryOperatorType)(-1))]
+ [InlineData(CodeBinaryOperatorType.Add)]
+ [InlineData(CodeBinaryOperatorType.Add | CodeBinaryOperatorType.BitwiseAnd)]
+ [InlineData((CodeBinaryOperatorType)int.MaxValue)]
+ public void Operator_Set_Get_ReturnsExpected(CodeBinaryOperatorType value)
+ {
+ var binaryOperator = new CodeBinaryOperatorExpression();
+ binaryOperator.Operator = value;
+ Assert.Equal(value, binaryOperator.Operator);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Right_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var binaryOperator = new CodeBinaryOperatorExpression();
- binaryOperator.Right = value;
- Assert.Equal(value, binaryOperator.Right);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Right_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var binaryOperator = new CodeBinaryOperatorExpression();
+ binaryOperator.Right = value;
+ Assert.Equal(value, binaryOperator.Right);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeCastExpressionTests : CodeObjectTestBase<CodeCastExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var cast = new CodeCastExpression();
- Assert.Equal(typeof(void).FullName, cast.TargetType.BaseType);
- Assert.Null(cast.Expression);
- }
+ public class CodeCastExpressionTests : CodeObjectTestBase<CodeCastExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var cast = new CodeCastExpression();
+ Assert.Equal(typeof(void).FullName, cast.TargetType.BaseType);
+ Assert.Null(cast.Expression);
+ }
- public static IEnumerable<object[]> Ctor_CodeTypeReference_TestData()
- {
- yield return new object[] { null, null };
- yield return new object[] { new CodeTypeReference(), new CodePrimitiveExpression() };
- yield return new object[] { new CodeTypeReference(typeof(void)), new CodePrimitiveExpression("Value") };
- }
+ public static IEnumerable<object[]> Ctor_CodeTypeReference_TestData()
+ {
+ yield return new object[] { null, null };
+ yield return new object[] { new CodeTypeReference(), new CodePrimitiveExpression() };
+ yield return new object[] { new CodeTypeReference(typeof(void)), new CodePrimitiveExpression("Value") };
+ }
- [Theory]
- [MemberData(nameof(Ctor_CodeTypeReference_TestData))]
- public void Ctor_CodeTypeReference_CodeExpression(CodeTypeReference type, CodeExpression expression)
- {
- CodeExpression[] initializers = new CodeExpression[0];
- var cast = new CodeCastExpression(type, expression);
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, cast.TargetType.BaseType);
- Assert.Equal(expression, cast.Expression);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_CodeTypeReference_TestData))]
+ public void Ctor_CodeTypeReference_CodeExpression(CodeTypeReference type, CodeExpression expression)
+ {
+ CodeExpression[] initializers = new CodeExpression[0];
+ var cast = new CodeCastExpression(type, expression);
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, cast.TargetType.BaseType);
+ Assert.Equal(expression, cast.Expression);
+ }
- public static IEnumerable<object[]> Ctor_TypeString_TestData()
- {
- yield return new object[] { null, null, "System.Void" };
- yield return new object[] { "", new CodePrimitiveExpression(), "System.Void" };
- yield return new object[] { "Int32", new CodePrimitiveExpression("Value"), "Int32" };
- }
+ public static IEnumerable<object[]> Ctor_TypeString_TestData()
+ {
+ yield return new object[] { null, null, "System.Void" };
+ yield return new object[] { "", new CodePrimitiveExpression(), "System.Void" };
+ yield return new object[] { "Int32", new CodePrimitiveExpression("Value"), "Int32" };
+ }
- [Theory]
- [MemberData(nameof(Ctor_TypeString_TestData))]
- public void Ctor_String_CodeExpression(string type, CodeExpression expression, string expectedBaseType)
- {
- var cast = new CodeCastExpression(type, expression);
- Assert.Equal(expectedBaseType, cast.TargetType.BaseType);
- Assert.Equal(expression, cast.Expression);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_TypeString_TestData))]
+ public void Ctor_String_CodeExpression(string type, CodeExpression expression, string expectedBaseType)
+ {
+ var cast = new CodeCastExpression(type, expression);
+ Assert.Equal(expectedBaseType, cast.TargetType.BaseType);
+ Assert.Equal(expression, cast.Expression);
+ }
- public static IEnumerable<object[]> Ctor_Type_TestData()
- {
- yield return new object[] { typeof(int), null, "System.Int32" };
- yield return new object[] { typeof(List<>), new CodePrimitiveExpression(), "System.Collections.Generic.List`1" };
- yield return new object[] { typeof(void), new CodePrimitiveExpression("Value"), "System.Void" };
- }
+ public static IEnumerable<object[]> Ctor_Type_TestData()
+ {
+ yield return new object[] { typeof(int), null, "System.Int32" };
+ yield return new object[] { typeof(List<>), new CodePrimitiveExpression(), "System.Collections.Generic.List`1" };
+ yield return new object[] { typeof(void), new CodePrimitiveExpression("Value"), "System.Void" };
+ }
- [Theory]
- [MemberData(nameof(Ctor_Type_TestData))]
- public void Ctor_Type_CodeExpression(Type type, CodeExpression expression, string expectedBaseType)
- {
- var cast = new CodeCastExpression(type, expression);
- Assert.Equal(expectedBaseType, cast.TargetType.BaseType);
- Assert.Equal(expression, cast.Expression);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_Type_TestData))]
+ public void Ctor_Type_CodeExpression(Type type, CodeExpression expression, string expectedBaseType)
+ {
+ var cast = new CodeCastExpression(type, expression);
+ Assert.Equal(expectedBaseType, cast.TargetType.BaseType);
+ Assert.Equal(expression, cast.Expression);
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void TargetType_Set_Get_ReturnsExpected(CodeTypeReference value)
- {
- var cast = new CodeCastExpression();
- cast.TargetType = value;
- Assert.Equal((value ?? new CodeTypeReference("")).BaseType, cast.TargetType.BaseType);
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void TargetType_Set_Get_ReturnsExpected(CodeTypeReference value)
+ {
+ var cast = new CodeCastExpression();
+ cast.TargetType = value;
+ Assert.Equal((value ?? new CodeTypeReference("")).BaseType, cast.TargetType.BaseType);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Expression_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var cast = new CodeCastExpression();
- cast.Expression = value;
- Assert.Equal(value, cast.Expression);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Expression_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var cast = new CodeCastExpression();
+ cast.Expression = value;
+ Assert.Equal(value, cast.Expression);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeCatchClauseTests : CodeDomTestBase
- {
- [Fact]
- public void Ctor_Default()
- {
- var catchClause = new CodeCatchClause();
- Assert.Empty(catchClause.LocalName);
- Assert.Empty(catchClause.Statements);
+ public class CodeCatchClauseTests : CodeDomTestBase
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var catchClause = new CodeCatchClause();
+ Assert.Empty(catchClause.LocalName);
+ Assert.Empty(catchClause.Statements);
- Assert.Equal(new CodeTypeReference(typeof(Exception)).BaseType, catchClause.CatchExceptionType.BaseType);
- }
+ Assert.Equal(new CodeTypeReference(typeof(Exception)).BaseType, catchClause.CatchExceptionType.BaseType);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Ctor_String(string localName)
- {
- var catchClause = new CodeCatchClause(localName);
- Assert.Equal(localName ?? string.Empty, catchClause.LocalName);
- Assert.Equal(typeof(Exception).ToString(), catchClause.CatchExceptionType.BaseType);
- Assert.Empty(catchClause.Statements);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Ctor_String(string localName)
+ {
+ var catchClause = new CodeCatchClause(localName);
+ Assert.Equal(localName ?? string.Empty, catchClause.LocalName);
+ Assert.Equal(typeof(Exception).ToString(), catchClause.CatchExceptionType.BaseType);
+ Assert.Empty(catchClause.Statements);
+ }
- public static IEnumerable<object[]> Ctor_String_CodeTypeReference_TestData()
- {
- yield return new object[] { null, null };
- yield return new object[] { "", new CodeTypeReference() };
- yield return new object[] { "Value1", new CodeTypeReference(typeof(ArgumentException)) };
- }
+ public static IEnumerable<object[]> Ctor_String_CodeTypeReference_TestData()
+ {
+ yield return new object[] { null, null };
+ yield return new object[] { "", new CodeTypeReference() };
+ yield return new object[] { "Value1", new CodeTypeReference(typeof(ArgumentException)) };
+ }
- [Theory]
- [MemberData(nameof(Ctor_String_CodeTypeReference_TestData))]
- public void Ctor_String_CodeTypeReference(string localName, CodeTypeReference catchExceptionType)
- {
- var catchClause = new CodeCatchClause(localName, catchExceptionType);
- Assert.Equal(localName ?? string.Empty, catchClause.LocalName);
- Assert.Equal((catchExceptionType ?? new CodeTypeReference(typeof(Exception))).BaseType, catchClause.CatchExceptionType.BaseType);
- Assert.Empty(catchClause.Statements);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_String_CodeTypeReference_TestData))]
+ public void Ctor_String_CodeTypeReference(string localName, CodeTypeReference catchExceptionType)
+ {
+ var catchClause = new CodeCatchClause(localName, catchExceptionType);
+ Assert.Equal(localName ?? string.Empty, catchClause.LocalName);
+ Assert.Equal((catchExceptionType ?? new CodeTypeReference(typeof(Exception))).BaseType, catchClause.CatchExceptionType.BaseType);
+ Assert.Empty(catchClause.Statements);
+ }
- public static IEnumerable<object[]> Ctor_String_CodeTypeReference_ParamsCodeStatement_TestData()
- {
- yield return new object[] { null, null, new CodeStatement[0] };
- yield return new object[] { "", new CodeTypeReference(), new CodeStatement[] { new CodeCommentStatement("") } };
- yield return new object[] { "Value1", new CodeTypeReference(typeof(ArgumentException)), new CodeStatement[] { new CodeCommentStatement("") } };
- }
+ public static IEnumerable<object[]> Ctor_String_CodeTypeReference_ParamsCodeStatement_TestData()
+ {
+ yield return new object[] { null, null, new CodeStatement[0] };
+ yield return new object[] { "", new CodeTypeReference(), new CodeStatement[] { new CodeCommentStatement("") } };
+ yield return new object[] { "Value1", new CodeTypeReference(typeof(ArgumentException)), new CodeStatement[] { new CodeCommentStatement("") } };
+ }
- [Theory]
- [MemberData(nameof(Ctor_String_CodeTypeReference_ParamsCodeStatement_TestData))]
- public void Ctor_String_CodeTypeReference_ParamsCodeStatement(string localName, CodeTypeReference catchExceptionType, CodeStatement[] statements)
- {
- var catchClause = new CodeCatchClause(localName, catchExceptionType, statements);
- Assert.Equal(localName ?? string.Empty, catchClause.LocalName);
- Assert.Equal((catchExceptionType ?? new CodeTypeReference(typeof(Exception))).BaseType, catchClause.CatchExceptionType.BaseType);
- Assert.Equal(statements, catchClause.Statements.Cast<CodeStatement>());
- }
+ [Theory]
+ [MemberData(nameof(Ctor_String_CodeTypeReference_ParamsCodeStatement_TestData))]
+ public void Ctor_String_CodeTypeReference_ParamsCodeStatement(string localName, CodeTypeReference catchExceptionType, CodeStatement[] statements)
+ {
+ var catchClause = new CodeCatchClause(localName, catchExceptionType, statements);
+ Assert.Equal(localName ?? string.Empty, catchClause.LocalName);
+ Assert.Equal((catchExceptionType ?? new CodeTypeReference(typeof(Exception))).BaseType, catchClause.CatchExceptionType.BaseType);
+ Assert.Equal(statements, catchClause.Statements.Cast<CodeStatement>());
+ }
- [Fact]
- public void Ctor_NullStatements_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeCatchClause("name", new CodeTypeReference(typeof(void)), null));
- }
+ [Fact]
+ public void Ctor_NullStatements_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeCatchClause("name", new CodeTypeReference(typeof(void)), null));
+ }
- [Fact]
- public void Ctor_NullObjectInStatements_ThrowsArgumentNullException()
- {
- CodeStatement[] statements = new CodeStatement[] { null };
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeCatchClause("name", new CodeTypeReference(typeof(void)), statements));
- }
+ [Fact]
+ public void Ctor_NullObjectInStatements_ThrowsArgumentNullException()
+ {
+ CodeStatement[] statements = new CodeStatement[] { null };
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeCatchClause("name", new CodeTypeReference(typeof(void)), statements));
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void LocalName_Set_Get_ReturnsExpected(string value)
- {
- var catchClause = new CodeCatchClause();
- catchClause.LocalName = value;
- Assert.Equal(value ?? string.Empty, catchClause.LocalName);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void LocalName_Set_Get_ReturnsExpected(string value)
+ {
+ var catchClause = new CodeCatchClause();
+ catchClause.LocalName = value;
+ Assert.Equal(value ?? string.Empty, catchClause.LocalName);
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void CatchExceptionType_Set_Get_ReturnsExpected(CodeTypeReference value)
- {
- var catchClause = new CodeCatchClause();
- catchClause.CatchExceptionType = value;
- Assert.Equal((value ?? new CodeTypeReference(typeof(Exception))).BaseType, catchClause.CatchExceptionType.BaseType);
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void CatchExceptionType_Set_Get_ReturnsExpected(CodeTypeReference value)
+ {
+ var catchClause = new CodeCatchClause();
+ catchClause.CatchExceptionType = value;
+ Assert.Equal((value ?? new CodeTypeReference(typeof(Exception))).BaseType, catchClause.CatchExceptionType.BaseType);
+ }
- [Fact]
- public void Statements_AddMultiple_ReturnsExpected()
- {
- var catchClause = new CodeCatchClause();
+ [Fact]
+ public void Statements_AddMultiple_ReturnsExpected()
+ {
+ var catchClause = new CodeCatchClause();
- CodeStatement statement1 = new CodeCommentStatement("Value1");
- catchClause.Statements.Add(statement1);
- Assert.Equal(new CodeStatement[] { statement1 }, catchClause.Statements.Cast<CodeStatement>());
+ CodeStatement statement1 = new CodeCommentStatement("Value1");
+ catchClause.Statements.Add(statement1);
+ Assert.Equal(new CodeStatement[] { statement1 }, catchClause.Statements.Cast<CodeStatement>());
- CodeStatement statement2 = new CodeCommentStatement("Value1");
- catchClause.Statements.Add(statement2);
- Assert.Equal(new CodeStatement[] { statement1, statement2 }, catchClause.Statements.Cast<CodeStatement>());
- }
- }
+ CodeStatement statement2 = new CodeCommentStatement("Value1");
+ catchClause.Statements.Add(statement2);
+ Assert.Equal(new CodeStatement[] { statement1, statement2 }, catchClause.Statements.Cast<CodeStatement>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeChecksumPragmaTests : CodeObjectTestBase<CodeChecksumPragma>
- {
- [Fact]
- public void Ctor_Default()
- {
- var pragma = new CodeChecksumPragma();
- Assert.Empty(pragma.FileName);
- Assert.Equal(Guid.Empty, pragma.ChecksumAlgorithmId);
- Assert.Null(pragma.ChecksumData);
- }
+ public class CodeChecksumPragmaTests : CodeObjectTestBase<CodeChecksumPragma>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var pragma = new CodeChecksumPragma();
+ Assert.Empty(pragma.FileName);
+ Assert.Equal(Guid.Empty, pragma.ChecksumAlgorithmId);
+ Assert.Null(pragma.ChecksumData);
+ }
- public static IEnumerable<object[]> Ctor_TestData()
- {
- yield return new object[] { null, new Guid(), null };
- yield return new object[] { "", Guid.NewGuid(), new byte[0] };
- yield return new object[] { "Value1", Guid.NewGuid(), new byte[] { 0, 1, 2, 3 } };
- }
+ public static IEnumerable<object[]> Ctor_TestData()
+ {
+ yield return new object[] { null, new Guid(), null };
+ yield return new object[] { "", Guid.NewGuid(), new byte[0] };
+ yield return new object[] { "Value1", Guid.NewGuid(), new byte[] { 0, 1, 2, 3 } };
+ }
- [Theory]
- [MemberData(nameof(Ctor_TestData))]
- public void Ctor(string fileName, Guid algorithmId, byte[] checksumData)
- {
- var pragma = new CodeChecksumPragma(fileName, algorithmId, checksumData);
- Assert.Equal(fileName ?? string.Empty, pragma.FileName);
- Assert.Equal(algorithmId, pragma.ChecksumAlgorithmId);
- Assert.Equal(checksumData, pragma.ChecksumData);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_TestData))]
+ public void Ctor(string fileName, Guid algorithmId, byte[] checksumData)
+ {
+ var pragma = new CodeChecksumPragma(fileName, algorithmId, checksumData);
+ Assert.Equal(fileName ?? string.Empty, pragma.FileName);
+ Assert.Equal(algorithmId, pragma.ChecksumAlgorithmId);
+ Assert.Equal(checksumData, pragma.ChecksumData);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void FileName_Set_Get_ReturnsExpected(string value)
- {
- var pragma = new CodeChecksumPragma();
- pragma.FileName = value;
- Assert.Equal(value ?? string.Empty, pragma.FileName);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void FileName_Set_Get_ReturnsExpected(string value)
+ {
+ var pragma = new CodeChecksumPragma();
+ pragma.FileName = value;
+ Assert.Equal(value ?? string.Empty, pragma.FileName);
+ }
- public static IEnumerable<object[]> Guid_TestData()
- {
- yield return new object[] { new Guid() };
- yield return new object[] { Guid.NewGuid() };
- }
+ public static IEnumerable<object[]> Guid_TestData()
+ {
+ yield return new object[] { new Guid() };
+ yield return new object[] { Guid.NewGuid() };
+ }
- [Theory]
- [MemberData(nameof(Guid_TestData))]
- public void AlgorithmId_Set_Get_ReturnsExpected(Guid value)
- {
- var pragma = new CodeChecksumPragma();
- pragma.ChecksumAlgorithmId = value;
- Assert.Equal(value, pragma.ChecksumAlgorithmId);
- }
+ [Theory]
+ [MemberData(nameof(Guid_TestData))]
+ public void AlgorithmId_Set_Get_ReturnsExpected(Guid value)
+ {
+ var pragma = new CodeChecksumPragma();
+ pragma.ChecksumAlgorithmId = value;
+ Assert.Equal(value, pragma.ChecksumAlgorithmId);
+ }
- [Theory]
- [InlineData(null)]
- [InlineData(new byte[0])]
- [InlineData(new byte[] { 0, 1, 2, 3 })]
- public void ChecksumData_Set_Get_ReturnsExpected(byte[] value)
- {
- var pragma = new CodeChecksumPragma();
- pragma.ChecksumData = value;
- Assert.Equal(value, pragma.ChecksumData);
- }
- }
+ [Theory]
+ [InlineData(null)]
+ [InlineData(new byte[0])]
+ [InlineData(new byte[] { 0, 1, 2, 3 })]
+ public void ChecksumData_Set_Get_ReturnsExpected(byte[] value)
+ {
+ var pragma = new CodeChecksumPragma();
+ pragma.ChecksumData = value;
+ Assert.Equal(value, pragma.ChecksumData);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeCommentStatementTests : CodeStatementTestBase<CodeCommentStatement>
- {
- [Fact]
- public void Ctor_Default()
- {
- var comment = new CodeCommentStatement();
- Assert.Null(comment.Comment);
- }
+ public class CodeCommentStatementTests : CodeStatementTestBase<CodeCommentStatement>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var comment = new CodeCommentStatement();
+ Assert.Null(comment.Comment);
+ }
- public static IEnumerable<object[]> Comment_TestData()
- {
- yield return new object[] { null, false };
- yield return new object[] { "", true };
- yield return new object[] { "Text", false };
- yield return new object[] { "text", true };
- }
+ public static IEnumerable<object[]> Comment_TestData()
+ {
+ yield return new object[] { null, false };
+ yield return new object[] { "", true };
+ yield return new object[] { "Text", false };
+ yield return new object[] { "text", true };
+ }
- [Theory]
- [MemberData(nameof(Comment_TestData))]
- public void Ctor_String(string text, bool docComment)
- {
- CodeCommentStatement comment = new CodeCommentStatement(text);
- Assert.Equal(text ?? string.Empty, comment.Comment.Text);
- Assert.False(comment.Comment.DocComment);
- }
+ [Theory]
+ [MemberData(nameof(Comment_TestData))]
+ public void Ctor_String(string text, bool docComment)
+ {
+ CodeCommentStatement comment = new CodeCommentStatement(text);
+ Assert.Equal(text ?? string.Empty, comment.Comment.Text);
+ Assert.False(comment.Comment.DocComment);
+ }
- [Theory]
- [MemberData(nameof(Comment_TestData))]
- public void Ctor_String_Bool(string text, bool docComment)
- {
- CodeCommentStatement comment = new CodeCommentStatement(text, docComment);
- Assert.Equal(text ?? string.Empty, comment.Comment.Text);
- Assert.Equal(docComment, comment.Comment.DocComment);
- }
+ [Theory]
+ [MemberData(nameof(Comment_TestData))]
+ public void Ctor_String_Bool(string text, bool docComment)
+ {
+ CodeCommentStatement comment = new CodeCommentStatement(text, docComment);
+ Assert.Equal(text ?? string.Empty, comment.Comment.Text);
+ Assert.Equal(docComment, comment.Comment.DocComment);
+ }
- [Theory]
- [MemberData(nameof(Comment_TestData))]
- public void Ctor_CodeComment(string text, bool docComment)
- {
- CodeComment codeComment = new CodeComment(text, docComment);
- CodeCommentStatement comment = new CodeCommentStatement(codeComment);
- Assert.Same(codeComment, comment.Comment);
- }
+ [Theory]
+ [MemberData(nameof(Comment_TestData))]
+ public void Ctor_CodeComment(string text, bool docComment)
+ {
+ CodeComment codeComment = new CodeComment(text, docComment);
+ CodeCommentStatement comment = new CodeCommentStatement(codeComment);
+ Assert.Same(codeComment, comment.Comment);
+ }
- [Fact]
- public void Ctor_CodeComment_Null()
- {
- CodeCommentStatement comment = new CodeCommentStatement((CodeComment)null);
- Assert.Null(comment.Comment);
- }
+ [Fact]
+ public void Ctor_CodeComment_Null()
+ {
+ CodeCommentStatement comment = new CodeCommentStatement((CodeComment)null);
+ Assert.Null(comment.Comment);
+ }
- [Theory]
- [MemberData(nameof(Comment_TestData))]
- public void Comment_Set_Get_ReturnsExpected(string text, bool docComment)
- {
- CodeComment codeComment = new CodeComment(text, docComment);
- CodeCommentStatement comment = new CodeCommentStatement();
- comment.Comment = codeComment;
- Assert.Same(codeComment, comment.Comment);
- }
+ [Theory]
+ [MemberData(nameof(Comment_TestData))]
+ public void Comment_Set_Get_ReturnsExpected(string text, bool docComment)
+ {
+ CodeComment codeComment = new CodeComment(text, docComment);
+ CodeCommentStatement comment = new CodeCommentStatement();
+ comment.Comment = codeComment;
+ Assert.Same(codeComment, comment.Comment);
+ }
- [Fact]
- public void Ctor_SetNull_Get_ReturnsNull()
- {
- CodeCommentStatement comment = new CodeCommentStatement();
- comment.Comment = null;
- Assert.Null(comment.Comment);
- }
- }
+ [Fact]
+ public void Ctor_SetNull_Get_ReturnsNull()
+ {
+ CodeCommentStatement comment = new CodeCommentStatement();
+ comment.Comment = null;
+ Assert.Null(comment.Comment);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeCommentTests : CodeObjectTestBase<CodeComment>
- {
- [Fact]
- public void Ctor_Default()
- {
- var comment = new CodeComment();
- Assert.Empty(comment.Text);
- Assert.False(comment.DocComment);
- }
+ public class CodeCommentTests : CodeObjectTestBase<CodeComment>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var comment = new CodeComment();
+ Assert.Empty(comment.Text);
+ Assert.False(comment.DocComment);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Ctor_String(string text)
- {
- var comment = new CodeComment(text);
- Assert.Equal(text ?? string.Empty, comment.Text);
- Assert.False(comment.DocComment);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Ctor_String(string text)
+ {
+ var comment = new CodeComment(text);
+ Assert.Equal(text ?? string.Empty, comment.Text);
+ Assert.False(comment.DocComment);
+ }
- public static IEnumerable<object[]> Ctor_String_Bool_TestData()
- {
- yield return new object[] { null, true };
- yield return new object[] { "", false };
- yield return new object[] { "Value", true };
- }
+ public static IEnumerable<object[]> Ctor_String_Bool_TestData()
+ {
+ yield return new object[] { null, true };
+ yield return new object[] { "", false };
+ yield return new object[] { "Value", true };
+ }
- [Theory]
- [MemberData(nameof(Ctor_String_Bool_TestData))]
- public void Ctor_String_Bool(string text, bool docComment)
- {
- var comment = new CodeComment(text, docComment);
- Assert.Equal(text ?? string.Empty, comment.Text);
- Assert.Equal(docComment, comment.DocComment);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_String_Bool_TestData))]
+ public void Ctor_String_Bool(string text, bool docComment)
+ {
+ var comment = new CodeComment(text, docComment);
+ Assert.Equal(text ?? string.Empty, comment.Text);
+ Assert.Equal(docComment, comment.DocComment);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Text_Set_Get_ReturnsExpected(string value)
- {
- var comment = new CodeComment();
- comment.Text = value;
- Assert.Equal(value ?? string.Empty, comment.Text);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Text_Set_Get_ReturnsExpected(string value)
+ {
+ var comment = new CodeComment();
+ comment.Text = value;
+ Assert.Equal(value ?? string.Empty, comment.Text);
+ }
- [Theory]
- [InlineData(true)]
- [InlineData(false)]
- public void DocComment_Set_Get_ReturnsExpected(bool value)
- {
- var comment = new CodeComment();
- comment.DocComment = value;
- Assert.Equal(value, comment.DocComment);
- }
- }
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void DocComment_Set_Get_ReturnsExpected(bool value)
+ {
+ var comment = new CodeComment();
+ comment.DocComment = value;
+ Assert.Equal(value, comment.DocComment);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeCompileUnitTests : CodeObjectTestBase<CodeCompileUnit>
- {
- [Fact]
- public void Ctor_Default()
- {
- var compileUnit = new CodeCompileUnit();
- Assert.Empty(compileUnit.Namespaces);
- Assert.Empty(compileUnit.ReferencedAssemblies);
- Assert.Empty(compileUnit.AssemblyCustomAttributes);
- Assert.Empty(compileUnit.StartDirectives);
- Assert.Empty(compileUnit.EndDirectives);
- }
-
- [Fact]
- public void Namespaces_AddMultiple_ReturnsExpected()
- {
- var compileUnit = new CodeCompileUnit();
-
- CodeNamespace namespace1 = new CodeNamespace("Name1");
- compileUnit.Namespaces.Add(namespace1);
- Assert.Equal(new CodeNamespace[] { namespace1 }, compileUnit.Namespaces.Cast<CodeNamespace>());
-
- CodeNamespace namespace2 = new CodeNamespace("Name2");
- compileUnit.Namespaces.Add(namespace2);
- Assert.Equal(new CodeNamespace[] { namespace1, namespace2 }, compileUnit.Namespaces.Cast<CodeNamespace>());
- }
-
- [Fact]
- public void ReferencedAssemblies_AddMultiple_ReturnsExpected()
- {
- var compileUnit = new CodeCompileUnit();
-
- string assembly1 = "Name1";
- compileUnit.ReferencedAssemblies.Add(assembly1);
- Assert.Equal(new string[] { assembly1 }, compileUnit.ReferencedAssemblies.Cast<string>());
-
- string assembly2 = "Name2";
- compileUnit.ReferencedAssemblies.Add(assembly2);
- Assert.Equal(new string[] { assembly1, assembly2 }, compileUnit.ReferencedAssemblies.Cast<string>());
- }
-
- [Fact]
- public void CustomAttributes_AddMultiple_ReturnsExpected()
- {
- var compileUnit = new CodeCompileUnit();
-
- CodeAttributeDeclaration attribute1 = new CodeAttributeDeclaration("Name1");
- compileUnit.AssemblyCustomAttributes.Add(attribute1);
- Assert.Equal(new CodeAttributeDeclaration[] { attribute1 }, compileUnit.AssemblyCustomAttributes.Cast<CodeAttributeDeclaration>());
-
- CodeAttributeDeclaration attribute2 = new CodeAttributeDeclaration("Name2");
- compileUnit.AssemblyCustomAttributes.Add(attribute2);
- Assert.Equal(new CodeAttributeDeclaration[] { attribute1, attribute2 }, compileUnit.AssemblyCustomAttributes.Cast<CodeAttributeDeclaration>());
- }
-
- [Fact]
- public void StartDirectives_AddMultiple_ReturnsExpected()
- {
- var compileUnit = new CodeCompileUnit();
-
- CodeRegionDirective directive1 = new CodeRegionDirective(CodeRegionMode.None, "Region1");
- compileUnit.StartDirectives.Add(directive1);
- Assert.Equal(new CodeRegionDirective[] { directive1 }, compileUnit.StartDirectives.Cast<CodeDirective>());
-
- CodeRegionDirective directive2 = new CodeRegionDirective(CodeRegionMode.None, "Region2");
- compileUnit.StartDirectives.Add(directive2);
- Assert.Equal(new CodeRegionDirective[] { directive1, directive2 }, compileUnit.StartDirectives.Cast<CodeDirective>());
- }
-
- [Fact]
- public void EndDirectives_AddMultiple_ReturnsExpected()
- {
- var compileUnit = new CodeCompileUnit();
-
- CodeRegionDirective directive1 = new CodeRegionDirective(CodeRegionMode.None, "Region1");
- compileUnit.EndDirectives.Add(directive1);
- Assert.Equal(new CodeRegionDirective[] { directive1 }, compileUnit.EndDirectives.Cast<CodeDirective>());
-
- CodeRegionDirective directive2 = new CodeRegionDirective(CodeRegionMode.None, "Region2");
- compileUnit.EndDirectives.Add(directive2);
- Assert.Equal(new CodeRegionDirective[] { directive1, directive2 }, compileUnit.EndDirectives.Cast<CodeDirective>());
- }
- }
+ public class CodeCompileUnitTests : CodeObjectTestBase<CodeCompileUnit>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var compileUnit = new CodeCompileUnit();
+ Assert.Empty(compileUnit.Namespaces);
+ Assert.Empty(compileUnit.ReferencedAssemblies);
+ Assert.Empty(compileUnit.AssemblyCustomAttributes);
+ Assert.Empty(compileUnit.StartDirectives);
+ Assert.Empty(compileUnit.EndDirectives);
+ }
+
+ [Fact]
+ public void Namespaces_AddMultiple_ReturnsExpected()
+ {
+ var compileUnit = new CodeCompileUnit();
+
+ CodeNamespace namespace1 = new CodeNamespace("Name1");
+ compileUnit.Namespaces.Add(namespace1);
+ Assert.Equal(new CodeNamespace[] { namespace1 }, compileUnit.Namespaces.Cast<CodeNamespace>());
+
+ CodeNamespace namespace2 = new CodeNamespace("Name2");
+ compileUnit.Namespaces.Add(namespace2);
+ Assert.Equal(new CodeNamespace[] { namespace1, namespace2 }, compileUnit.Namespaces.Cast<CodeNamespace>());
+ }
+
+ [Fact]
+ public void ReferencedAssemblies_AddMultiple_ReturnsExpected()
+ {
+ var compileUnit = new CodeCompileUnit();
+
+ string assembly1 = "Name1";
+ compileUnit.ReferencedAssemblies.Add(assembly1);
+ Assert.Equal(new string[] { assembly1 }, compileUnit.ReferencedAssemblies.Cast<string>());
+
+ string assembly2 = "Name2";
+ compileUnit.ReferencedAssemblies.Add(assembly2);
+ Assert.Equal(new string[] { assembly1, assembly2 }, compileUnit.ReferencedAssemblies.Cast<string>());
+ }
+
+ [Fact]
+ public void CustomAttributes_AddMultiple_ReturnsExpected()
+ {
+ var compileUnit = new CodeCompileUnit();
+
+ CodeAttributeDeclaration attribute1 = new CodeAttributeDeclaration("Name1");
+ compileUnit.AssemblyCustomAttributes.Add(attribute1);
+ Assert.Equal(new CodeAttributeDeclaration[] { attribute1 }, compileUnit.AssemblyCustomAttributes.Cast<CodeAttributeDeclaration>());
+
+ CodeAttributeDeclaration attribute2 = new CodeAttributeDeclaration("Name2");
+ compileUnit.AssemblyCustomAttributes.Add(attribute2);
+ Assert.Equal(new CodeAttributeDeclaration[] { attribute1, attribute2 }, compileUnit.AssemblyCustomAttributes.Cast<CodeAttributeDeclaration>());
+ }
+
+ [Fact]
+ public void StartDirectives_AddMultiple_ReturnsExpected()
+ {
+ var compileUnit = new CodeCompileUnit();
+
+ CodeRegionDirective directive1 = new CodeRegionDirective(CodeRegionMode.None, "Region1");
+ compileUnit.StartDirectives.Add(directive1);
+ Assert.Equal(new CodeRegionDirective[] { directive1 }, compileUnit.StartDirectives.Cast<CodeDirective>());
+
+ CodeRegionDirective directive2 = new CodeRegionDirective(CodeRegionMode.None, "Region2");
+ compileUnit.StartDirectives.Add(directive2);
+ Assert.Equal(new CodeRegionDirective[] { directive1, directive2 }, compileUnit.StartDirectives.Cast<CodeDirective>());
+ }
+
+ [Fact]
+ public void EndDirectives_AddMultiple_ReturnsExpected()
+ {
+ var compileUnit = new CodeCompileUnit();
+
+ CodeRegionDirective directive1 = new CodeRegionDirective(CodeRegionMode.None, "Region1");
+ compileUnit.EndDirectives.Add(directive1);
+ Assert.Equal(new CodeRegionDirective[] { directive1 }, compileUnit.EndDirectives.Cast<CodeDirective>());
+
+ CodeRegionDirective directive2 = new CodeRegionDirective(CodeRegionMode.None, "Region2");
+ compileUnit.EndDirectives.Add(directive2);
+ Assert.Equal(new CodeRegionDirective[] { directive1, directive2 }, compileUnit.EndDirectives.Cast<CodeDirective>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeConditionStatementTests : CodeStatementTestBase<CodeConditionStatement>
- {
- [Fact]
- public void Ctor_Default()
- {
- var condition = new CodeConditionStatement();
- Assert.Null(condition.Condition);
- Assert.Empty(condition.TrueStatements);
- Assert.Empty(condition.FalseStatements);
- }
+ public class CodeConditionStatementTests : CodeStatementTestBase<CodeConditionStatement>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var condition = new CodeConditionStatement();
+ Assert.Null(condition.Condition);
+ Assert.Empty(condition.TrueStatements);
+ Assert.Empty(condition.FalseStatements);
+ }
- public static IEnumerable<object[]> Ctor_TestData()
- {
- yield return new object[] { null, new CodeStatement[0], new CodeStatement[0] };
- yield return new object[] { new CodePrimitiveExpression("Value1"), new CodeStatement[] { new CodeCommentStatement("Value2") }, new CodeStatement[0] };
- yield return new object[] { new CodePrimitiveExpression("Value1"), new CodeStatement[] { new CodeCommentStatement("Value2") }, new CodeStatement[] { new CodeCommentStatement("Value3") } };
- yield return new object[] { new CodePrimitiveExpression("Value1"), new CodeStatement[0], new CodeStatement[] { new CodeCommentStatement("Value3") } };
- }
+ public static IEnumerable<object[]> Ctor_TestData()
+ {
+ yield return new object[] { null, new CodeStatement[0], new CodeStatement[0] };
+ yield return new object[] { new CodePrimitiveExpression("Value1"), new CodeStatement[] { new CodeCommentStatement("Value2") }, new CodeStatement[0] };
+ yield return new object[] { new CodePrimitiveExpression("Value1"), new CodeStatement[] { new CodeCommentStatement("Value2") }, new CodeStatement[] { new CodeCommentStatement("Value3") } };
+ yield return new object[] { new CodePrimitiveExpression("Value1"), new CodeStatement[0], new CodeStatement[] { new CodeCommentStatement("Value3") } };
+ }
- [Theory]
- [MemberData(nameof(Ctor_TestData))]
- public void Ctor(CodeExpression expression, CodeStatement[] trueStatements, CodeStatement[] falseStatements)
- {
- if (falseStatements.Length == 0)
- {
- if (trueStatements.Length == 0)
- {
- // Use Ctor(CodeExpression)
- var condition1 = new CodeConditionStatement(expression);
- Assert.Equal(expression, condition1.Condition);
- Assert.Empty(condition1.TrueStatements);
- Assert.Empty(condition1.FalseStatements);
- }
- // Use Ctor(CodeExpression, CodeStatement[])
- var condition2 = new CodeConditionStatement(expression, trueStatements);
- Assert.Equal(expression, condition2.Condition);
- Assert.Equal(trueStatements, condition2.TrueStatements.Cast<CodeStatement>());
- Assert.Empty(condition2.FalseStatements);
- }
- // Use Ctor(CodeExpression, CodeStatement[], CodeStatement[])
- var condition3 = new CodeConditionStatement(expression, trueStatements, falseStatements);
- Assert.Equal(expression, condition3.Condition);
- Assert.Equal(trueStatements, condition3.TrueStatements.Cast<CodeStatement>());
- Assert.Equal(falseStatements, condition3.FalseStatements.Cast<CodeStatement>());
- }
+ [Theory]
+ [MemberData(nameof(Ctor_TestData))]
+ public void Ctor(CodeExpression expression, CodeStatement[] trueStatements, CodeStatement[] falseStatements)
+ {
+ if (falseStatements.Length == 0)
+ {
+ if (trueStatements.Length == 0)
+ {
+ // Use Ctor(CodeExpression)
+ var condition1 = new CodeConditionStatement(expression);
+ Assert.Equal(expression, condition1.Condition);
+ Assert.Empty(condition1.TrueStatements);
+ Assert.Empty(condition1.FalseStatements);
+ }
+ // Use Ctor(CodeExpression, CodeStatement[])
+ var condition2 = new CodeConditionStatement(expression, trueStatements);
+ Assert.Equal(expression, condition2.Condition);
+ Assert.Equal(trueStatements, condition2.TrueStatements.Cast<CodeStatement>());
+ Assert.Empty(condition2.FalseStatements);
+ }
+ // Use Ctor(CodeExpression, CodeStatement[], CodeStatement[])
+ var condition3 = new CodeConditionStatement(expression, trueStatements, falseStatements);
+ Assert.Equal(expression, condition3.Condition);
+ Assert.Equal(trueStatements, condition3.TrueStatements.Cast<CodeStatement>());
+ Assert.Equal(falseStatements, condition3.FalseStatements.Cast<CodeStatement>());
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Condition_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var condition = new CodeConditionStatement();
- condition.Condition = value;
- Assert.Equal(value, condition.Condition);
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Condition_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var condition = new CodeConditionStatement();
+ condition.Condition = value;
+ Assert.Equal(value, condition.Condition);
+ }
- [Fact]
- public void TrueStatements_AddMultiple_ReturnsExpected()
- {
- var condition = new CodeConditionStatement();
+ [Fact]
+ public void TrueStatements_AddMultiple_ReturnsExpected()
+ {
+ var condition = new CodeConditionStatement();
- CodeStatement statement1 = new CodeCommentStatement("Value1");
- condition.TrueStatements.Add(statement1);
- Assert.Equal(new CodeStatement[] { statement1 }, condition.TrueStatements.Cast<CodeStatement>());
+ CodeStatement statement1 = new CodeCommentStatement("Value1");
+ condition.TrueStatements.Add(statement1);
+ Assert.Equal(new CodeStatement[] { statement1 }, condition.TrueStatements.Cast<CodeStatement>());
- CodeStatement statement2 = new CodeCommentStatement("Value2");
- condition.TrueStatements.Add(statement2);
- Assert.Equal(new CodeStatement[] { statement1, statement2 }, condition.TrueStatements.Cast<CodeStatement>());
- }
+ CodeStatement statement2 = new CodeCommentStatement("Value2");
+ condition.TrueStatements.Add(statement2);
+ Assert.Equal(new CodeStatement[] { statement1, statement2 }, condition.TrueStatements.Cast<CodeStatement>());
+ }
- [Fact]
- public void FalseStatements_AddMultiple_ReturnsExpected()
- {
- var condition = new CodeConditionStatement();
+ [Fact]
+ public void FalseStatements_AddMultiple_ReturnsExpected()
+ {
+ var condition = new CodeConditionStatement();
- CodeStatement statement1 = new CodeCommentStatement("Value1");
- condition.FalseStatements.Add(statement1);
- Assert.Equal(new CodeStatement[] { statement1 }, condition.FalseStatements.Cast<CodeStatement>());
+ CodeStatement statement1 = new CodeCommentStatement("Value1");
+ condition.FalseStatements.Add(statement1);
+ Assert.Equal(new CodeStatement[] { statement1 }, condition.FalseStatements.Cast<CodeStatement>());
- CodeStatement statement2 = new CodeCommentStatement("Value2");
- condition.FalseStatements.Add(statement2);
- Assert.Equal(new CodeStatement[] { statement1, statement2 }, condition.FalseStatements.Cast<CodeStatement>());
- }
- }
+ CodeStatement statement2 = new CodeCommentStatement("Value2");
+ condition.FalseStatements.Add(statement2);
+ Assert.Equal(new CodeStatement[] { statement1, statement2 }, condition.FalseStatements.Cast<CodeStatement>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeConstructorTests : CodeObjectTestBase<CodeConstructor>
- {
- [Fact]
- public void Ctor_Default()
- {
- var constructor = new CodeConstructor();
- Assert.Equal(".ctor", constructor.Name);
- Assert.Empty(constructor.BaseConstructorArgs);
- Assert.Empty(constructor.ChainedConstructorArgs);
- }
-
- [Fact]
- public void BaseConstructorArgs_AddMultiple_ReturnsExpected()
- {
- var constructor = new CodeConstructor();
-
- CodeExpression expression1 = new CodePrimitiveExpression("Value1");
- constructor.BaseConstructorArgs.Add(expression1);
- Assert.Equal(new CodeExpression[] { expression1 }, constructor.BaseConstructorArgs.Cast<CodeExpression>());
-
- CodeExpression expression2 = new CodePrimitiveExpression("Value2");
- constructor.BaseConstructorArgs.Add(expression2);
- Assert.Equal(new CodeExpression[] { expression1, expression2 }, constructor.BaseConstructorArgs.Cast<CodeExpression>());
- }
-
- [Fact]
- public void ChainedConstructorArgs_AddMultiple_ReturnsExpected()
- {
- var constructor = new CodeConstructor();
-
- CodeExpression expression1 = new CodePrimitiveExpression("Value1");
- constructor.ChainedConstructorArgs.Add(expression1);
- Assert.Equal(new CodeExpression[] { expression1 }, constructor.ChainedConstructorArgs.Cast<CodeExpression>());
-
- CodeExpression expression2 = new CodePrimitiveExpression("Value2");
- constructor.ChainedConstructorArgs.Add(expression2);
- Assert.Equal(new CodeExpression[] { expression1, expression2 }, constructor.ChainedConstructorArgs.Cast<CodeExpression>());
- }
- }
+ public class CodeConstructorTests : CodeObjectTestBase<CodeConstructor>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var constructor = new CodeConstructor();
+ Assert.Equal(".ctor", constructor.Name);
+ Assert.Empty(constructor.BaseConstructorArgs);
+ Assert.Empty(constructor.ChainedConstructorArgs);
+ }
+
+ [Fact]
+ public void BaseConstructorArgs_AddMultiple_ReturnsExpected()
+ {
+ var constructor = new CodeConstructor();
+
+ CodeExpression expression1 = new CodePrimitiveExpression("Value1");
+ constructor.BaseConstructorArgs.Add(expression1);
+ Assert.Equal(new CodeExpression[] { expression1 }, constructor.BaseConstructorArgs.Cast<CodeExpression>());
+
+ CodeExpression expression2 = new CodePrimitiveExpression("Value2");
+ constructor.BaseConstructorArgs.Add(expression2);
+ Assert.Equal(new CodeExpression[] { expression1, expression2 }, constructor.BaseConstructorArgs.Cast<CodeExpression>());
+ }
+
+ [Fact]
+ public void ChainedConstructorArgs_AddMultiple_ReturnsExpected()
+ {
+ var constructor = new CodeConstructor();
+
+ CodeExpression expression1 = new CodePrimitiveExpression("Value1");
+ constructor.ChainedConstructorArgs.Add(expression1);
+ Assert.Equal(new CodeExpression[] { expression1 }, constructor.ChainedConstructorArgs.Cast<CodeExpression>());
+
+ CodeExpression expression2 = new CodePrimitiveExpression("Value2");
+ constructor.ChainedConstructorArgs.Add(expression2);
+ Assert.Equal(new CodeExpression[] { expression1, expression2 }, constructor.ChainedConstructorArgs.Cast<CodeExpression>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeDefaultValueExpressionTests : CodeObjectTestBase<CodeDefaultValueExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var defaultValue = new CodeDefaultValueExpression();
- Assert.Equal(typeof(void).FullName, defaultValue.Type.BaseType);
- }
+ public class CodeDefaultValueExpressionTests : CodeObjectTestBase<CodeDefaultValueExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var defaultValue = new CodeDefaultValueExpression();
+ Assert.Equal(typeof(void).FullName, defaultValue.Type.BaseType);
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Ctor_CodeTypeReference(CodeTypeReference type)
- {
- var defaultValue = new CodeDefaultValueExpression(type);
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, defaultValue.Type.BaseType);
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Ctor_CodeTypeReference(CodeTypeReference type)
+ {
+ var defaultValue = new CodeDefaultValueExpression(type);
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, defaultValue.Type.BaseType);
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Type_Set_Get_ReturnsExpected(CodeTypeReference value)
- {
- var defaultValue = new CodeDefaultValueExpression();
- defaultValue.Type = value;
- Assert.Equal((value ?? new CodeTypeReference("")).BaseType, defaultValue.Type.BaseType);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Type_Set_Get_ReturnsExpected(CodeTypeReference value)
+ {
+ var defaultValue = new CodeDefaultValueExpression();
+ defaultValue.Type = value;
+ Assert.Equal((value ?? new CodeTypeReference("")).BaseType, defaultValue.Type.BaseType);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeDelegateCreateExpressionTests : CodeObjectTestBase<CodeDelegateCreateExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var delegateCreate = new CodeDelegateCreateExpression();
- Assert.Equal(typeof(void).FullName, delegateCreate.DelegateType.BaseType);
+ public class CodeDelegateCreateExpressionTests : CodeObjectTestBase<CodeDelegateCreateExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var delegateCreate = new CodeDelegateCreateExpression();
+ Assert.Equal(typeof(void).FullName, delegateCreate.DelegateType.BaseType);
- Assert.Null(delegateCreate.TargetObject);
- Assert.Empty(delegateCreate.MethodName);
- }
+ Assert.Null(delegateCreate.TargetObject);
+ Assert.Empty(delegateCreate.MethodName);
+ }
- public static IEnumerable<object[]> Ctor_TestData()
- {
- yield return new object[] { null, null, null };
- yield return new object[] { new CodeTypeReference(""), new CodePrimitiveExpression(""), "" };
- yield return new object[] { new CodeTypeReference(typeof(Delegate)), new CodePrimitiveExpression("Value"), "MethodName" };
- }
+ public static IEnumerable<object[]> Ctor_TestData()
+ {
+ yield return new object[] { null, null, null };
+ yield return new object[] { new CodeTypeReference(""), new CodePrimitiveExpression(""), "" };
+ yield return new object[] { new CodeTypeReference(typeof(Delegate)), new CodePrimitiveExpression("Value"), "MethodName" };
+ }
- [Theory]
- [MemberData(nameof(Ctor_TestData))]
- public void Ctor(CodeTypeReference delegateType, CodeExpression targetObject, string methodName)
- {
- var delegateCreate = new CodeDelegateCreateExpression(delegateType, targetObject, methodName);
- Assert.Equal((delegateType ?? new CodeTypeReference("")).BaseType, delegateCreate.DelegateType.BaseType);
- Assert.Equal(targetObject, delegateCreate.TargetObject);
- Assert.Equal(methodName ?? string.Empty, delegateCreate.MethodName);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_TestData))]
+ public void Ctor(CodeTypeReference delegateType, CodeExpression targetObject, string methodName)
+ {
+ var delegateCreate = new CodeDelegateCreateExpression(delegateType, targetObject, methodName);
+ Assert.Equal((delegateType ?? new CodeTypeReference("")).BaseType, delegateCreate.DelegateType.BaseType);
+ Assert.Equal(targetObject, delegateCreate.TargetObject);
+ Assert.Equal(methodName ?? string.Empty, delegateCreate.MethodName);
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void DelegateType_Set_Get_ReturnsExpected(CodeTypeReference value)
- {
- var delegateCreate = new CodeDelegateCreateExpression();
- delegateCreate.DelegateType = value;
- Assert.Equal((value ?? new CodeTypeReference("")).BaseType, delegateCreate.DelegateType.BaseType);
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void DelegateType_Set_Get_ReturnsExpected(CodeTypeReference value)
+ {
+ var delegateCreate = new CodeDelegateCreateExpression();
+ delegateCreate.DelegateType = value;
+ Assert.Equal((value ?? new CodeTypeReference("")).BaseType, delegateCreate.DelegateType.BaseType);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var delegateCreate = new CodeDelegateCreateExpression();
- delegateCreate.TargetObject = value;
- Assert.Equal(value, delegateCreate.TargetObject);
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var delegateCreate = new CodeDelegateCreateExpression();
+ delegateCreate.TargetObject = value;
+ Assert.Equal(value, delegateCreate.TargetObject);
+ }
- [Theory]
- [InlineData(null)]
- [InlineData("")]
- [InlineData("MethodName")]
- public void MethodName_Set_Get_ReturnsExpected(string value)
- {
- var delegateCreate = new CodeDelegateCreateExpression();
- delegateCreate.MethodName = value;
- Assert.Equal(value ?? string.Empty, delegateCreate.MethodName);
- }
- }
+ [Theory]
+ [InlineData(null)]
+ [InlineData("")]
+ [InlineData("MethodName")]
+ public void MethodName_Set_Get_ReturnsExpected(string value)
+ {
+ var delegateCreate = new CodeDelegateCreateExpression();
+ delegateCreate.MethodName = value;
+ Assert.Equal(value ?? string.Empty, delegateCreate.MethodName);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeDelegateInvokeExpressionTests : CodeObjectTestBase<CodeDelegateInvokeExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var delegateInvoke = new CodeDelegateInvokeExpression();
- Assert.Null(delegateInvoke.TargetObject);
+ public class CodeDelegateInvokeExpressionTests : CodeObjectTestBase<CodeDelegateInvokeExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var delegateInvoke = new CodeDelegateInvokeExpression();
+ Assert.Null(delegateInvoke.TargetObject);
- Assert.Empty(delegateInvoke.Parameters);
- }
+ Assert.Empty(delegateInvoke.Parameters);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Ctor_CodeExpression(CodeExpression targetObject)
- {
- var delegateInvoke = new CodeDelegateInvokeExpression(targetObject);
- Assert.Equal(targetObject, delegateInvoke.TargetObject);
- Assert.Empty(delegateInvoke.Parameters);
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Ctor_CodeExpression(CodeExpression targetObject)
+ {
+ var delegateInvoke = new CodeDelegateInvokeExpression(targetObject);
+ Assert.Equal(targetObject, delegateInvoke.TargetObject);
+ Assert.Empty(delegateInvoke.Parameters);
+ }
- public static IEnumerable<object[]> Ctor_CodeExpression_ParamsCodeExpression_TestData()
- {
- yield return new object[] { null, new CodeExpression[0] };
- yield return new object[] { new CodePrimitiveExpression(""), new CodeExpression[] { new CodePrimitiveExpression() } };
- yield return new object[] { new CodePrimitiveExpression("Hello"), new CodeExpression[] { new CodePrimitiveExpression("Value1") } };
- }
+ public static IEnumerable<object[]> Ctor_CodeExpression_ParamsCodeExpression_TestData()
+ {
+ yield return new object[] { null, new CodeExpression[0] };
+ yield return new object[] { new CodePrimitiveExpression(""), new CodeExpression[] { new CodePrimitiveExpression() } };
+ yield return new object[] { new CodePrimitiveExpression("Hello"), new CodeExpression[] { new CodePrimitiveExpression("Value1") } };
+ }
- [Theory]
- [MemberData(nameof(Ctor_CodeExpression_ParamsCodeExpression_TestData))]
- public void Ctor_CodeExpression_ParamsCodeExpression(CodeExpression targetObject, CodeExpression[] parameters)
- {
- var delegateInvoke = new CodeDelegateInvokeExpression(targetObject, parameters);
- Assert.Equal(targetObject, delegateInvoke.TargetObject);
- Assert.Equal(parameters, delegateInvoke.Parameters.Cast<CodeExpression>());
- }
+ [Theory]
+ [MemberData(nameof(Ctor_CodeExpression_ParamsCodeExpression_TestData))]
+ public void Ctor_CodeExpression_ParamsCodeExpression(CodeExpression targetObject, CodeExpression[] parameters)
+ {
+ var delegateInvoke = new CodeDelegateInvokeExpression(targetObject, parameters);
+ Assert.Equal(targetObject, delegateInvoke.TargetObject);
+ Assert.Equal(parameters, delegateInvoke.Parameters.Cast<CodeExpression>());
+ }
- [Fact]
- public void Ctor_NullParameters_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeDelegateInvokeExpression(new CodePrimitiveExpression("Hello"), null));
- }
+ [Fact]
+ public void Ctor_NullParameters_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeDelegateInvokeExpression(new CodePrimitiveExpression("Hello"), null));
+ }
- [Fact]
- public void Ctor_NullObjectInParameters_ThrowsArgumentNullException()
- {
- CodeExpression[] parameters = new CodeExpression[] { null };
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeDelegateInvokeExpression(new CodePrimitiveExpression("Hello"), parameters));
- }
+ [Fact]
+ public void Ctor_NullObjectInParameters_ThrowsArgumentNullException()
+ {
+ CodeExpression[] parameters = new CodeExpression[] { null };
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeDelegateInvokeExpression(new CodePrimitiveExpression("Hello"), parameters));
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var delegateInvoke = new CodeDelegateInvokeExpression();
- delegateInvoke.TargetObject = value;
- Assert.Same(value, delegateInvoke.TargetObject);
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var delegateInvoke = new CodeDelegateInvokeExpression();
+ delegateInvoke.TargetObject = value;
+ Assert.Same(value, delegateInvoke.TargetObject);
+ }
- [Fact]
- public void Parameters_AddMultiple_ReturnsExpected()
- {
- var delegateInvoke = new CodeDelegateInvokeExpression();
+ [Fact]
+ public void Parameters_AddMultiple_ReturnsExpected()
+ {
+ var delegateInvoke = new CodeDelegateInvokeExpression();
- CodeParameterDeclarationExpression parameter1 = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name1");
- delegateInvoke.Parameters.Add(parameter1);
- Assert.Equal(new CodeParameterDeclarationExpression[] { parameter1 }, delegateInvoke.Parameters.Cast<CodeParameterDeclarationExpression>());
+ CodeParameterDeclarationExpression parameter1 = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name1");
+ delegateInvoke.Parameters.Add(parameter1);
+ Assert.Equal(new CodeParameterDeclarationExpression[] { parameter1 }, delegateInvoke.Parameters.Cast<CodeParameterDeclarationExpression>());
- CodeParameterDeclarationExpression parameter2 = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name2");
- delegateInvoke.Parameters.Add(parameter2);
- Assert.Equal(new CodeParameterDeclarationExpression[] { parameter1, parameter2 }, delegateInvoke.Parameters.Cast<CodeParameterDeclarationExpression>());
- }
- }
+ CodeParameterDeclarationExpression parameter2 = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name2");
+ delegateInvoke.Parameters.Add(parameter2);
+ Assert.Equal(new CodeParameterDeclarationExpression[] { parameter1, parameter2 }, delegateInvoke.Parameters.Cast<CodeParameterDeclarationExpression>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeDirectionExpressionTests : CodeObjectTestBase<CodeDirectionExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var direction = new CodeDirectionExpression();
- Assert.Null(direction.Expression);
- Assert.Equal(FieldDirection.In, direction.Direction);
- }
+ public class CodeDirectionExpressionTests : CodeObjectTestBase<CodeDirectionExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var direction = new CodeDirectionExpression();
+ Assert.Null(direction.Expression);
+ Assert.Equal(FieldDirection.In, direction.Direction);
+ }
- public static IEnumerable<object[]> Ctor_TestData()
- {
- yield return new object[] { FieldDirection.In, null };
- yield return new object[] { FieldDirection.In - 1, new CodePrimitiveExpression() };
- yield return new object[] { FieldDirection.Ref + 1, new CodePrimitiveExpression("Value") };
- }
+ public static IEnumerable<object[]> Ctor_TestData()
+ {
+ yield return new object[] { FieldDirection.In, null };
+ yield return new object[] { FieldDirection.In - 1, new CodePrimitiveExpression() };
+ yield return new object[] { FieldDirection.Ref + 1, new CodePrimitiveExpression("Value") };
+ }
- [Theory]
- [MemberData(nameof(Ctor_TestData))]
- public void Ctor(FieldDirection direction, CodeExpression expression)
- {
- var directionExpression = new CodeDirectionExpression(direction, expression);
- Assert.Equal(direction, directionExpression.Direction);
- Assert.Equal(expression, directionExpression.Expression);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_TestData))]
+ public void Ctor(FieldDirection direction, CodeExpression expression)
+ {
+ var directionExpression = new CodeDirectionExpression(direction, expression);
+ Assert.Equal(direction, directionExpression.Direction);
+ Assert.Equal(expression, directionExpression.Expression);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Expression_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var direction = new CodeDirectionExpression();
- direction.Expression = value;
- Assert.Equal(value, direction.Expression);
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Expression_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var direction = new CodeDirectionExpression();
+ direction.Expression = value;
+ Assert.Equal(value, direction.Expression);
+ }
- [Theory]
- [InlineData(FieldDirection.In - 1)]
- [InlineData(FieldDirection.In)]
- [InlineData(FieldDirection.In | FieldDirection.Out)]
- [InlineData(FieldDirection.Ref + 1)]
- public void Direction_Set_Get_ReturnsExpected(FieldDirection value)
- {
- var direction = new CodeDirectionExpression();
- direction.Direction = value;
- Assert.Equal(value, direction.Direction);
- }
- }
+ [Theory]
+ [InlineData(FieldDirection.In - 1)]
+ [InlineData(FieldDirection.In)]
+ [InlineData(FieldDirection.In | FieldDirection.Out)]
+ [InlineData(FieldDirection.Ref + 1)]
+ public void Direction_Set_Get_ReturnsExpected(FieldDirection value)
+ {
+ var direction = new CodeDirectionExpression();
+ direction.Direction = value;
+ Assert.Equal(value, direction.Direction);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeEventReferenceExpressionTests : CodeObjectTestBase<CodeEventReferenceExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var eventReference = new CodeEventReferenceExpression();
- Assert.Null(eventReference.TargetObject);
- Assert.Empty(eventReference.EventName);
- }
+ public class CodeEventReferenceExpressionTests : CodeObjectTestBase<CodeEventReferenceExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var eventReference = new CodeEventReferenceExpression();
+ Assert.Null(eventReference.TargetObject);
+ Assert.Empty(eventReference.EventName);
+ }
- public static IEnumerable<object[]> Ctor_TestData()
- {
- yield return new object[] { null, null };
- yield return new object[] { new CodePrimitiveExpression(""), "" };
- yield return new object[] { new CodePrimitiveExpression("Value"), "EventName" };
- }
+ public static IEnumerable<object[]> Ctor_TestData()
+ {
+ yield return new object[] { null, null };
+ yield return new object[] { new CodePrimitiveExpression(""), "" };
+ yield return new object[] { new CodePrimitiveExpression("Value"), "EventName" };
+ }
- [Theory]
- [MemberData(nameof(Ctor_TestData))]
- public void Ctor(CodeExpression targetObject, string eventName)
- {
- var eventReference = new CodeEventReferenceExpression(targetObject, eventName);
- Assert.Equal(targetObject, eventReference.TargetObject);
- Assert.Equal(eventName ?? string.Empty, eventReference.EventName);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_TestData))]
+ public void Ctor(CodeExpression targetObject, string eventName)
+ {
+ var eventReference = new CodeEventReferenceExpression(targetObject, eventName);
+ Assert.Equal(targetObject, eventReference.TargetObject);
+ Assert.Equal(eventName ?? string.Empty, eventReference.EventName);
+ }
- [Theory]
- [InlineData(null)]
- [InlineData("")]
- [InlineData("EventName")]
- public void EventName_Set_Get_ReturnsExpected(string value)
- {
- var eventReference = new CodeEventReferenceExpression();
- eventReference.EventName = value;
- Assert.Equal(value ?? string.Empty, eventReference.EventName);
- }
+ [Theory]
+ [InlineData(null)]
+ [InlineData("")]
+ [InlineData("EventName")]
+ public void EventName_Set_Get_ReturnsExpected(string value)
+ {
+ var eventReference = new CodeEventReferenceExpression();
+ eventReference.EventName = value;
+ Assert.Equal(value ?? string.Empty, eventReference.EventName);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var eventReference = new CodeEventReferenceExpression();
- eventReference.TargetObject = value;
- Assert.Equal(value, eventReference.TargetObject);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var eventReference = new CodeEventReferenceExpression();
+ eventReference.TargetObject = value;
+ Assert.Equal(value, eventReference.TargetObject);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeExpressionStatementTests : CodeStatementTestBase<CodeExpressionStatement>
- {
- [Fact]
- public void Ctor_Default()
- {
- var expressionStatement = new CodeExpressionStatement();
- Assert.Null(expressionStatement.Expression);
- }
+ public class CodeExpressionStatementTests : CodeStatementTestBase<CodeExpressionStatement>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var expressionStatement = new CodeExpressionStatement();
+ Assert.Null(expressionStatement.Expression);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Ctor_CodeExpression(CodeExpression expression)
- {
- var expressionStatement = new CodeExpressionStatement(expression);
- Assert.Equal(expression, expressionStatement.Expression);
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Ctor_CodeExpression(CodeExpression expression)
+ {
+ var expressionStatement = new CodeExpressionStatement(expression);
+ Assert.Equal(expression, expressionStatement.Expression);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Expression_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var expressionStatement = new CodeExpressionStatement();
- expressionStatement.Expression = value;
- Assert.Equal(value, expressionStatement.Expression);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Expression_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var expressionStatement = new CodeExpressionStatement();
+ expressionStatement.Expression = value;
+ Assert.Equal(value, expressionStatement.Expression);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeFieldReferenceExpressionTests : CodeObjectTestBase<CodeFieldReferenceExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var fieldReference = new CodeFieldReferenceExpression();
- Assert.Null(fieldReference.TargetObject);
- Assert.Empty(fieldReference.FieldName);
- }
+ public class CodeFieldReferenceExpressionTests : CodeObjectTestBase<CodeFieldReferenceExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var fieldReference = new CodeFieldReferenceExpression();
+ Assert.Null(fieldReference.TargetObject);
+ Assert.Empty(fieldReference.FieldName);
+ }
- public static IEnumerable<object[]> Ctor_TestData()
- {
- yield return new object[] { null, null };
- yield return new object[] { new CodePrimitiveExpression(""), "" };
- yield return new object[] { new CodePrimitiveExpression("Value"), "FieldName" };
- }
+ public static IEnumerable<object[]> Ctor_TestData()
+ {
+ yield return new object[] { null, null };
+ yield return new object[] { new CodePrimitiveExpression(""), "" };
+ yield return new object[] { new CodePrimitiveExpression("Value"), "FieldName" };
+ }
- [Theory]
- [MemberData(nameof(Ctor_TestData))]
- public void Ctor(CodeExpression targetObject, string fieldName)
- {
- var fieldReference = new CodeFieldReferenceExpression(targetObject, fieldName);
- Assert.Equal(targetObject, fieldReference.TargetObject);
- Assert.Equal(fieldName ?? string.Empty, fieldReference.FieldName);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_TestData))]
+ public void Ctor(CodeExpression targetObject, string fieldName)
+ {
+ var fieldReference = new CodeFieldReferenceExpression(targetObject, fieldName);
+ Assert.Equal(targetObject, fieldReference.TargetObject);
+ Assert.Equal(fieldName ?? string.Empty, fieldReference.FieldName);
+ }
- [Theory]
- [InlineData(null)]
- [InlineData("")]
- [InlineData("FieldName")]
- public void EventName_Set_Get_ReturnsExpected(string value)
- {
- var fieldReference = new CodeFieldReferenceExpression();
- fieldReference.FieldName = value;
- Assert.Equal(value ?? string.Empty, fieldReference.FieldName);
- }
+ [Theory]
+ [InlineData(null)]
+ [InlineData("")]
+ [InlineData("FieldName")]
+ public void EventName_Set_Get_ReturnsExpected(string value)
+ {
+ var fieldReference = new CodeFieldReferenceExpression();
+ fieldReference.FieldName = value;
+ Assert.Equal(value ?? string.Empty, fieldReference.FieldName);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var fieldReference = new CodeFieldReferenceExpression();
- fieldReference.TargetObject = value;
- Assert.Equal(value, fieldReference.TargetObject);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var fieldReference = new CodeFieldReferenceExpression();
+ fieldReference.TargetObject = value;
+ Assert.Equal(value, fieldReference.TargetObject);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeGotoStatementTests : CodeStatementTestBase<CodeGotoStatement>
- {
- [Fact]
- public void Ctor_Default()
- {
- var gotoStatement = new CodeGotoStatement();
- Assert.Null(gotoStatement.Label);
- }
+ public class CodeGotoStatementTests : CodeStatementTestBase<CodeGotoStatement>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var gotoStatement = new CodeGotoStatement();
+ Assert.Null(gotoStatement.Label);
+ }
- [Theory]
- [InlineData("\r n \t")]
- [InlineData("Label")]
- public void Ctor_String(string label)
- {
- var gotoStatement = new CodeGotoStatement(label);
- Assert.Equal(label, gotoStatement.Label);
- }
+ [Theory]
+ [InlineData("\r n \t")]
+ [InlineData("Label")]
+ public void Ctor_String(string label)
+ {
+ var gotoStatement = new CodeGotoStatement(label);
+ Assert.Equal(label, gotoStatement.Label);
+ }
- [Theory]
- [InlineData(null)]
- [InlineData("")]
- public void Ctor_StringNullOrEmpty_ThrowsArgumentNullException(string value)
- {
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeGotoStatement(value));
- }
+ [Theory]
+ [InlineData(null)]
+ [InlineData("")]
+ public void Ctor_StringNullOrEmpty_ThrowsArgumentNullException(string value)
+ {
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeGotoStatement(value));
+ }
- [Theory]
- [InlineData("\r \n \t")]
- [InlineData("Label")]
- public void Label_Set_Get_ReturnsExpected(string value)
- {
- var gotoStatement = new CodeGotoStatement();
- gotoStatement.Label = value;
- Assert.Equal(value, gotoStatement.Label);
- }
+ [Theory]
+ [InlineData("\r \n \t")]
+ [InlineData("Label")]
+ public void Label_Set_Get_ReturnsExpected(string value)
+ {
+ var gotoStatement = new CodeGotoStatement();
+ gotoStatement.Label = value;
+ Assert.Equal(value, gotoStatement.Label);
+ }
- [Theory]
- [InlineData(null)]
- [InlineData("")]
- public void Label_SetNullOrEmpty_ThrowsArgumentNullException(string value)
- {
- var gotoStatement = new CodeGotoStatement();
- AssertExtensions.Throws<ArgumentNullException>("value", () => gotoStatement.Label = value);
- }
- }
+ [Theory]
+ [InlineData(null)]
+ [InlineData("")]
+ public void Label_SetNullOrEmpty_ThrowsArgumentNullException(string value)
+ {
+ var gotoStatement = new CodeGotoStatement();
+ AssertExtensions.Throws<ArgumentNullException>("value", () => gotoStatement.Label = value);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeIndexerExpressionTests : CodeObjectTestBase<CodeIndexerExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var indexer = new CodeIndexerExpression();
- Assert.Null(indexer.TargetObject);
- Assert.Empty(indexer.Indices);
- }
+ public class CodeIndexerExpressionTests : CodeObjectTestBase<CodeIndexerExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var indexer = new CodeIndexerExpression();
+ Assert.Null(indexer.TargetObject);
+ Assert.Empty(indexer.Indices);
+ }
- public static IEnumerable<object[]> Ctor_CodeExpression_ParamsCodeExpression_TestData()
- {
- yield return new object[] { null, new CodeExpression[0] };
- yield return new object[] { new CodePrimitiveExpression(""), new CodeExpression[] { new CodePrimitiveExpression() } };
- yield return new object[] { new CodePrimitiveExpression("Hello"), new CodeExpression[] { new CodePrimitiveExpression("Value1") } };
- }
+ public static IEnumerable<object[]> Ctor_CodeExpression_ParamsCodeExpression_TestData()
+ {
+ yield return new object[] { null, new CodeExpression[0] };
+ yield return new object[] { new CodePrimitiveExpression(""), new CodeExpression[] { new CodePrimitiveExpression() } };
+ yield return new object[] { new CodePrimitiveExpression("Hello"), new CodeExpression[] { new CodePrimitiveExpression("Value1") } };
+ }
- [Theory]
- [MemberData(nameof(Ctor_CodeExpression_ParamsCodeExpression_TestData))]
- public void Ctor_CodeExpression_ParamsCodeExpression(CodeExpression targetObject, CodeExpression[] parameters)
- {
- var indexer = new CodeIndexerExpression(targetObject, parameters);
- Assert.Equal(targetObject, indexer.TargetObject);
- Assert.Equal(parameters, indexer.Indices.Cast<CodeExpression>());
- }
+ [Theory]
+ [MemberData(nameof(Ctor_CodeExpression_ParamsCodeExpression_TestData))]
+ public void Ctor_CodeExpression_ParamsCodeExpression(CodeExpression targetObject, CodeExpression[] parameters)
+ {
+ var indexer = new CodeIndexerExpression(targetObject, parameters);
+ Assert.Equal(targetObject, indexer.TargetObject);
+ Assert.Equal(parameters, indexer.Indices.Cast<CodeExpression>());
+ }
- [Fact]
- public void Ctor_NullIndices_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeIndexerExpression(new CodePrimitiveExpression("Hello"), null));
- }
+ [Fact]
+ public void Ctor_NullIndices_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeIndexerExpression(new CodePrimitiveExpression("Hello"), null));
+ }
- [Fact]
- public void Ctor_NullObjectInIndices_ThrowsArgumentNullException()
- {
- CodeExpression[] parameters = new CodeExpression[] { null };
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeIndexerExpression(new CodePrimitiveExpression("Hello"), parameters));
- }
+ [Fact]
+ public void Ctor_NullObjectInIndices_ThrowsArgumentNullException()
+ {
+ CodeExpression[] parameters = new CodeExpression[] { null };
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeIndexerExpression(new CodePrimitiveExpression("Hello"), parameters));
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var indexer = new CodeIndexerExpression();
- indexer.TargetObject = value;
- Assert.Equal(value, indexer.TargetObject);
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var indexer = new CodeIndexerExpression();
+ indexer.TargetObject = value;
+ Assert.Equal(value, indexer.TargetObject);
+ }
- [Fact]
- public void Parameters_AddMultiple_ReturnsExpected()
- {
- var indexer = new CodeIndexerExpression();
+ [Fact]
+ public void Parameters_AddMultiple_ReturnsExpected()
+ {
+ var indexer = new CodeIndexerExpression();
- CodeExpression expression1 = new CodePrimitiveExpression("Value1");
- indexer.Indices.Add(expression1);
- Assert.Equal(new CodeExpression[] { expression1 }, indexer.Indices.Cast<CodeExpression>());
+ CodeExpression expression1 = new CodePrimitiveExpression("Value1");
+ indexer.Indices.Add(expression1);
+ Assert.Equal(new CodeExpression[] { expression1 }, indexer.Indices.Cast<CodeExpression>());
- CodeExpression expression2 = new CodePrimitiveExpression("Value2");
- indexer.Indices.Add(expression2);
- Assert.Equal(new CodeExpression[] { expression1, expression2 }, indexer.Indices.Cast<CodeExpression>());
- }
- }
+ CodeExpression expression2 = new CodePrimitiveExpression("Value2");
+ indexer.Indices.Add(expression2);
+ Assert.Equal(new CodeExpression[] { expression1, expression2 }, indexer.Indices.Cast<CodeExpression>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeIterationStatementTests : CodeStatementTestBase<CodeIterationStatement>
- {
- [Fact]
- public void Ctor_Default()
- {
- var iteration = new CodeIterationStatement();
- Assert.Null(iteration.InitStatement);
- Assert.Null(iteration.TestExpression);
- Assert.Null(iteration.IncrementStatement);
+ public class CodeIterationStatementTests : CodeStatementTestBase<CodeIterationStatement>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var iteration = new CodeIterationStatement();
+ Assert.Null(iteration.InitStatement);
+ Assert.Null(iteration.TestExpression);
+ Assert.Null(iteration.IncrementStatement);
- Assert.Empty(iteration.Statements);
- }
+ Assert.Empty(iteration.Statements);
+ }
- public static IEnumerable<object[]> Ctor_TestData()
- {
- yield return new object[] { null, null, null, new CodeStatement[0] };
- yield return new object[] { new CodeCommentStatement("1"), new CodePrimitiveExpression("2"), new CodeCommentStatement("3"), new CodeStatement[] { new CodeCommentStatement("4") } };
- }
+ public static IEnumerable<object[]> Ctor_TestData()
+ {
+ yield return new object[] { null, null, null, new CodeStatement[0] };
+ yield return new object[] { new CodeCommentStatement("1"), new CodePrimitiveExpression("2"), new CodeCommentStatement("3"), new CodeStatement[] { new CodeCommentStatement("4") } };
+ }
- [Theory]
- [MemberData(nameof(Ctor_TestData))]
- public void Ctor(CodeStatement initStatement, CodeExpression testExpression, CodeStatement incrementStatement, CodeStatement[] statements)
- {
- var iteration = new CodeIterationStatement(initStatement, testExpression, incrementStatement, statements);
- Assert.Equal(initStatement, iteration.InitStatement);
- Assert.Equal(testExpression, iteration.TestExpression);
- Assert.Equal(incrementStatement, iteration.IncrementStatement);
- Assert.Equal(statements, iteration.Statements.Cast<CodeStatement>());
- }
+ [Theory]
+ [MemberData(nameof(Ctor_TestData))]
+ public void Ctor(CodeStatement initStatement, CodeExpression testExpression, CodeStatement incrementStatement, CodeStatement[] statements)
+ {
+ var iteration = new CodeIterationStatement(initStatement, testExpression, incrementStatement, statements);
+ Assert.Equal(initStatement, iteration.InitStatement);
+ Assert.Equal(testExpression, iteration.TestExpression);
+ Assert.Equal(incrementStatement, iteration.IncrementStatement);
+ Assert.Equal(statements, iteration.Statements.Cast<CodeStatement>());
+ }
- [Theory]
- [InlineData(null)]
- [InlineData("")]
- public void Ctor_NullStatements_ThrowsArgumentNullException(string value)
- {
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeIterationStatement(null, null, null, null));
- }
+ [Theory]
+ [InlineData(null)]
+ [InlineData("")]
+ public void Ctor_NullStatements_ThrowsArgumentNullException(string value)
+ {
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeIterationStatement(null, null, null, null));
+ }
- [Theory]
- [InlineData(null)]
- [InlineData("")]
- public void Ctor_NullObjectInStatements_ThrowsArgumentNullException(string value)
- {
- CodeStatement[] statements = new CodeStatement[] { null };
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeIterationStatement(null, null, null, statements));
- }
+ [Theory]
+ [InlineData(null)]
+ [InlineData("")]
+ public void Ctor_NullObjectInStatements_ThrowsArgumentNullException(string value)
+ {
+ CodeStatement[] statements = new CodeStatement[] { null };
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeIterationStatement(null, null, null, statements));
+ }
- [Theory]
- [MemberData(nameof(CodeStatement_TestData))]
- public void InitStatement_Set_Get_ReturnsExpected(CodeStatement value)
- {
- var iteration = new CodeIterationStatement();
- iteration.InitStatement = value;
- Assert.Equal(value, iteration.InitStatement);
- }
+ [Theory]
+ [MemberData(nameof(CodeStatement_TestData))]
+ public void InitStatement_Set_Get_ReturnsExpected(CodeStatement value)
+ {
+ var iteration = new CodeIterationStatement();
+ iteration.InitStatement = value;
+ Assert.Equal(value, iteration.InitStatement);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void TestExpression_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var iteration = new CodeIterationStatement();
- iteration.TestExpression = value;
- Assert.Equal(value, iteration.TestExpression);
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void TestExpression_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var iteration = new CodeIterationStatement();
+ iteration.TestExpression = value;
+ Assert.Equal(value, iteration.TestExpression);
+ }
- [Theory]
- [MemberData(nameof(CodeStatement_TestData))]
- public void IncrementStatement_Set_Get_ReturnsExpected(CodeStatement value)
- {
- var iteration = new CodeIterationStatement();
- iteration.IncrementStatement = value;
- Assert.Equal(value, iteration.IncrementStatement);
- }
+ [Theory]
+ [MemberData(nameof(CodeStatement_TestData))]
+ public void IncrementStatement_Set_Get_ReturnsExpected(CodeStatement value)
+ {
+ var iteration = new CodeIterationStatement();
+ iteration.IncrementStatement = value;
+ Assert.Equal(value, iteration.IncrementStatement);
+ }
- [Fact]
- public void Statements_AddMultiple_ReturnsExpected()
- {
- var iteration = new CodeIterationStatement();
+ [Fact]
+ public void Statements_AddMultiple_ReturnsExpected()
+ {
+ var iteration = new CodeIterationStatement();
- CodeStatement statement1 = new CodeCommentStatement("Value1");
- iteration.Statements.Add(statement1);
- Assert.Equal(new CodeStatement[] { statement1 }, iteration.Statements.Cast<CodeStatement>());
+ CodeStatement statement1 = new CodeCommentStatement("Value1");
+ iteration.Statements.Add(statement1);
+ Assert.Equal(new CodeStatement[] { statement1 }, iteration.Statements.Cast<CodeStatement>());
- CodeStatement statement2 = new CodeCommentStatement("Value2");
- iteration.Statements.Add(statement2);
- Assert.Equal(new CodeStatement[] { statement1, statement2 }, iteration.Statements.Cast<CodeStatement>());
- }
- }
+ CodeStatement statement2 = new CodeCommentStatement("Value2");
+ iteration.Statements.Add(statement2);
+ Assert.Equal(new CodeStatement[] { statement1, statement2 }, iteration.Statements.Cast<CodeStatement>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeLabeledStatementTests : CodeStatementTestBase<CodeLabeledStatement>
- {
- [Fact]
- public void Ctor_Default()
- {
- var labeled = new CodeLabeledStatement();
- Assert.Empty(labeled.Label);
- Assert.Null(labeled.Statement);
- }
+ public class CodeLabeledStatementTests : CodeStatementTestBase<CodeLabeledStatement>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var labeled = new CodeLabeledStatement();
+ Assert.Empty(labeled.Label);
+ Assert.Null(labeled.Statement);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Ctor_String(string label)
- {
- var labeled = new CodeLabeledStatement(label);
- Assert.Equal(label ?? string.Empty, labeled.Label);
- Assert.Null(labeled.Statement);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Ctor_String(string label)
+ {
+ var labeled = new CodeLabeledStatement(label);
+ Assert.Equal(label ?? string.Empty, labeled.Label);
+ Assert.Null(labeled.Statement);
+ }
- public static IEnumerable<object[]> Ctor_String_CodeStatement_TestData()
- {
- yield return new object[] { null, null };
- yield return new object[] { "", new CodeStatement() };
- yield return new object[] { "Label", new CodeCommentStatement("Comment") };
- }
+ public static IEnumerable<object[]> Ctor_String_CodeStatement_TestData()
+ {
+ yield return new object[] { null, null };
+ yield return new object[] { "", new CodeStatement() };
+ yield return new object[] { "Label", new CodeCommentStatement("Comment") };
+ }
- [Theory]
- [MemberData(nameof(Ctor_String_CodeStatement_TestData))]
- public void Ctor_String_CodeStatement(string label, CodeStatement statement)
- {
- var labeled = new CodeLabeledStatement(label, statement);
- Assert.Equal(label ?? string.Empty, labeled.Label);
- Assert.Equal(statement, labeled.Statement);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_String_CodeStatement_TestData))]
+ public void Ctor_String_CodeStatement(string label, CodeStatement statement)
+ {
+ var labeled = new CodeLabeledStatement(label, statement);
+ Assert.Equal(label ?? string.Empty, labeled.Label);
+ Assert.Equal(statement, labeled.Statement);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Label_Set_Get_ReturnsExpected(string value)
- {
- var labeled = new CodeLabeledStatement();
- labeled.Label = value;
- Assert.Equal(value ?? string.Empty, labeled.Label);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Label_Set_Get_ReturnsExpected(string value)
+ {
+ var labeled = new CodeLabeledStatement();
+ labeled.Label = value;
+ Assert.Equal(value ?? string.Empty, labeled.Label);
+ }
- [Theory]
- [MemberData(nameof(CodeStatement_TestData))]
- public void Statement_Set_Get_ReturnsExpected(CodeStatement value)
- {
- var labeled = new CodeLabeledStatement();
- labeled.Statement = value;
- Assert.Equal(value, labeled.Statement);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeStatement_TestData))]
+ public void Statement_Set_Get_ReturnsExpected(CodeStatement value)
+ {
+ var labeled = new CodeLabeledStatement();
+ labeled.Statement = value;
+ Assert.Equal(value, labeled.Statement);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeLinePragmaTests : CodeDomTestBase
- {
- [Fact]
- public void Ctor_Default()
- {
- var linePragma = new CodeLinePragma();
- Assert.Empty(linePragma.FileName);
- Assert.Equal(0, linePragma.LineNumber);
- }
+ public class CodeLinePragmaTests : CodeDomTestBase
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var linePragma = new CodeLinePragma();
+ Assert.Empty(linePragma.FileName);
+ Assert.Equal(0, linePragma.LineNumber);
+ }
- public static IEnumerable<object[]> Ctor_String_Int_TestData()
- {
- yield return new object[] { null, 0 };
- yield return new object[] { "", -1 };
- yield return new object[] { "Value1", 1 };
- }
+ public static IEnumerable<object[]> Ctor_String_Int_TestData()
+ {
+ yield return new object[] { null, 0 };
+ yield return new object[] { "", -1 };
+ yield return new object[] { "Value1", 1 };
+ }
- [Theory]
- [MemberData(nameof(Ctor_String_Int_TestData))]
- public void Ctor_String_Int(string fileName, int lineNumber)
- {
- var linePragma = new CodeLinePragma(fileName, lineNumber);
- Assert.Equal(fileName ?? string.Empty, linePragma.FileName);
- Assert.Equal(lineNumber, linePragma.LineNumber);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_String_Int_TestData))]
+ public void Ctor_String_Int(string fileName, int lineNumber)
+ {
+ var linePragma = new CodeLinePragma(fileName, lineNumber);
+ Assert.Equal(fileName ?? string.Empty, linePragma.FileName);
+ Assert.Equal(lineNumber, linePragma.LineNumber);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void FileName_Set_Get_ReturnsExpected(string value)
- {
- var linePragma = new CodeLinePragma();
- linePragma.FileName = value;
- Assert.Equal(value ?? string.Empty, linePragma.FileName);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void FileName_Set_Get_ReturnsExpected(string value)
+ {
+ var linePragma = new CodeLinePragma();
+ linePragma.FileName = value;
+ Assert.Equal(value ?? string.Empty, linePragma.FileName);
+ }
- [Theory]
- [InlineData(-1)]
- [InlineData(0)]
- [InlineData(1)]
- public void LineNumber_Set_Get_ReturnsExpected(int value)
- {
- var linePragma = new CodeLinePragma();
- linePragma.LineNumber = value;
- Assert.Equal(value, linePragma.LineNumber);
- }
- }
+ [Theory]
+ [InlineData(-1)]
+ [InlineData(0)]
+ [InlineData(1)]
+ public void LineNumber_Set_Get_ReturnsExpected(int value)
+ {
+ var linePragma = new CodeLinePragma();
+ linePragma.LineNumber = value;
+ Assert.Equal(value, linePragma.LineNumber);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeMemberEventTests : CodeTypeMemberTestBase<CodeMemberEvent>
- {
- [Fact]
- public void Ctor_Default()
- {
- var memberEvent = new CodeMemberEvent();
- Assert.Equal(typeof(void).FullName, memberEvent.Type.BaseType);
- Assert.Empty(memberEvent.ImplementationTypes);
- Assert.Null(memberEvent.PrivateImplementationType);
- }
+ public class CodeMemberEventTests : CodeTypeMemberTestBase<CodeMemberEvent>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var memberEvent = new CodeMemberEvent();
+ Assert.Equal(typeof(void).FullName, memberEvent.Type.BaseType);
+ Assert.Empty(memberEvent.ImplementationTypes);
+ Assert.Null(memberEvent.PrivateImplementationType);
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Type_Set_Get_ReturnsExpected(CodeTypeReference type)
- {
- var memberEvent = new CodeMemberEvent() { Type = type };
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, memberEvent.Type.BaseType);
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Type_Set_Get_ReturnsExpected(CodeTypeReference type)
+ {
+ var memberEvent = new CodeMemberEvent() { Type = type };
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, memberEvent.Type.BaseType);
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void PrivateImplementationType_Set_Get_ReturnsExpected(CodeTypeReference type)
- {
- var memberEvent = new CodeMemberEvent() { PrivateImplementationType = type };
- Assert.Equal(type, memberEvent.PrivateImplementationType);
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void PrivateImplementationType_Set_Get_ReturnsExpected(CodeTypeReference type)
+ {
+ var memberEvent = new CodeMemberEvent() { PrivateImplementationType = type };
+ Assert.Equal(type, memberEvent.PrivateImplementationType);
+ }
- [Fact]
- public void ImplementationTypes_AddMultiple_ReturnsExpected()
- {
- var memberEvent = new CodeMemberEvent();
+ [Fact]
+ public void ImplementationTypes_AddMultiple_ReturnsExpected()
+ {
+ var memberEvent = new CodeMemberEvent();
- CodeTypeReference type1 = new CodeTypeReference(typeof(int));
- memberEvent.ImplementationTypes.Add(type1);
- Assert.Equal(new CodeTypeReference[] { type1 }, memberEvent.ImplementationTypes.Cast<CodeTypeReference>());
+ CodeTypeReference type1 = new CodeTypeReference(typeof(int));
+ memberEvent.ImplementationTypes.Add(type1);
+ Assert.Equal(new CodeTypeReference[] { type1 }, memberEvent.ImplementationTypes.Cast<CodeTypeReference>());
- CodeTypeReference type2 = new CodeTypeReference(typeof(int));
- memberEvent.ImplementationTypes.Add(type2);
- Assert.Equal(new CodeTypeReference[] { type1, type2 }, memberEvent.ImplementationTypes.Cast<CodeTypeReference>());
- }
- }
+ CodeTypeReference type2 = new CodeTypeReference(typeof(int));
+ memberEvent.ImplementationTypes.Add(type2);
+ Assert.Equal(new CodeTypeReference[] { type1, type2 }, memberEvent.ImplementationTypes.Cast<CodeTypeReference>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeMemberFieldTests : CodeTypeMemberTestBase<CodeMemberField>
- {
- [Fact]
- public void Ctor_Default()
- {
- var field = new CodeMemberField();
- Assert.Equal(typeof(void).FullName, field.Type.BaseType);
- Assert.Null(field.InitExpression);
- }
+ public class CodeMemberFieldTests : CodeTypeMemberTestBase<CodeMemberField>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var field = new CodeMemberField();
+ Assert.Equal(typeof(void).FullName, field.Type.BaseType);
+ Assert.Null(field.InitExpression);
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Ctor_CodeTypeReference_String(CodeTypeReference type)
- {
- var field = new CodeMemberField(type, "name");
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, field.Type.BaseType);
- Assert.Equal("name", field.Name);
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Ctor_CodeTypeReference_String(CodeTypeReference type)
+ {
+ var field = new CodeMemberField(type, "name");
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, field.Type.BaseType);
+ Assert.Equal("name", field.Name);
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Ctor_Type_String(CodeTypeReference type)
- {
- if (type == null)
- {
- return;
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Ctor_Type_String(CodeTypeReference type)
+ {
+ if (type == null)
+ {
+ return;
+ }
- var field = new CodeMemberField(type.BaseType, "name");
- Assert.Equal(type.BaseType, field.Type.BaseType);
- Assert.Equal("name", field.Name);
- }
+ var field = new CodeMemberField(type.BaseType, "name");
+ Assert.Equal(type.BaseType, field.Type.BaseType);
+ Assert.Equal("name", field.Name);
+ }
- [Fact]
- public void Ctor_Type_String_NullType_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeMemberField((Type)null, "name"));
- }
+ [Fact]
+ public void Ctor_Type_String_NullType_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeMemberField((Type)null, "name"));
+ }
- public static IEnumerable<object[]> Ctor_String_String_TestData()
- {
- yield return new object[] { null, null, "System.Void" };
- yield return new object[] { "", "", "System.Void" };
- yield return new object[] { "Int32", "Name", "Int32" };
- }
+ public static IEnumerable<object[]> Ctor_String_String_TestData()
+ {
+ yield return new object[] { null, null, "System.Void" };
+ yield return new object[] { "", "", "System.Void" };
+ yield return new object[] { "Int32", "Name", "Int32" };
+ }
- [Theory]
- [MemberData(nameof(Ctor_String_String_TestData))]
- public void Ctor_String_String(string type, string name, string expectedBaseType)
- {
- var field = new CodeMemberField(type, name);
- Assert.Equal(expectedBaseType, field.Type.BaseType);
- Assert.Equal(name ?? string.Empty, field.Name);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_String_String_TestData))]
+ public void Ctor_String_String(string type, string name, string expectedBaseType)
+ {
+ var field = new CodeMemberField(type, name);
+ Assert.Equal(expectedBaseType, field.Type.BaseType);
+ Assert.Equal(name ?? string.Empty, field.Name);
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Type_Set_Get_ReturnsExpected(CodeTypeReference type)
- {
- var field = new CodeMemberField() { Type = type };
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, field.Type.BaseType);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Type_Set_Get_ReturnsExpected(CodeTypeReference type)
+ {
+ var field = new CodeMemberField() { Type = type };
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, field.Type.BaseType);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeMemberMemberTests : CodeTypeMemberTestBase<CodeMemberMethod>
- {
- [Fact]
- public void Ctor_Default()
- {
- var method = new CodeMemberMethod();
- Assert.Equal(typeof(void).FullName, method.ReturnType.BaseType);
- Assert.Empty(method.Statements);
- Assert.Empty(method.Parameters);
-
- Assert.Empty(method.ImplementationTypes);
- Assert.Null(method.PrivateImplementationType);
-
- Assert.Empty(method.ReturnTypeCustomAttributes);
- Assert.Empty(method.TypeParameters);
- }
-
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void ReturnType_Set_Get_ReturnsExpected(CodeTypeReference type)
- {
- var method = new CodeMemberMethod() { ReturnType = type };
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, method.ReturnType.BaseType);
- }
-
- [Fact]
- public void Statements_AddMultiple_ReturnsExpected()
- {
- var method = new CodeMemberMethod();
-
- CodeStatement statement1 = new CodeCommentStatement("Value1");
- method.Statements.Add(statement1);
- Assert.Equal(new CodeStatement[] { statement1 }, method.Statements.Cast<CodeStatement>());
-
- CodeStatement statement2 = new CodeCommentStatement("Value2");
- method.Statements.Add(statement2);
- Assert.Equal(new CodeStatement[] { statement1, statement2 }, method.Statements.Cast<CodeStatement>());
- }
-
- [Fact]
- public void Statements_Get_CallsPopulateStatementsOnce()
- {
- var method = new CodeMemberMethod();
- bool calledPopulateStatements = false;
- method.PopulateStatements += (object sender, EventArgs args) =>
- {
- calledPopulateStatements = true;
- Assert.Same(method, sender);
- Assert.Equal(EventArgs.Empty, args);
- };
-
- CodeStatement statement = new CodeMethodReturnStatement(new CodePrimitiveExpression("Value2"));
- method.Statements.Add(statement);
- Assert.Equal(new CodeStatement[] { statement }, method.Statements.Cast<CodeStatement>());
- Assert.True(calledPopulateStatements);
-
- // Only calls PopulateStatements once
- calledPopulateStatements = false;
- method.Statements.Add(statement);
- Assert.False(calledPopulateStatements);
- }
-
- [Fact]
- public void Parameters_AddMultiple_ReturnsExpected()
- {
- var method = new CodeMemberMethod();
-
- CodeParameterDeclarationExpression parameter1 = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name1");
- method.Parameters.Add(parameter1);
- Assert.Equal(new CodeParameterDeclarationExpression[] { parameter1 }, method.Parameters.Cast<CodeParameterDeclarationExpression>());
-
- CodeParameterDeclarationExpression parameter2 = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name2");
- method.Parameters.Add(parameter2);
- Assert.Equal(new CodeParameterDeclarationExpression[] { parameter1, parameter2 }, method.Parameters.Cast<CodeParameterDeclarationExpression>());
- }
-
- [Fact]
- public void Parameters_Get_CallsPopulateParametersOnce()
- {
- var method = new CodeMemberMethod();
- bool calledPopulateParameters = false;
- method.PopulateParameters += (object sender, EventArgs args) =>
- {
- calledPopulateParameters = true;
- Assert.Same(method, sender);
- Assert.Equal(EventArgs.Empty, args);
- };
-
- CodeParameterDeclarationExpression parameter = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name1");
- method.Parameters.Add(parameter);
- Assert.Equal(new CodeParameterDeclarationExpression[] { parameter }, method.Parameters.Cast<CodeParameterDeclarationExpression>());
- Assert.True(calledPopulateParameters);
-
- // Only calls PopulateParameters once
- calledPopulateParameters = false;
- method.Parameters.Add(parameter);
- Assert.False(calledPopulateParameters);
- }
-
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void PrivateImplementationType_Set_Get_ReturnsExpected(CodeTypeReference type)
- {
- var method = new CodeMemberMethod() { PrivateImplementationType = type };
- Assert.Equal(type, method.PrivateImplementationType);
- }
-
- [Fact]
- public void ImplementationTypes_AddMultiple_ReturnsExpected()
- {
- var method = new CodeMemberMethod();
-
- CodeTypeReference type1 = new CodeTypeReference(typeof(int));
- method.ImplementationTypes.Add(type1);
- Assert.Equal(new CodeTypeReference[] { type1 }, method.ImplementationTypes.Cast<CodeTypeReference>());
-
- CodeTypeReference type2 = new CodeTypeReference(typeof(int));
- method.ImplementationTypes.Add(type2);
- Assert.Equal(new CodeTypeReference[] { type1, type2 }, method.ImplementationTypes.Cast<CodeTypeReference>());
- }
-
- [Fact]
- public void ImplementationTypes_Get_CallsPopulateImplementationTypesOnce()
- {
- var method = new CodeMemberMethod();
- bool calledImplementationTypes = false;
- method.PopulateImplementationTypes += (object sender, EventArgs args) =>
- {
- calledImplementationTypes = true;
- Assert.Same(method, sender);
- Assert.Equal(EventArgs.Empty, args);
- };
-
- CodeTypeReference type = new CodeTypeReference(typeof(int));
- method.ImplementationTypes.Add(type);
- Assert.Equal(new CodeTypeReference[] { type }, method.ImplementationTypes.Cast<CodeTypeReference>());
- Assert.True(calledImplementationTypes);
-
- // Only calls PopulateImplementationTypes once
- calledImplementationTypes = false;
- method.ImplementationTypes.Add(type);
- Assert.False(calledImplementationTypes);
- }
-
- [Fact]
- public void ReturnTypeCustomAttributes_AddMultiple_ReturnsExpected()
- {
- var method = new CodeMemberMethod();
-
- CodeAttributeDeclaration attribute1 = new CodeAttributeDeclaration("Name1");
- method.ReturnTypeCustomAttributes.Add(attribute1);
- Assert.Equal(new CodeAttributeDeclaration[] { attribute1 }, method.ReturnTypeCustomAttributes.Cast<CodeAttributeDeclaration>());
-
- CodeAttributeDeclaration attribute2 = new CodeAttributeDeclaration("Name2");
- method.ReturnTypeCustomAttributes.Add(attribute2);
- Assert.Equal(new CodeAttributeDeclaration[] { attribute1, attribute2 }, method.ReturnTypeCustomAttributes.Cast<CodeAttributeDeclaration>());
- }
-
- [Fact]
- public void TypeParameters_AddMultiple_ReturnsExpected()
- {
- var method = new CodeMemberMethod();
-
- CodeTypeParameter parameter1 = new CodeTypeParameter("Name1");
- method.TypeParameters.Add(parameter1);
- Assert.Equal(new CodeTypeParameter[] { parameter1 }, method.TypeParameters.Cast<CodeTypeParameter>());
-
- CodeTypeParameter parameter2 = new CodeTypeParameter("Name2");
- method.TypeParameters.Add(parameter2);
- Assert.Equal(new CodeTypeParameter[] { parameter1, parameter2 }, method.TypeParameters.Cast<CodeTypeParameter>());
- }
- }
+ public class CodeMemberMemberTests : CodeTypeMemberTestBase<CodeMemberMethod>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var method = new CodeMemberMethod();
+ Assert.Equal(typeof(void).FullName, method.ReturnType.BaseType);
+ Assert.Empty(method.Statements);
+ Assert.Empty(method.Parameters);
+
+ Assert.Empty(method.ImplementationTypes);
+ Assert.Null(method.PrivateImplementationType);
+
+ Assert.Empty(method.ReturnTypeCustomAttributes);
+ Assert.Empty(method.TypeParameters);
+ }
+
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void ReturnType_Set_Get_ReturnsExpected(CodeTypeReference type)
+ {
+ var method = new CodeMemberMethod() { ReturnType = type };
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, method.ReturnType.BaseType);
+ }
+
+ [Fact]
+ public void Statements_AddMultiple_ReturnsExpected()
+ {
+ var method = new CodeMemberMethod();
+
+ CodeStatement statement1 = new CodeCommentStatement("Value1");
+ method.Statements.Add(statement1);
+ Assert.Equal(new CodeStatement[] { statement1 }, method.Statements.Cast<CodeStatement>());
+
+ CodeStatement statement2 = new CodeCommentStatement("Value2");
+ method.Statements.Add(statement2);
+ Assert.Equal(new CodeStatement[] { statement1, statement2 }, method.Statements.Cast<CodeStatement>());
+ }
+
+ [Fact]
+ public void Statements_Get_CallsPopulateStatementsOnce()
+ {
+ var method = new CodeMemberMethod();
+ bool calledPopulateStatements = false;
+ method.PopulateStatements += (object sender, EventArgs args) =>
+ {
+ calledPopulateStatements = true;
+ Assert.Same(method, sender);
+ Assert.Equal(EventArgs.Empty, args);
+ };
+
+ CodeStatement statement = new CodeMethodReturnStatement(new CodePrimitiveExpression("Value2"));
+ method.Statements.Add(statement);
+ Assert.Equal(new CodeStatement[] { statement }, method.Statements.Cast<CodeStatement>());
+ Assert.True(calledPopulateStatements);
+
+ // Only calls PopulateStatements once
+ calledPopulateStatements = false;
+ method.Statements.Add(statement);
+ Assert.False(calledPopulateStatements);
+ }
+
+ [Fact]
+ public void Parameters_AddMultiple_ReturnsExpected()
+ {
+ var method = new CodeMemberMethod();
+
+ CodeParameterDeclarationExpression parameter1 = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name1");
+ method.Parameters.Add(parameter1);
+ Assert.Equal(new CodeParameterDeclarationExpression[] { parameter1 }, method.Parameters.Cast<CodeParameterDeclarationExpression>());
+
+ CodeParameterDeclarationExpression parameter2 = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name2");
+ method.Parameters.Add(parameter2);
+ Assert.Equal(new CodeParameterDeclarationExpression[] { parameter1, parameter2 }, method.Parameters.Cast<CodeParameterDeclarationExpression>());
+ }
+
+ [Fact]
+ public void Parameters_Get_CallsPopulateParametersOnce()
+ {
+ var method = new CodeMemberMethod();
+ bool calledPopulateParameters = false;
+ method.PopulateParameters += (object sender, EventArgs args) =>
+ {
+ calledPopulateParameters = true;
+ Assert.Same(method, sender);
+ Assert.Equal(EventArgs.Empty, args);
+ };
+
+ CodeParameterDeclarationExpression parameter = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name1");
+ method.Parameters.Add(parameter);
+ Assert.Equal(new CodeParameterDeclarationExpression[] { parameter }, method.Parameters.Cast<CodeParameterDeclarationExpression>());
+ Assert.True(calledPopulateParameters);
+
+ // Only calls PopulateParameters once
+ calledPopulateParameters = false;
+ method.Parameters.Add(parameter);
+ Assert.False(calledPopulateParameters);
+ }
+
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void PrivateImplementationType_Set_Get_ReturnsExpected(CodeTypeReference type)
+ {
+ var method = new CodeMemberMethod() { PrivateImplementationType = type };
+ Assert.Equal(type, method.PrivateImplementationType);
+ }
+
+ [Fact]
+ public void ImplementationTypes_AddMultiple_ReturnsExpected()
+ {
+ var method = new CodeMemberMethod();
+
+ CodeTypeReference type1 = new CodeTypeReference(typeof(int));
+ method.ImplementationTypes.Add(type1);
+ Assert.Equal(new CodeTypeReference[] { type1 }, method.ImplementationTypes.Cast<CodeTypeReference>());
+
+ CodeTypeReference type2 = new CodeTypeReference(typeof(int));
+ method.ImplementationTypes.Add(type2);
+ Assert.Equal(new CodeTypeReference[] { type1, type2 }, method.ImplementationTypes.Cast<CodeTypeReference>());
+ }
+
+ [Fact]
+ public void ImplementationTypes_Get_CallsPopulateImplementationTypesOnce()
+ {
+ var method = new CodeMemberMethod();
+ bool calledImplementationTypes = false;
+ method.PopulateImplementationTypes += (object sender, EventArgs args) =>
+ {
+ calledImplementationTypes = true;
+ Assert.Same(method, sender);
+ Assert.Equal(EventArgs.Empty, args);
+ };
+
+ CodeTypeReference type = new CodeTypeReference(typeof(int));
+ method.ImplementationTypes.Add(type);
+ Assert.Equal(new CodeTypeReference[] { type }, method.ImplementationTypes.Cast<CodeTypeReference>());
+ Assert.True(calledImplementationTypes);
+
+ // Only calls PopulateImplementationTypes once
+ calledImplementationTypes = false;
+ method.ImplementationTypes.Add(type);
+ Assert.False(calledImplementationTypes);
+ }
+
+ [Fact]
+ public void ReturnTypeCustomAttributes_AddMultiple_ReturnsExpected()
+ {
+ var method = new CodeMemberMethod();
+
+ CodeAttributeDeclaration attribute1 = new CodeAttributeDeclaration("Name1");
+ method.ReturnTypeCustomAttributes.Add(attribute1);
+ Assert.Equal(new CodeAttributeDeclaration[] { attribute1 }, method.ReturnTypeCustomAttributes.Cast<CodeAttributeDeclaration>());
+
+ CodeAttributeDeclaration attribute2 = new CodeAttributeDeclaration("Name2");
+ method.ReturnTypeCustomAttributes.Add(attribute2);
+ Assert.Equal(new CodeAttributeDeclaration[] { attribute1, attribute2 }, method.ReturnTypeCustomAttributes.Cast<CodeAttributeDeclaration>());
+ }
+
+ [Fact]
+ public void TypeParameters_AddMultiple_ReturnsExpected()
+ {
+ var method = new CodeMemberMethod();
+
+ CodeTypeParameter parameter1 = new CodeTypeParameter("Name1");
+ method.TypeParameters.Add(parameter1);
+ Assert.Equal(new CodeTypeParameter[] { parameter1 }, method.TypeParameters.Cast<CodeTypeParameter>());
+
+ CodeTypeParameter parameter2 = new CodeTypeParameter("Name2");
+ method.TypeParameters.Add(parameter2);
+ Assert.Equal(new CodeTypeParameter[] { parameter1, parameter2 }, method.TypeParameters.Cast<CodeTypeParameter>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeMemberPropertyTests : CodeTypeMemberTestBase<CodeMemberProperty>
- {
- [Fact]
- public void Ctor_Default()
- {
- var property = new CodeMemberProperty();
- Assert.Equal(typeof(void).FullName, property.Type.BaseType);
- Assert.Empty(property.ImplementationTypes);
- Assert.Null(property.PrivateImplementationType);
-
- Assert.False(property.HasGet);
- Assert.Empty(property.GetStatements);
-
- Assert.False(property.HasSet);
- Assert.Empty(property.SetStatements);
-
- Assert.Empty(property.Parameters);
- }
-
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Type_Set_Get_ReturnsExpected(CodeTypeReference type)
- {
- var property = new CodeMemberProperty() { Type = type };
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, property.Type.BaseType);
- }
-
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void PrivateImplementationType_Set_Get_ReturnsExpected(CodeTypeReference type)
- {
- var property = new CodeMemberProperty() { PrivateImplementationType = type };
- Assert.Equal(type, property.PrivateImplementationType);
- }
-
- [Fact]
- public void HasGet_SetTrue_ReturnsTrue()
- {
- var property = new CodeMemberProperty() { HasGet = true };
- Assert.True(property.HasGet);
- }
-
- [Fact]
- public void HasGet_AddedGetStatements_ReturnsTrue()
- {
- var property = new CodeMemberProperty();
-
- CodeStatement statement1 = new CodeMethodReturnStatement(new CodePrimitiveExpression("value1"));
- property.GetStatements.Add(statement1);
- Assert.True(property.HasGet);
- Assert.Equal(new CodeStatement[] { statement1 }, property.GetStatements.Cast<CodeStatement>());
-
- CodeStatement statement2 = new CodeMethodReturnStatement(new CodePrimitiveExpression("value2"));
- property.GetStatements.Add(statement2);
- Assert.True(property.HasGet);
-
- Assert.Equal(new CodeStatement[] { statement1, statement2 }, property.GetStatements.Cast<CodeStatement>());
- }
-
- [Fact]
- public void HasGet_SetFalse_RemovesAllGetStatements()
- {
- var property = new CodeMemberProperty();
- property.HasGet = false;
- Assert.False(property.HasGet);
-
- property.GetStatements.Add(new CodeMethodReturnStatement(new CodePrimitiveExpression("value")));
-
- property.HasGet = false;
- Assert.False(property.HasGet);
- Assert.Empty(property.GetStatements);
- }
-
- [Fact]
- public void HasSet_SetTrue_ReturnsTrue()
- {
- var property = new CodeMemberProperty() { HasSet = true };
- Assert.True(property.HasSet);
- }
-
- [Fact]
- public void HasSet_AddedSetStatements_ReturnsTrue()
- {
- var property = new CodeMemberProperty();
-
- CodeStatement statement1 = new CodeMethodReturnStatement(new CodePrimitiveExpression("value1"));
- property.SetStatements.Add(statement1);
- Assert.True(property.HasSet);
- Assert.Equal(new CodeStatement[] { statement1 }, property.SetStatements.Cast<CodeStatement>());
-
- CodeStatement statement2 = new CodeMethodReturnStatement(new CodePrimitiveExpression("value2"));
- property.SetStatements.Add(statement2);
- Assert.True(property.HasSet);
-
- Assert.Equal(new CodeStatement[] { statement1, statement2 }, property.SetStatements.Cast<CodeStatement>());
- }
-
- [Fact]
- public void HasSet_SetFalse_RemovesAllSetStatements()
- {
- var property = new CodeMemberProperty();
- property.HasSet = false;
- Assert.False(property.HasSet);
-
- property.SetStatements.Add(new CodeMethodReturnStatement(new CodePrimitiveExpression("value")));
- property.HasSet = false;
- Assert.False(property.HasSet);
- Assert.Empty(property.SetStatements);
- }
-
- [Fact]
- public void Parameters_AddMultiple_ReturnsExpected()
- {
- var property = new CodeMemberProperty();
-
- CodeParameterDeclarationExpression parameter1 = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name1");
- property.Parameters.Add(parameter1);
- Assert.Equal(new CodeParameterDeclarationExpression[] { parameter1 }, property.Parameters.Cast<CodeParameterDeclarationExpression>());
-
- CodeParameterDeclarationExpression parameter2 = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name2");
- property.Parameters.Add(parameter2);
- Assert.Equal(new CodeParameterDeclarationExpression[] { parameter1, parameter2 }, property.Parameters.Cast<CodeParameterDeclarationExpression>());
- }
-
- [Fact]
- public void ImplementationTypes_AddMultiple_ReturnsExpected()
- {
- var property = new CodeMemberProperty();
-
- CodeTypeReference type1 = new CodeTypeReference(typeof(int));
- property.ImplementationTypes.Add(type1);
- Assert.Equal(new CodeTypeReference[] { type1 }, property.ImplementationTypes.Cast<CodeTypeReference>());
-
- CodeTypeReference type2 = new CodeTypeReference(typeof(int));
- property.ImplementationTypes.Add(type2);
- Assert.Equal(new CodeTypeReference[] { type1, type2 }, property.ImplementationTypes.Cast<CodeTypeReference>());
- }
- }
+ public class CodeMemberPropertyTests : CodeTypeMemberTestBase<CodeMemberProperty>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var property = new CodeMemberProperty();
+ Assert.Equal(typeof(void).FullName, property.Type.BaseType);
+ Assert.Empty(property.ImplementationTypes);
+ Assert.Null(property.PrivateImplementationType);
+
+ Assert.False(property.HasGet);
+ Assert.Empty(property.GetStatements);
+
+ Assert.False(property.HasSet);
+ Assert.Empty(property.SetStatements);
+
+ Assert.Empty(property.Parameters);
+ }
+
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Type_Set_Get_ReturnsExpected(CodeTypeReference type)
+ {
+ var property = new CodeMemberProperty() { Type = type };
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, property.Type.BaseType);
+ }
+
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void PrivateImplementationType_Set_Get_ReturnsExpected(CodeTypeReference type)
+ {
+ var property = new CodeMemberProperty() { PrivateImplementationType = type };
+ Assert.Equal(type, property.PrivateImplementationType);
+ }
+
+ [Fact]
+ public void HasGet_SetTrue_ReturnsTrue()
+ {
+ var property = new CodeMemberProperty() { HasGet = true };
+ Assert.True(property.HasGet);
+ }
+
+ [Fact]
+ public void HasGet_AddedGetStatements_ReturnsTrue()
+ {
+ var property = new CodeMemberProperty();
+
+ CodeStatement statement1 = new CodeMethodReturnStatement(new CodePrimitiveExpression("value1"));
+ property.GetStatements.Add(statement1);
+ Assert.True(property.HasGet);
+ Assert.Equal(new CodeStatement[] { statement1 }, property.GetStatements.Cast<CodeStatement>());
+
+ CodeStatement statement2 = new CodeMethodReturnStatement(new CodePrimitiveExpression("value2"));
+ property.GetStatements.Add(statement2);
+ Assert.True(property.HasGet);
+
+ Assert.Equal(new CodeStatement[] { statement1, statement2 }, property.GetStatements.Cast<CodeStatement>());
+ }
+
+ [Fact]
+ public void HasGet_SetFalse_RemovesAllGetStatements()
+ {
+ var property = new CodeMemberProperty();
+ property.HasGet = false;
+ Assert.False(property.HasGet);
+
+ property.GetStatements.Add(new CodeMethodReturnStatement(new CodePrimitiveExpression("value")));
+
+ property.HasGet = false;
+ Assert.False(property.HasGet);
+ Assert.Empty(property.GetStatements);
+ }
+
+ [Fact]
+ public void HasSet_SetTrue_ReturnsTrue()
+ {
+ var property = new CodeMemberProperty() { HasSet = true };
+ Assert.True(property.HasSet);
+ }
+
+ [Fact]
+ public void HasSet_AddedSetStatements_ReturnsTrue()
+ {
+ var property = new CodeMemberProperty();
+
+ CodeStatement statement1 = new CodeMethodReturnStatement(new CodePrimitiveExpression("value1"));
+ property.SetStatements.Add(statement1);
+ Assert.True(property.HasSet);
+ Assert.Equal(new CodeStatement[] { statement1 }, property.SetStatements.Cast<CodeStatement>());
+
+ CodeStatement statement2 = new CodeMethodReturnStatement(new CodePrimitiveExpression("value2"));
+ property.SetStatements.Add(statement2);
+ Assert.True(property.HasSet);
+
+ Assert.Equal(new CodeStatement[] { statement1, statement2 }, property.SetStatements.Cast<CodeStatement>());
+ }
+
+ [Fact]
+ public void HasSet_SetFalse_RemovesAllSetStatements()
+ {
+ var property = new CodeMemberProperty();
+ property.HasSet = false;
+ Assert.False(property.HasSet);
+
+ property.SetStatements.Add(new CodeMethodReturnStatement(new CodePrimitiveExpression("value")));
+ property.HasSet = false;
+ Assert.False(property.HasSet);
+ Assert.Empty(property.SetStatements);
+ }
+
+ [Fact]
+ public void Parameters_AddMultiple_ReturnsExpected()
+ {
+ var property = new CodeMemberProperty();
+
+ CodeParameterDeclarationExpression parameter1 = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name1");
+ property.Parameters.Add(parameter1);
+ Assert.Equal(new CodeParameterDeclarationExpression[] { parameter1 }, property.Parameters.Cast<CodeParameterDeclarationExpression>());
+
+ CodeParameterDeclarationExpression parameter2 = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name2");
+ property.Parameters.Add(parameter2);
+ Assert.Equal(new CodeParameterDeclarationExpression[] { parameter1, parameter2 }, property.Parameters.Cast<CodeParameterDeclarationExpression>());
+ }
+
+ [Fact]
+ public void ImplementationTypes_AddMultiple_ReturnsExpected()
+ {
+ var property = new CodeMemberProperty();
+
+ CodeTypeReference type1 = new CodeTypeReference(typeof(int));
+ property.ImplementationTypes.Add(type1);
+ Assert.Equal(new CodeTypeReference[] { type1 }, property.ImplementationTypes.Cast<CodeTypeReference>());
+
+ CodeTypeReference type2 = new CodeTypeReference(typeof(int));
+ property.ImplementationTypes.Add(type2);
+ Assert.Equal(new CodeTypeReference[] { type1, type2 }, property.ImplementationTypes.Cast<CodeTypeReference>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeMethodInvokeExpressionTests : CodeObjectTestBase<CodeMethodInvokeExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var methodInvoke = new CodeMethodInvokeExpression();
- Assert.Null(methodInvoke.Method.TargetObject);
- Assert.Empty(methodInvoke.Method.MethodName);
- Assert.Empty(methodInvoke.Parameters);
- }
+ public class CodeMethodInvokeExpressionTests : CodeObjectTestBase<CodeMethodInvokeExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var methodInvoke = new CodeMethodInvokeExpression();
+ Assert.Null(methodInvoke.Method.TargetObject);
+ Assert.Empty(methodInvoke.Method.MethodName);
+ Assert.Empty(methodInvoke.Parameters);
+ }
- public static IEnumerable<object[]> Ctor_CodeMethodReferenceExpression_ParamsCodeExpression_TestData()
- {
- yield return new object[] { null, new CodeExpression[0] };
- yield return new object[] { new CodeMethodReferenceExpression(), new CodeExpression[0] };
- yield return new object[] { new CodeMethodReferenceExpression(new CodePrimitiveExpression("Value"), "Length"), new CodeExpression[] { new CodePrimitiveExpression("Value") } };
- }
+ public static IEnumerable<object[]> Ctor_CodeMethodReferenceExpression_ParamsCodeExpression_TestData()
+ {
+ yield return new object[] { null, new CodeExpression[0] };
+ yield return new object[] { new CodeMethodReferenceExpression(), new CodeExpression[0] };
+ yield return new object[] { new CodeMethodReferenceExpression(new CodePrimitiveExpression("Value"), "Length"), new CodeExpression[] { new CodePrimitiveExpression("Value") } };
+ }
- [Theory]
- [MemberData(nameof(Ctor_CodeMethodReferenceExpression_ParamsCodeExpression_TestData))]
- public void Ctor(CodeMethodReferenceExpression method, CodeExpression[] parameters)
- {
- var methodInvoke = new CodeMethodInvokeExpression(method, parameters);
- Assert.Equal((method ?? new CodeMethodReferenceExpression()).TargetObject, methodInvoke.Method.TargetObject);
- Assert.Equal((method ?? new CodeMethodReferenceExpression()).MethodName, methodInvoke.Method.MethodName);
- Assert.Equal(parameters, methodInvoke.Parameters.Cast<CodeExpression>());
- }
+ [Theory]
+ [MemberData(nameof(Ctor_CodeMethodReferenceExpression_ParamsCodeExpression_TestData))]
+ public void Ctor(CodeMethodReferenceExpression method, CodeExpression[] parameters)
+ {
+ var methodInvoke = new CodeMethodInvokeExpression(method, parameters);
+ Assert.Equal((method ?? new CodeMethodReferenceExpression()).TargetObject, methodInvoke.Method.TargetObject);
+ Assert.Equal((method ?? new CodeMethodReferenceExpression()).MethodName, methodInvoke.Method.MethodName);
+ Assert.Equal(parameters, methodInvoke.Parameters.Cast<CodeExpression>());
+ }
- public static IEnumerable<object[]> Ctor_CodeExpression_String_ParamsCodeExpression_TestData()
- {
- yield return new object[] { null, null, new CodeExpression[0] };
- yield return new object[] { new CodeExpression(), "", new CodeExpression[0] };
- yield return new object[] { new CodePrimitiveExpression("Value"), "Length", new CodeExpression[] { new CodePrimitiveExpression("Value") } };
- }
+ public static IEnumerable<object[]> Ctor_CodeExpression_String_ParamsCodeExpression_TestData()
+ {
+ yield return new object[] { null, null, new CodeExpression[0] };
+ yield return new object[] { new CodeExpression(), "", new CodeExpression[0] };
+ yield return new object[] { new CodePrimitiveExpression("Value"), "Length", new CodeExpression[] { new CodePrimitiveExpression("Value") } };
+ }
- [Theory]
- [MemberData(nameof(Ctor_CodeExpression_String_ParamsCodeExpression_TestData))]
- public void Ctor(CodeExpression targetObject, string methodName, CodeExpression[] parameters)
- {
- var methodInvoke = new CodeMethodInvokeExpression(targetObject, methodName, parameters);
- Assert.Equal(targetObject, methodInvoke.Method.TargetObject);
- Assert.Equal(methodName ?? string.Empty, methodInvoke.Method.MethodName);
- Assert.Equal(parameters, methodInvoke.Parameters.Cast<CodeExpression>());
- }
+ [Theory]
+ [MemberData(nameof(Ctor_CodeExpression_String_ParamsCodeExpression_TestData))]
+ public void Ctor(CodeExpression targetObject, string methodName, CodeExpression[] parameters)
+ {
+ var methodInvoke = new CodeMethodInvokeExpression(targetObject, methodName, parameters);
+ Assert.Equal(targetObject, methodInvoke.Method.TargetObject);
+ Assert.Equal(methodName ?? string.Empty, methodInvoke.Method.MethodName);
+ Assert.Equal(parameters, methodInvoke.Parameters.Cast<CodeExpression>());
+ }
- [Fact]
- public void Ctor_NullParameters_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(), null));
- }
+ [Fact]
+ public void Ctor_NullParameters_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(), null));
+ }
- [Fact]
- public void Ctor_NullObjectInParameters_ThrowsArgumentNullException()
- {
- CodeExpression[] parameters = new CodeExpression[] { null };
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(), parameters));
- }
+ [Fact]
+ public void Ctor_NullObjectInParameters_ThrowsArgumentNullException()
+ {
+ CodeExpression[] parameters = new CodeExpression[] { null };
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(), parameters));
+ }
- public static IEnumerable<object[]> CodeMethodReferenceExpression_TestData()
- {
- yield return new object[] { null };
- yield return new object[] { new CodeMethodReferenceExpression() };
- yield return new object[] { new CodeMethodReferenceExpression(new CodePrimitiveExpression("Value"), "Length") };
- }
+ public static IEnumerable<object[]> CodeMethodReferenceExpression_TestData()
+ {
+ yield return new object[] { null };
+ yield return new object[] { new CodeMethodReferenceExpression() };
+ yield return new object[] { new CodeMethodReferenceExpression(new CodePrimitiveExpression("Value"), "Length") };
+ }
- [Theory]
- [MemberData(nameof(CodeMethodReferenceExpression_TestData))]
- public void Method_Set_Get_ReturnsExpected(CodeMethodReferenceExpression value)
- {
- var methodInvoke = new CodeMethodInvokeExpression();
- methodInvoke.Method = value;
- Assert.Equal(value?.MethodName ?? string.Empty, methodInvoke.Method.MethodName);
- Assert.Equal(value?.TargetObject, methodInvoke.Method.TargetObject);
- }
+ [Theory]
+ [MemberData(nameof(CodeMethodReferenceExpression_TestData))]
+ public void Method_Set_Get_ReturnsExpected(CodeMethodReferenceExpression value)
+ {
+ var methodInvoke = new CodeMethodInvokeExpression();
+ methodInvoke.Method = value;
+ Assert.Equal(value?.MethodName ?? string.Empty, methodInvoke.Method.MethodName);
+ Assert.Equal(value?.TargetObject, methodInvoke.Method.TargetObject);
+ }
- [Fact]
- public void Parameters_AddMultiple_ReturnsExpected()
- {
- var methodInvoke = new CodeMethodInvokeExpression();
+ [Fact]
+ public void Parameters_AddMultiple_ReturnsExpected()
+ {
+ var methodInvoke = new CodeMethodInvokeExpression();
- CodeExpression expression1 = new CodePrimitiveExpression("Value1");
- methodInvoke.Parameters.Add(expression1);
- Assert.Equal(new CodeExpression[] { expression1 }, methodInvoke.Parameters.Cast<CodeExpression>());
+ CodeExpression expression1 = new CodePrimitiveExpression("Value1");
+ methodInvoke.Parameters.Add(expression1);
+ Assert.Equal(new CodeExpression[] { expression1 }, methodInvoke.Parameters.Cast<CodeExpression>());
- CodeExpression expression2 = new CodePrimitiveExpression("Value2");
- methodInvoke.Parameters.Add(expression2);
- Assert.Equal(new CodeExpression[] { expression1, expression2 }, methodInvoke.Parameters.Cast<CodeExpression>());
- }
- }
+ CodeExpression expression2 = new CodePrimitiveExpression("Value2");
+ methodInvoke.Parameters.Add(expression2);
+ Assert.Equal(new CodeExpression[] { expression1, expression2 }, methodInvoke.Parameters.Cast<CodeExpression>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeMethodReferenceExpressionTests : CodeObjectTestBase<CodeMethodReferenceExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var methodReference = new CodeMethodReferenceExpression();
- Assert.Empty(methodReference.MethodName);
- Assert.Null(methodReference.TargetObject);
- Assert.Empty(methodReference.TypeArguments);
- }
+ public class CodeMethodReferenceExpressionTests : CodeObjectTestBase<CodeMethodReferenceExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var methodReference = new CodeMethodReferenceExpression();
+ Assert.Empty(methodReference.MethodName);
+ Assert.Null(methodReference.TargetObject);
+ Assert.Empty(methodReference.TypeArguments);
+ }
- public static IEnumerable<object[]> Ctor_CodeExpression_String_TestData()
- {
- yield return new object[] { null, null };
- yield return new object[] { new CodePrimitiveExpression(), "" };
- yield return new object[] { new CodePrimitiveExpression("Value"), "Length" };
- }
+ public static IEnumerable<object[]> Ctor_CodeExpression_String_TestData()
+ {
+ yield return new object[] { null, null };
+ yield return new object[] { new CodePrimitiveExpression(), "" };
+ yield return new object[] { new CodePrimitiveExpression("Value"), "Length" };
+ }
- [Theory]
- [MemberData(nameof(Ctor_CodeExpression_String_TestData))]
- public void Ctor(CodeExpression targetObject, string methodName)
- {
- var methodReference = new CodeMethodReferenceExpression(targetObject, methodName);
- Assert.Equal(targetObject, methodReference.TargetObject);
- Assert.Equal(methodName ?? string.Empty, methodReference.MethodName);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_CodeExpression_String_TestData))]
+ public void Ctor(CodeExpression targetObject, string methodName)
+ {
+ var methodReference = new CodeMethodReferenceExpression(targetObject, methodName);
+ Assert.Equal(targetObject, methodReference.TargetObject);
+ Assert.Equal(methodName ?? string.Empty, methodReference.MethodName);
+ }
- public static IEnumerable<object[]> Ctor_CodeExpression_String_ParamsCodeExpression_TestData()
- {
- yield return new object[] { null, null, null };
- yield return new object[] { new CodePrimitiveExpression(), "", new CodeTypeReference[0] };
- yield return new object[] { new CodePrimitiveExpression("Value"), "Length", new CodeTypeReference[] { new CodeTypeReference(typeof(void)) } };
- }
+ public static IEnumerable<object[]> Ctor_CodeExpression_String_ParamsCodeExpression_TestData()
+ {
+ yield return new object[] { null, null, null };
+ yield return new object[] { new CodePrimitiveExpression(), "", new CodeTypeReference[0] };
+ yield return new object[] { new CodePrimitiveExpression("Value"), "Length", new CodeTypeReference[] { new CodeTypeReference(typeof(void)) } };
+ }
- [Theory]
- [MemberData(nameof(Ctor_CodeExpression_String_ParamsCodeExpression_TestData))]
- public void Ctor(CodeExpression targetObject, string methodName, CodeTypeReference[] typeArguments)
- {
- var methodReference = new CodeMethodReferenceExpression(targetObject, methodName, typeArguments);
- Assert.Equal(targetObject, methodReference.TargetObject);
- Assert.Equal(methodName ?? string.Empty, methodReference.MethodName);
- Assert.Equal(typeArguments ?? new CodeTypeReference[0], methodReference.TypeArguments.Cast<CodeTypeReference>());
- }
+ [Theory]
+ [MemberData(nameof(Ctor_CodeExpression_String_ParamsCodeExpression_TestData))]
+ public void Ctor(CodeExpression targetObject, string methodName, CodeTypeReference[] typeArguments)
+ {
+ var methodReference = new CodeMethodReferenceExpression(targetObject, methodName, typeArguments);
+ Assert.Equal(targetObject, methodReference.TargetObject);
+ Assert.Equal(methodName ?? string.Empty, methodReference.MethodName);
+ Assert.Equal(typeArguments ?? new CodeTypeReference[0], methodReference.TypeArguments.Cast<CodeTypeReference>());
+ }
- [Fact]
- public void Ctor_NullObjectInParameters_ThrowsArgumentNullException()
- {
- CodeTypeReference[] parameters = new CodeTypeReference[] { null };
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeMethodReferenceExpression(new CodePrimitiveExpression(), "", parameters));
- }
+ [Fact]
+ public void Ctor_NullObjectInParameters_ThrowsArgumentNullException()
+ {
+ CodeTypeReference[] parameters = new CodeTypeReference[] { null };
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeMethodReferenceExpression(new CodePrimitiveExpression(), "", parameters));
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var methodReference = new CodeMethodReferenceExpression();
- methodReference.TargetObject = value;
- Assert.Equal(value, methodReference.TargetObject);
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var methodReference = new CodeMethodReferenceExpression();
+ methodReference.TargetObject = value;
+ Assert.Equal(value, methodReference.TargetObject);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void MethodName_Set_Get_ReturnsExpected(string value)
- {
- var methodReference = new CodeMethodReferenceExpression();
- methodReference.MethodName = value;
- Assert.Equal(value ?? string.Empty, methodReference.MethodName);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void MethodName_Set_Get_ReturnsExpected(string value)
+ {
+ var methodReference = new CodeMethodReferenceExpression();
+ methodReference.MethodName = value;
+ Assert.Equal(value ?? string.Empty, methodReference.MethodName);
+ }
- [Fact]
- public void TypeArguments_AddMultiple_ReturnsExpected()
- {
- var methodReference = new CodeMethodReferenceExpression();
+ [Fact]
+ public void TypeArguments_AddMultiple_ReturnsExpected()
+ {
+ var methodReference = new CodeMethodReferenceExpression();
- CodeTypeReference type1 = new CodeTypeReference(typeof(int));
- methodReference.TypeArguments.Add(type1);
- Assert.Equal(new CodeTypeReference[] { type1 }, methodReference.TypeArguments.Cast<CodeTypeReference>());
+ CodeTypeReference type1 = new CodeTypeReference(typeof(int));
+ methodReference.TypeArguments.Add(type1);
+ Assert.Equal(new CodeTypeReference[] { type1 }, methodReference.TypeArguments.Cast<CodeTypeReference>());
- CodeTypeReference type2 = new CodeTypeReference(typeof(char));
- methodReference.TypeArguments.Add(type2);
- Assert.Equal(new CodeTypeReference[] { type1, type2 }, methodReference.TypeArguments.Cast<CodeTypeReference>());
- }
- }
+ CodeTypeReference type2 = new CodeTypeReference(typeof(char));
+ methodReference.TypeArguments.Add(type2);
+ Assert.Equal(new CodeTypeReference[] { type1, type2 }, methodReference.TypeArguments.Cast<CodeTypeReference>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeMethodReturnStatementTests : CodeStatementTestBase<CodeMethodReturnStatement>
- {
- [Fact]
- public void Ctor_Default()
- {
- var methodReturn = new CodeMethodReturnStatement();
- Assert.Null(methodReturn.Expression);
- }
+ public class CodeMethodReturnStatementTests : CodeStatementTestBase<CodeMethodReturnStatement>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var methodReturn = new CodeMethodReturnStatement();
+ Assert.Null(methodReturn.Expression);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Ctor_CodeExpression(CodeExpression expression)
- {
- var methodReturn = new CodeMethodReturnStatement(expression);
- Assert.Equal(expression, methodReturn.Expression);
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Ctor_CodeExpression(CodeExpression expression)
+ {
+ var methodReturn = new CodeMethodReturnStatement(expression);
+ Assert.Equal(expression, methodReturn.Expression);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Expression_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var methodReturn = new CodeMethodReturnStatement();
- methodReturn.Expression = value;
- Assert.Equal(value, methodReturn.Expression);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Expression_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var methodReturn = new CodeMethodReturnStatement();
+ methodReturn.Expression = value;
+ Assert.Equal(value, methodReturn.Expression);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeNamespaceImportTests : CodeObjectTestBase<CodeNamespaceImport>
- {
- [Fact]
- public void Ctor_Default()
- {
- var import = new CodeNamespaceImport();
- Assert.Empty(import.Namespace);
- Assert.Null(import.LinePragma);
- }
+ public class CodeNamespaceImportTests : CodeObjectTestBase<CodeNamespaceImport>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var import = new CodeNamespaceImport();
+ Assert.Empty(import.Namespace);
+ Assert.Null(import.LinePragma);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Ctor_String(string nameSpace)
- {
- var import = new CodeNamespaceImport(nameSpace);
- Assert.Equal(nameSpace ?? string.Empty, import.Namespace);
- Assert.Null(import.LinePragma);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Ctor_String(string nameSpace)
+ {
+ var import = new CodeNamespaceImport(nameSpace);
+ Assert.Equal(nameSpace ?? string.Empty, import.Namespace);
+ Assert.Null(import.LinePragma);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Namespace_Set_Get_ReturnsExpected(string value)
- {
- var import = new CodeNamespaceImport();
- import.Namespace = value;
- Assert.Equal(value ?? string.Empty, import.Namespace);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Namespace_Set_Get_ReturnsExpected(string value)
+ {
+ var import = new CodeNamespaceImport();
+ import.Namespace = value;
+ Assert.Equal(value ?? string.Empty, import.Namespace);
+ }
- [Theory]
- [MemberData(nameof(LinePragma_TestData))]
- public void LinePragma_Set_Get_ReturnsExpected(CodeLinePragma value)
- {
- var import = new CodeNamespaceImport();
- import.LinePragma = value;
- Assert.Equal(value, import.LinePragma);
- }
- }
+ [Theory]
+ [MemberData(nameof(LinePragma_TestData))]
+ public void LinePragma_Set_Get_ReturnsExpected(CodeLinePragma value)
+ {
+ var import = new CodeNamespaceImport();
+ import.LinePragma = value;
+ Assert.Equal(value, import.LinePragma);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeNamespaceTests : CodeObjectTestBase<CodeNamespace>
- {
- [Fact]
- public void Ctor_Default()
- {
- var codeNamespace = new CodeNamespace();
- Assert.Empty(codeNamespace.Name);
- Assert.Empty(codeNamespace.Types);
- Assert.Empty(codeNamespace.Imports);
- Assert.Empty(codeNamespace.Comments);
- }
-
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Ctor_String(string name)
- {
- var codeNamespace = new CodeNamespace(name);
- Assert.Equal(name ?? string.Empty, codeNamespace.Name);
- Assert.Empty(codeNamespace.Types);
- Assert.Empty(codeNamespace.Imports);
- Assert.Empty(codeNamespace.Comments);
- }
-
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Name_Set_Get_ReturnsExpected(string value)
- {
- var codeNamespace = new CodeNamespace();
- codeNamespace.Name = value;
- Assert.Equal(value ?? string.Empty, codeNamespace.Name);
- }
-
- [Fact]
- public void Types_AddMultiple_ReturnsExpected()
- {
- var codeNamespace = new CodeNamespace();
-
- CodeTypeDeclaration type1 = new CodeTypeDeclaration("Name1");
- codeNamespace.Types.Add(type1);
- Assert.Equal(new CodeTypeDeclaration[] { type1 }, codeNamespace.Types.Cast<CodeTypeDeclaration>());
-
- CodeTypeDeclaration type2 = new CodeTypeDeclaration("Name2");
- codeNamespace.Types.Add(type2);
- Assert.Equal(new CodeTypeDeclaration[] { type1, type2 }, codeNamespace.Types.Cast<CodeTypeDeclaration>());
- }
-
- [Fact]
- public void Types_Get_CallsPopulateTypesOnce()
- {
- var codeNamespace = new CodeNamespace();
- bool calledPopulateTypes = false;
- codeNamespace.PopulateTypes += (object sender, EventArgs args) =>
- {
- calledPopulateTypes = true;
- Assert.Same(codeNamespace, sender);
- Assert.Equal(EventArgs.Empty, args);
- };
-
- codeNamespace.Types.Add(new CodeTypeDeclaration("Name1"));
- Assert.True(calledPopulateTypes);
-
- // Only calls PopulateTypes once
- calledPopulateTypes = false;
- codeNamespace.Types.Add(new CodeTypeDeclaration("Name2"));
- Assert.False(calledPopulateTypes);
- }
-
- [Fact]
- public void Imports_AddMultiple_ReturnsExpected()
- {
- var codeNamespace = new CodeNamespace();
-
- CodeNamespaceImport type1 = new CodeNamespaceImport("Namespace1");
- codeNamespace.Imports.Add(type1);
- Assert.Equal(new CodeNamespaceImport[] { type1 }, codeNamespace.Imports.Cast<CodeNamespaceImport>());
-
- CodeNamespaceImport type2 = new CodeNamespaceImport("Namespace2");
- codeNamespace.Imports.Add(type2);
- Assert.Equal(new CodeNamespaceImport[] { type1, type2 }, codeNamespace.Imports.Cast<CodeNamespaceImport>());
- }
-
- [Fact]
- public void Imports_Get_CallsPopulateImportsOnce()
- {
- var codeNamespace = new CodeNamespace();
- bool calledPopulateImports = false;
- codeNamespace.PopulateImports += (object sender, EventArgs args) =>
- {
- calledPopulateImports = true;
- Assert.Same(codeNamespace, sender);
- Assert.Equal(EventArgs.Empty, args);
- };
-
- CodeNamespaceImport type1 = new CodeNamespaceImport("Namespace1");
- codeNamespace.Imports.Add(type1);
- Assert.Equal(new CodeNamespaceImport[] { type1 }, codeNamespace.Imports.Cast<CodeNamespaceImport>());
- Assert.True(calledPopulateImports);
-
- // Only calls PopulateImports once
- calledPopulateImports = false;
- CodeNamespaceImport type2 = new CodeNamespaceImport("Namespace2");
- codeNamespace.Imports.Add(type2);
- Assert.Equal(new CodeNamespaceImport[] { type1, type2 }, codeNamespace.Imports.Cast<CodeNamespaceImport>());
- Assert.False(calledPopulateImports);
- }
-
- [Fact]
- public void Comments_AddMultiple_ReturnsExpected()
- {
- var codeNamespace = new CodeNamespace();
-
- CodeCommentStatement comment1 = new CodeCommentStatement("Comment1");
- codeNamespace.Comments.Add(comment1);
- Assert.Equal(new CodeCommentStatement[] { comment1 }, codeNamespace.Comments.Cast<CodeCommentStatement>());
-
- CodeCommentStatement comment2 = new CodeCommentStatement("Comment2");
- codeNamespace.Comments.Add(comment2);
- Assert.Equal(new CodeCommentStatement[] { comment1, comment2 }, codeNamespace.Comments.Cast<CodeCommentStatement>());
- }
-
- [Fact]
- public void Comments_Get_CallsPopulateImportsONce()
- {
- var codeNamespace = new CodeNamespace();
- bool calledPopulateComments = false;
- codeNamespace.PopulateComments += (object sender, EventArgs args) =>
- {
- calledPopulateComments = true;
- Assert.Same(codeNamespace, sender);
- Assert.Equal(EventArgs.Empty, args);
- };
-
- CodeCommentStatement comment1 = new CodeCommentStatement("Comment1");
- codeNamespace.Comments.Add(comment1);
- Assert.Equal(new CodeCommentStatement[] { comment1 }, codeNamespace.Comments.Cast<CodeCommentStatement>());
- Assert.True(calledPopulateComments);
-
- // Only calls PopulateComments once
- calledPopulateComments = false;
- CodeCommentStatement comment2 = new CodeCommentStatement("Comment2");
- codeNamespace.Comments.Add(comment2);
- Assert.Equal(new CodeCommentStatement[] { comment1, comment2 }, codeNamespace.Comments.Cast<CodeCommentStatement>());
- Assert.False(calledPopulateComments);
- }
- }
+ public class CodeNamespaceTests : CodeObjectTestBase<CodeNamespace>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var codeNamespace = new CodeNamespace();
+ Assert.Empty(codeNamespace.Name);
+ Assert.Empty(codeNamespace.Types);
+ Assert.Empty(codeNamespace.Imports);
+ Assert.Empty(codeNamespace.Comments);
+ }
+
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Ctor_String(string name)
+ {
+ var codeNamespace = new CodeNamespace(name);
+ Assert.Equal(name ?? string.Empty, codeNamespace.Name);
+ Assert.Empty(codeNamespace.Types);
+ Assert.Empty(codeNamespace.Imports);
+ Assert.Empty(codeNamespace.Comments);
+ }
+
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Name_Set_Get_ReturnsExpected(string value)
+ {
+ var codeNamespace = new CodeNamespace();
+ codeNamespace.Name = value;
+ Assert.Equal(value ?? string.Empty, codeNamespace.Name);
+ }
+
+ [Fact]
+ public void Types_AddMultiple_ReturnsExpected()
+ {
+ var codeNamespace = new CodeNamespace();
+
+ CodeTypeDeclaration type1 = new CodeTypeDeclaration("Name1");
+ codeNamespace.Types.Add(type1);
+ Assert.Equal(new CodeTypeDeclaration[] { type1 }, codeNamespace.Types.Cast<CodeTypeDeclaration>());
+
+ CodeTypeDeclaration type2 = new CodeTypeDeclaration("Name2");
+ codeNamespace.Types.Add(type2);
+ Assert.Equal(new CodeTypeDeclaration[] { type1, type2 }, codeNamespace.Types.Cast<CodeTypeDeclaration>());
+ }
+
+ [Fact]
+ public void Types_Get_CallsPopulateTypesOnce()
+ {
+ var codeNamespace = new CodeNamespace();
+ bool calledPopulateTypes = false;
+ codeNamespace.PopulateTypes += (object sender, EventArgs args) =>
+ {
+ calledPopulateTypes = true;
+ Assert.Same(codeNamespace, sender);
+ Assert.Equal(EventArgs.Empty, args);
+ };
+
+ codeNamespace.Types.Add(new CodeTypeDeclaration("Name1"));
+ Assert.True(calledPopulateTypes);
+
+ // Only calls PopulateTypes once
+ calledPopulateTypes = false;
+ codeNamespace.Types.Add(new CodeTypeDeclaration("Name2"));
+ Assert.False(calledPopulateTypes);
+ }
+
+ [Fact]
+ public void Imports_AddMultiple_ReturnsExpected()
+ {
+ var codeNamespace = new CodeNamespace();
+
+ CodeNamespaceImport type1 = new CodeNamespaceImport("Namespace1");
+ codeNamespace.Imports.Add(type1);
+ Assert.Equal(new CodeNamespaceImport[] { type1 }, codeNamespace.Imports.Cast<CodeNamespaceImport>());
+
+ CodeNamespaceImport type2 = new CodeNamespaceImport("Namespace2");
+ codeNamespace.Imports.Add(type2);
+ Assert.Equal(new CodeNamespaceImport[] { type1, type2 }, codeNamespace.Imports.Cast<CodeNamespaceImport>());
+ }
+
+ [Fact]
+ public void Imports_Get_CallsPopulateImportsOnce()
+ {
+ var codeNamespace = new CodeNamespace();
+ bool calledPopulateImports = false;
+ codeNamespace.PopulateImports += (object sender, EventArgs args) =>
+ {
+ calledPopulateImports = true;
+ Assert.Same(codeNamespace, sender);
+ Assert.Equal(EventArgs.Empty, args);
+ };
+
+ CodeNamespaceImport type1 = new CodeNamespaceImport("Namespace1");
+ codeNamespace.Imports.Add(type1);
+ Assert.Equal(new CodeNamespaceImport[] { type1 }, codeNamespace.Imports.Cast<CodeNamespaceImport>());
+ Assert.True(calledPopulateImports);
+
+ // Only calls PopulateImports once
+ calledPopulateImports = false;
+ CodeNamespaceImport type2 = new CodeNamespaceImport("Namespace2");
+ codeNamespace.Imports.Add(type2);
+ Assert.Equal(new CodeNamespaceImport[] { type1, type2 }, codeNamespace.Imports.Cast<CodeNamespaceImport>());
+ Assert.False(calledPopulateImports);
+ }
+
+ [Fact]
+ public void Comments_AddMultiple_ReturnsExpected()
+ {
+ var codeNamespace = new CodeNamespace();
+
+ CodeCommentStatement comment1 = new CodeCommentStatement("Comment1");
+ codeNamespace.Comments.Add(comment1);
+ Assert.Equal(new CodeCommentStatement[] { comment1 }, codeNamespace.Comments.Cast<CodeCommentStatement>());
+
+ CodeCommentStatement comment2 = new CodeCommentStatement("Comment2");
+ codeNamespace.Comments.Add(comment2);
+ Assert.Equal(new CodeCommentStatement[] { comment1, comment2 }, codeNamespace.Comments.Cast<CodeCommentStatement>());
+ }
+
+ [Fact]
+ public void Comments_Get_CallsPopulateImportsONce()
+ {
+ var codeNamespace = new CodeNamespace();
+ bool calledPopulateComments = false;
+ codeNamespace.PopulateComments += (object sender, EventArgs args) =>
+ {
+ calledPopulateComments = true;
+ Assert.Same(codeNamespace, sender);
+ Assert.Equal(EventArgs.Empty, args);
+ };
+
+ CodeCommentStatement comment1 = new CodeCommentStatement("Comment1");
+ codeNamespace.Comments.Add(comment1);
+ Assert.Equal(new CodeCommentStatement[] { comment1 }, codeNamespace.Comments.Cast<CodeCommentStatement>());
+ Assert.True(calledPopulateComments);
+
+ // Only calls PopulateComments once
+ calledPopulateComments = false;
+ CodeCommentStatement comment2 = new CodeCommentStatement("Comment2");
+ codeNamespace.Comments.Add(comment2);
+ Assert.Equal(new CodeCommentStatement[] { comment1, comment2 }, codeNamespace.Comments.Cast<CodeCommentStatement>());
+ Assert.False(calledPopulateComments);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeObjectCreateExpressionTests : CodeObjectTestBase<CodeObjectCreateExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var objectCreate = new CodeObjectCreateExpression();
- Assert.Equal(typeof(void).FullName, objectCreate.CreateType.BaseType);
- Assert.Empty(objectCreate.Parameters);
- }
+ public class CodeObjectCreateExpressionTests : CodeObjectTestBase<CodeObjectCreateExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var objectCreate = new CodeObjectCreateExpression();
+ Assert.Equal(typeof(void).FullName, objectCreate.CreateType.BaseType);
+ Assert.Empty(objectCreate.Parameters);
+ }
- public static IEnumerable<object[]> Ctor_CodeTypeReference_ParamsCodeExpression_TestData()
- {
- yield return new object[] { null, new CodeExpression[0] };
- yield return new object[] { new CodeTypeReference(), new CodeExpression[] { new CodePrimitiveExpression() } };
- yield return new object[] { new CodeTypeReference(typeof(int)), new CodeExpression[] { new CodePrimitiveExpression("Value") } };
- }
+ public static IEnumerable<object[]> Ctor_CodeTypeReference_ParamsCodeExpression_TestData()
+ {
+ yield return new object[] { null, new CodeExpression[0] };
+ yield return new object[] { new CodeTypeReference(), new CodeExpression[] { new CodePrimitiveExpression() } };
+ yield return new object[] { new CodeTypeReference(typeof(int)), new CodeExpression[] { new CodePrimitiveExpression("Value") } };
+ }
- [Theory]
- [MemberData(nameof(Ctor_CodeTypeReference_ParamsCodeExpression_TestData))]
- public void Ctor(CodeTypeReference type, CodeExpression[] parameters)
- {
- var objectCreate = new CodeObjectCreateExpression(type, parameters);
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, objectCreate.CreateType.BaseType);
- Assert.Equal(parameters, objectCreate.Parameters.Cast<CodeExpression>());
- }
+ [Theory]
+ [MemberData(nameof(Ctor_CodeTypeReference_ParamsCodeExpression_TestData))]
+ public void Ctor(CodeTypeReference type, CodeExpression[] parameters)
+ {
+ var objectCreate = new CodeObjectCreateExpression(type, parameters);
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, objectCreate.CreateType.BaseType);
+ Assert.Equal(parameters, objectCreate.Parameters.Cast<CodeExpression>());
+ }
- public static IEnumerable<object[]> Ctor_String_ParamsCodeExpression_TestData()
- {
- yield return new object[] { null, new CodeExpression[0], "System.Void" };
- yield return new object[] { "", new CodeExpression[] { new CodePrimitiveExpression() }, "System.Void" };
- yield return new object[] { "Int32", new CodeExpression[] { new CodePrimitiveExpression("Value") }, "Int32" };
- }
+ public static IEnumerable<object[]> Ctor_String_ParamsCodeExpression_TestData()
+ {
+ yield return new object[] { null, new CodeExpression[0], "System.Void" };
+ yield return new object[] { "", new CodeExpression[] { new CodePrimitiveExpression() }, "System.Void" };
+ yield return new object[] { "Int32", new CodeExpression[] { new CodePrimitiveExpression("Value") }, "Int32" };
+ }
- [Theory]
- [MemberData(nameof(Ctor_String_ParamsCodeExpression_TestData))]
- public void Ctor(string type, CodeExpression[] parameters, string expectedBaseType)
- {
- var objectCreate = new CodeObjectCreateExpression(type, parameters);
- Assert.Equal(expectedBaseType, objectCreate.CreateType.BaseType);
- Assert.Equal(parameters, objectCreate.Parameters.Cast<CodeExpression>());
- }
+ [Theory]
+ [MemberData(nameof(Ctor_String_ParamsCodeExpression_TestData))]
+ public void Ctor(string type, CodeExpression[] parameters, string expectedBaseType)
+ {
+ var objectCreate = new CodeObjectCreateExpression(type, parameters);
+ Assert.Equal(expectedBaseType, objectCreate.CreateType.BaseType);
+ Assert.Equal(parameters, objectCreate.Parameters.Cast<CodeExpression>());
+ }
- public static IEnumerable<object[]> Ctor_Type_ParamsCodeExpression_TestData()
- {
- yield return new object[] { typeof(int), new CodeExpression[0], "System.Int32" };
- yield return new object[] { typeof(List<>), new CodeExpression[] { new CodePrimitiveExpression() }, "System.Collections.Generic.List`1" };
- yield return new object[] { typeof(void), new CodeExpression[] { new CodePrimitiveExpression("Value") }, "System.Void" };
- }
+ public static IEnumerable<object[]> Ctor_Type_ParamsCodeExpression_TestData()
+ {
+ yield return new object[] { typeof(int), new CodeExpression[0], "System.Int32" };
+ yield return new object[] { typeof(List<>), new CodeExpression[] { new CodePrimitiveExpression() }, "System.Collections.Generic.List`1" };
+ yield return new object[] { typeof(void), new CodeExpression[] { new CodePrimitiveExpression("Value") }, "System.Void" };
+ }
- [Theory]
- [MemberData(nameof(Ctor_Type_ParamsCodeExpression_TestData))]
- public void Ctor_Type_String(Type type, CodeExpression[] parameters, string expectedBaseType)
- {
- var objectCreate = new CodeObjectCreateExpression(type, parameters);
- Assert.Equal(expectedBaseType, objectCreate.CreateType.BaseType);
- Assert.Equal(parameters, objectCreate.Parameters.Cast<CodeExpression>());
- }
+ [Theory]
+ [MemberData(nameof(Ctor_Type_ParamsCodeExpression_TestData))]
+ public void Ctor_Type_String(Type type, CodeExpression[] parameters, string expectedBaseType)
+ {
+ var objectCreate = new CodeObjectCreateExpression(type, parameters);
+ Assert.Equal(expectedBaseType, objectCreate.CreateType.BaseType);
+ Assert.Equal(parameters, objectCreate.Parameters.Cast<CodeExpression>());
+ }
- [Fact]
- public void Ctor_NullParameters_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeObjectCreateExpression(new CodeTypeReference(), null));
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeObjectCreateExpression("System.Int32", null));
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeObjectCreateExpression(typeof(int), null));
- }
+ [Fact]
+ public void Ctor_NullParameters_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeObjectCreateExpression(new CodeTypeReference(), null));
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeObjectCreateExpression("System.Int32", null));
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeObjectCreateExpression(typeof(int), null));
+ }
- [Fact]
- public void Ctor_NullObjectInParameters_ThrowsArgumentNullException()
- {
- CodeExpression[] parameters = new CodeExpression[] { null };
+ [Fact]
+ public void Ctor_NullObjectInParameters_ThrowsArgumentNullException()
+ {
+ CodeExpression[] parameters = new CodeExpression[] { null };
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeObjectCreateExpression(new CodeTypeReference(), parameters));
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeObjectCreateExpression("System.Int32", parameters));
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeObjectCreateExpression(typeof(int), parameters));
- }
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeObjectCreateExpression(new CodeTypeReference(), parameters));
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeObjectCreateExpression("System.Int32", parameters));
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeObjectCreateExpression(typeof(int), parameters));
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void CreateType_Set_Get_ReturnsExpected(CodeTypeReference value)
- {
- var objectCreate = new CodeObjectCreateExpression();
- objectCreate.CreateType = value;
- Assert.Equal((value ?? new CodeTypeReference("")).BaseType, objectCreate.CreateType.BaseType);
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void CreateType_Set_Get_ReturnsExpected(CodeTypeReference value)
+ {
+ var objectCreate = new CodeObjectCreateExpression();
+ objectCreate.CreateType = value;
+ Assert.Equal((value ?? new CodeTypeReference("")).BaseType, objectCreate.CreateType.BaseType);
+ }
- [Fact]
- public void Parameters_AddMultiple_ReturnsExpected()
- {
- var objectCreate = new CodeObjectCreateExpression();
+ [Fact]
+ public void Parameters_AddMultiple_ReturnsExpected()
+ {
+ var objectCreate = new CodeObjectCreateExpression();
- CodeExpression expression1 = new CodePrimitiveExpression("Value1");
- objectCreate.Parameters.Add(expression1);
- Assert.Equal(new CodeExpression[] { expression1 }, objectCreate.Parameters.Cast<CodeExpression>());
+ CodeExpression expression1 = new CodePrimitiveExpression("Value1");
+ objectCreate.Parameters.Add(expression1);
+ Assert.Equal(new CodeExpression[] { expression1 }, objectCreate.Parameters.Cast<CodeExpression>());
- CodeExpression expression2 = new CodePrimitiveExpression("Value2");
- objectCreate.Parameters.Add(expression2);
- Assert.Equal(new CodeExpression[] { expression1, expression2 }, objectCreate.Parameters.Cast<CodeExpression>());
- }
- }
+ CodeExpression expression2 = new CodePrimitiveExpression("Value2");
+ objectCreate.Parameters.Add(expression2);
+ Assert.Equal(new CodeExpression[] { expression1, expression2 }, objectCreate.Parameters.Cast<CodeExpression>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public abstract class CodeObjectTestBase<T> : CodeDomTestBase where T : CodeObject, new()
- {
- [Fact]
- public void Ctor_Default_ObjectBase()
- {
- CodeObject codeObject = new T();
- Assert.Empty(codeObject.UserData);
- }
+ public abstract class CodeObjectTestBase<T> : CodeDomTestBase where T : CodeObject, new()
+ {
+ [Fact]
+ public void Ctor_Default_ObjectBase()
+ {
+ CodeObject codeObject = new T();
+ Assert.Empty(codeObject.UserData);
+ }
- [Fact]
- public void UserData_AddMultiple_ReturnsExpected()
- {
- CodeObject codeObject = new T();
- codeObject.UserData.Add("key1", "value");
- Assert.Equal(new ListDictionary() { ["key1"] = "value" }, codeObject.UserData);
+ [Fact]
+ public void UserData_AddMultiple_ReturnsExpected()
+ {
+ CodeObject codeObject = new T();
+ codeObject.UserData.Add("key1", "value");
+ Assert.Equal(new ListDictionary() { ["key1"] = "value" }, codeObject.UserData);
- codeObject.UserData.Add("key2", "value");
- Assert.Equal(new ListDictionary() { ["key1"] = "value", ["key2"] = "value" }, codeObject.UserData);
- }
- }
+ codeObject.UserData.Add("key2", "value");
+ Assert.Equal(new ListDictionary() { ["key1"] = "value", ["key2"] = "value" }, codeObject.UserData);
+ }
+ }
- public abstract class CodeDomTestBase
- {
- public static IEnumerable<object[]> CodeExpression_TestData()
- {
- yield return new object[] { null };
- yield return new object[] { new CodePrimitiveExpression("Value") };
- }
+ public abstract class CodeDomTestBase
+ {
+ public static IEnumerable<object[]> CodeExpression_TestData()
+ {
+ yield return new object[] { null };
+ yield return new object[] { new CodePrimitiveExpression("Value") };
+ }
- public static IEnumerable<object[]> CodeTypeReference_TestData()
- {
- yield return new object[] { null };
- yield return new object[] { new CodeTypeReference(typeof(int)) };
- yield return new object[] { new CodeTypeReference(typeof(int).MakePointerType()) };
- yield return new object[] { new CodeTypeReference(typeof(int).MakeByRefType()) };
- yield return new object[] { new CodeTypeReference(typeof(List<>)) };
- yield return new object[] { new CodeTypeReference(typeof(List<string>)) };
- }
+ public static IEnumerable<object[]> CodeTypeReference_TestData()
+ {
+ yield return new object[] { null };
+ yield return new object[] { new CodeTypeReference(typeof(int)) };
+ yield return new object[] { new CodeTypeReference(typeof(int).MakePointerType()) };
+ yield return new object[] { new CodeTypeReference(typeof(int).MakeByRefType()) };
+ yield return new object[] { new CodeTypeReference(typeof(List<>)) };
+ yield return new object[] { new CodeTypeReference(typeof(List<string>)) };
+ }
- public static IEnumerable<object[]> CodeStatement_TestData()
- {
- yield return new object[] { null };
- yield return new object[] { new CodeCommentStatement("Text") };
- }
+ public static IEnumerable<object[]> CodeStatement_TestData()
+ {
+ yield return new object[] { null };
+ yield return new object[] { new CodeCommentStatement("Text") };
+ }
- public static IEnumerable<object[]> String_TestData()
- {
- yield return new object[] { null };
- yield return new object[] { "" };
- yield return new object[] { "Value" };
- }
+ public static IEnumerable<object[]> String_TestData()
+ {
+ yield return new object[] { null };
+ yield return new object[] { "" };
+ yield return new object[] { "Value" };
+ }
- public static IEnumerable<object[]> LinePragma_TestData()
- {
- yield return new object[] { null };
- yield return new object[] { new CodeLinePragma("FileName", 1) };
- }
- }
+ public static IEnumerable<object[]> LinePragma_TestData()
+ {
+ yield return new object[] { null };
+ yield return new object[] { new CodeLinePragma("FileName", 1) };
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeParameterDeclarationExpressionTests : CodeObjectTestBase<CodeParameterDeclarationExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var parameter = new CodeParameterDeclarationExpression();
- Assert.Empty(parameter.CustomAttributes);
- Assert.Equal(FieldDirection.In, parameter.Direction);
- Assert.Equal(typeof(void).FullName, parameter.Type.BaseType);
- Assert.Empty(parameter.Name);
- }
-
- public static IEnumerable<object[]> Ctor_CodeTypeReference_String_TestData()
- {
- yield return new object[] { null, null };
- yield return new object[] { new CodeTypeReference(), "" };
- yield return new object[] { new CodeTypeReference(typeof(int)), "Name" };
- }
-
- [Theory]
- [MemberData(nameof(Ctor_CodeTypeReference_String_TestData))]
- public void Ctor_CodeTypeReference_String(CodeTypeReference type, string name)
- {
- var parameter = new CodeParameterDeclarationExpression(type, name);
- Assert.Empty(parameter.CustomAttributes);
- Assert.Equal(FieldDirection.In, parameter.Direction);
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, parameter.Type.BaseType);
- Assert.Equal(name ?? string.Empty, parameter.Name);
- }
-
- public static IEnumerable<object[]> Ctor_String_String_TestData()
- {
- yield return new object[] { null, null, "System.Void" };
- yield return new object[] { "", "", "System.Void" };
- yield return new object[] { "Int32", "Name", "Int32" };
- }
-
- [Theory]
- [MemberData(nameof(Ctor_String_String_TestData))]
- public void Ctor_String_String(string type, string name, string expectedBaseType)
- {
- var parameter = new CodeParameterDeclarationExpression(type, name);
- Assert.Empty(parameter.CustomAttributes);
- Assert.Equal(FieldDirection.In, parameter.Direction);
- Assert.Equal(expectedBaseType, parameter.Type.BaseType);
- Assert.Equal(name ?? string.Empty, parameter.Name);
- }
-
- public static IEnumerable<object[]> Ctor_Type_String_TestData()
- {
- yield return new object[] { typeof(int), null, "System.Int32" };
- yield return new object[] { typeof(List<>), "", "System.Collections.Generic.List`1" };
- yield return new object[] { typeof(void), "Name", "System.Void" };
- }
-
- [Theory]
- [MemberData(nameof(Ctor_Type_String_TestData))]
- public void Ctor_Type_String(Type type, string name, string expectedBaseType)
- {
- var parameter = new CodeParameterDeclarationExpression(type, name);
- Assert.Empty(parameter.CustomAttributes);
- Assert.Equal(FieldDirection.In, parameter.Direction);
- Assert.Equal(expectedBaseType, parameter.Type.BaseType);
- Assert.Equal(name ?? string.Empty, parameter.Name);
- }
-
- [Fact]
- public void CustomAttributes_SetNull_Get_ReturnsEmpty()
- {
- var parameter = new CodeParameterDeclarationExpression() { CustomAttributes = null };
- Assert.Empty(parameter.CustomAttributes);
- }
-
- [Fact]
- public void CustomAttributes_SetNonNull_Get_ReturnsExpected()
- {
- var parameter = new CodeParameterDeclarationExpression() { CustomAttributes = null };
- CodeAttributeDeclarationCollection value = new CodeAttributeDeclarationCollection();
- value.Add(new CodeAttributeDeclaration("Name1"));
- value.Add(new CodeAttributeDeclaration("Name2"));
-
- parameter.CustomAttributes = value;
- Assert.Equal(value, parameter.CustomAttributes);
- }
-
- [Fact]
- public void CustomAttributes_AddMultiple_ReturnsExpected()
- {
- var parameter = new CodeParameterDeclarationExpression();
-
- CodeAttributeDeclaration attribute1 = new CodeAttributeDeclaration("Name1");
- parameter.CustomAttributes.Add(attribute1);
- Assert.Equal(new CodeAttributeDeclaration[] { attribute1 }, parameter.CustomAttributes.Cast<CodeAttributeDeclaration>());
-
- CodeAttributeDeclaration attribute2 = new CodeAttributeDeclaration("Name2");
- parameter.CustomAttributes.Add(attribute2);
- Assert.Equal(new CodeAttributeDeclaration[] { attribute1, attribute2 }, parameter.CustomAttributes.Cast<CodeAttributeDeclaration>());
- }
-
- [Theory]
- [InlineData(FieldDirection.In - 1)]
- [InlineData(FieldDirection.In)]
- [InlineData(FieldDirection.In | FieldDirection.Out)]
- [InlineData(FieldDirection.Ref + 1)]
- public void Direction_Set_Get_ReturnsExpected(FieldDirection value)
- {
- var parameter = new CodeParameterDeclarationExpression();
- parameter.Direction = value;
- Assert.Equal(value, parameter.Direction);
- }
-
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Type_Set_Get_ReturnsExpected(CodeTypeReference value)
- {
- var parameter = new CodeParameterDeclarationExpression();
- parameter.Type = value;
- Assert.Equal((value ?? new CodeTypeReference("")).BaseType, parameter.Type.BaseType);
- }
-
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Name_Set_Get_ReturnsExpected(string value)
- {
- var parameter = new CodeParameterDeclarationExpression();
- parameter.Name = value;
- Assert.Equal(value ?? string.Empty, parameter.Name);
- }
- }
+ public class CodeParameterDeclarationExpressionTests : CodeObjectTestBase<CodeParameterDeclarationExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var parameter = new CodeParameterDeclarationExpression();
+ Assert.Empty(parameter.CustomAttributes);
+ Assert.Equal(FieldDirection.In, parameter.Direction);
+ Assert.Equal(typeof(void).FullName, parameter.Type.BaseType);
+ Assert.Empty(parameter.Name);
+ }
+
+ public static IEnumerable<object[]> Ctor_CodeTypeReference_String_TestData()
+ {
+ yield return new object[] { null, null };
+ yield return new object[] { new CodeTypeReference(), "" };
+ yield return new object[] { new CodeTypeReference(typeof(int)), "Name" };
+ }
+
+ [Theory]
+ [MemberData(nameof(Ctor_CodeTypeReference_String_TestData))]
+ public void Ctor_CodeTypeReference_String(CodeTypeReference type, string name)
+ {
+ var parameter = new CodeParameterDeclarationExpression(type, name);
+ Assert.Empty(parameter.CustomAttributes);
+ Assert.Equal(FieldDirection.In, parameter.Direction);
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, parameter.Type.BaseType);
+ Assert.Equal(name ?? string.Empty, parameter.Name);
+ }
+
+ public static IEnumerable<object[]> Ctor_String_String_TestData()
+ {
+ yield return new object[] { null, null, "System.Void" };
+ yield return new object[] { "", "", "System.Void" };
+ yield return new object[] { "Int32", "Name", "Int32" };
+ }
+
+ [Theory]
+ [MemberData(nameof(Ctor_String_String_TestData))]
+ public void Ctor_String_String(string type, string name, string expectedBaseType)
+ {
+ var parameter = new CodeParameterDeclarationExpression(type, name);
+ Assert.Empty(parameter.CustomAttributes);
+ Assert.Equal(FieldDirection.In, parameter.Direction);
+ Assert.Equal(expectedBaseType, parameter.Type.BaseType);
+ Assert.Equal(name ?? string.Empty, parameter.Name);
+ }
+
+ public static IEnumerable<object[]> Ctor_Type_String_TestData()
+ {
+ yield return new object[] { typeof(int), null, "System.Int32" };
+ yield return new object[] { typeof(List<>), "", "System.Collections.Generic.List`1" };
+ yield return new object[] { typeof(void), "Name", "System.Void" };
+ }
+
+ [Theory]
+ [MemberData(nameof(Ctor_Type_String_TestData))]
+ public void Ctor_Type_String(Type type, string name, string expectedBaseType)
+ {
+ var parameter = new CodeParameterDeclarationExpression(type, name);
+ Assert.Empty(parameter.CustomAttributes);
+ Assert.Equal(FieldDirection.In, parameter.Direction);
+ Assert.Equal(expectedBaseType, parameter.Type.BaseType);
+ Assert.Equal(name ?? string.Empty, parameter.Name);
+ }
+
+ [Fact]
+ public void CustomAttributes_SetNull_Get_ReturnsEmpty()
+ {
+ var parameter = new CodeParameterDeclarationExpression() { CustomAttributes = null };
+ Assert.Empty(parameter.CustomAttributes);
+ }
+
+ [Fact]
+ public void CustomAttributes_SetNonNull_Get_ReturnsExpected()
+ {
+ var parameter = new CodeParameterDeclarationExpression() { CustomAttributes = null };
+ CodeAttributeDeclarationCollection value = new CodeAttributeDeclarationCollection();
+ value.Add(new CodeAttributeDeclaration("Name1"));
+ value.Add(new CodeAttributeDeclaration("Name2"));
+
+ parameter.CustomAttributes = value;
+ Assert.Equal(value, parameter.CustomAttributes);
+ }
+
+ [Fact]
+ public void CustomAttributes_AddMultiple_ReturnsExpected()
+ {
+ var parameter = new CodeParameterDeclarationExpression();
+
+ CodeAttributeDeclaration attribute1 = new CodeAttributeDeclaration("Name1");
+ parameter.CustomAttributes.Add(attribute1);
+ Assert.Equal(new CodeAttributeDeclaration[] { attribute1 }, parameter.CustomAttributes.Cast<CodeAttributeDeclaration>());
+
+ CodeAttributeDeclaration attribute2 = new CodeAttributeDeclaration("Name2");
+ parameter.CustomAttributes.Add(attribute2);
+ Assert.Equal(new CodeAttributeDeclaration[] { attribute1, attribute2 }, parameter.CustomAttributes.Cast<CodeAttributeDeclaration>());
+ }
+
+ [Theory]
+ [InlineData(FieldDirection.In - 1)]
+ [InlineData(FieldDirection.In)]
+ [InlineData(FieldDirection.In | FieldDirection.Out)]
+ [InlineData(FieldDirection.Ref + 1)]
+ public void Direction_Set_Get_ReturnsExpected(FieldDirection value)
+ {
+ var parameter = new CodeParameterDeclarationExpression();
+ parameter.Direction = value;
+ Assert.Equal(value, parameter.Direction);
+ }
+
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Type_Set_Get_ReturnsExpected(CodeTypeReference value)
+ {
+ var parameter = new CodeParameterDeclarationExpression();
+ parameter.Type = value;
+ Assert.Equal((value ?? new CodeTypeReference("")).BaseType, parameter.Type.BaseType);
+ }
+
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Name_Set_Get_ReturnsExpected(string value)
+ {
+ var parameter = new CodeParameterDeclarationExpression();
+ parameter.Name = value;
+ Assert.Equal(value ?? string.Empty, parameter.Name);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodePrimitiveExpressionTests : CodeObjectTestBase<CodePrimitiveExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var primitive = new CodePrimitiveExpression();
- Assert.Null(primitive.Value);
- }
+ public class CodePrimitiveExpressionTests : CodeObjectTestBase<CodePrimitiveExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var primitive = new CodePrimitiveExpression();
+ Assert.Null(primitive.Value);
+ }
- public static IEnumerable<object[]> Object_TestData()
- {
- yield return new object[] { null };
- yield return new object[] { 1 };
- yield return new object[] { "2" };
- }
+ public static IEnumerable<object[]> Object_TestData()
+ {
+ yield return new object[] { null };
+ yield return new object[] { 1 };
+ yield return new object[] { "2" };
+ }
- [Theory]
- [MemberData(nameof(Object_TestData))]
- public void Ctor_Object(object value)
- {
- var primitive = new CodePrimitiveExpression(value);
- Assert.Equal(value, primitive.Value);
- }
+ [Theory]
+ [MemberData(nameof(Object_TestData))]
+ public void Ctor_Object(object value)
+ {
+ var primitive = new CodePrimitiveExpression(value);
+ Assert.Equal(value, primitive.Value);
+ }
- [Theory]
- [MemberData(nameof(Object_TestData))]
- public void Value_Set_Get_ReturnsExpected(object value)
- {
- var primitive = new CodePrimitiveExpression();
- primitive.Value = value;
- Assert.Equal(value, primitive.Value);
- }
- }
+ [Theory]
+ [MemberData(nameof(Object_TestData))]
+ public void Value_Set_Get_ReturnsExpected(object value)
+ {
+ var primitive = new CodePrimitiveExpression();
+ primitive.Value = value;
+ Assert.Equal(value, primitive.Value);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodePropertyReferenceExpressionTests : CodeObjectTestBase<CodePropertyReferenceExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var propertyReference = new CodePropertyReferenceExpression();
- Assert.Null(propertyReference.TargetObject);
- Assert.Empty(propertyReference.PropertyName);
- }
+ public class CodePropertyReferenceExpressionTests : CodeObjectTestBase<CodePropertyReferenceExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var propertyReference = new CodePropertyReferenceExpression();
+ Assert.Null(propertyReference.TargetObject);
+ Assert.Empty(propertyReference.PropertyName);
+ }
- public static IEnumerable<object[]> Ctor_TestData()
- {
- yield return new object[] { null, null };
- yield return new object[] { new CodePrimitiveExpression(""), "" };
- yield return new object[] { new CodePrimitiveExpression("Value"), "PropertyName" };
- }
+ public static IEnumerable<object[]> Ctor_TestData()
+ {
+ yield return new object[] { null, null };
+ yield return new object[] { new CodePrimitiveExpression(""), "" };
+ yield return new object[] { new CodePrimitiveExpression("Value"), "PropertyName" };
+ }
- [Theory]
- [MemberData(nameof(Ctor_TestData))]
- public void Ctor(CodeExpression targetObject, string PropertyName)
- {
- var propertyReference = new CodePropertyReferenceExpression(targetObject, PropertyName);
- Assert.Equal(targetObject, propertyReference.TargetObject);
- Assert.Equal(PropertyName ?? string.Empty, propertyReference.PropertyName);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_TestData))]
+ public void Ctor(CodeExpression targetObject, string PropertyName)
+ {
+ var propertyReference = new CodePropertyReferenceExpression(targetObject, PropertyName);
+ Assert.Equal(targetObject, propertyReference.TargetObject);
+ Assert.Equal(PropertyName ?? string.Empty, propertyReference.PropertyName);
+ }
- [Theory]
- [InlineData(null)]
- [InlineData("")]
- [InlineData("PropertyName")]
- public void EventName_Set_Get_ReturnsExpected(string value)
- {
- var propertyReference = new CodePropertyReferenceExpression();
- propertyReference.PropertyName = value;
- Assert.Equal(value ?? string.Empty, propertyReference.PropertyName);
- }
+ [Theory]
+ [InlineData(null)]
+ [InlineData("")]
+ [InlineData("PropertyName")]
+ public void EventName_Set_Get_ReturnsExpected(string value)
+ {
+ var propertyReference = new CodePropertyReferenceExpression();
+ propertyReference.PropertyName = value;
+ Assert.Equal(value ?? string.Empty, propertyReference.PropertyName);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var propertyReference = new CodePropertyReferenceExpression();
- propertyReference.TargetObject = value;
- Assert.Equal(value, propertyReference.TargetObject);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var propertyReference = new CodePropertyReferenceExpression();
+ propertyReference.TargetObject = value;
+ Assert.Equal(value, propertyReference.TargetObject);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeRegionDirectiveTests : CodeDomTestBase
- {
- [Fact]
- public void Ctor_Default()
- {
- var region = new CodeRegionDirective();
- Assert.Equal(CodeRegionMode.None, region.RegionMode);
- Assert.Empty(region.RegionText);
- }
+ public class CodeRegionDirectiveTests : CodeDomTestBase
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var region = new CodeRegionDirective();
+ Assert.Equal(CodeRegionMode.None, region.RegionMode);
+ Assert.Empty(region.RegionText);
+ }
- public static IEnumerable<object[]> Ctor_TestData()
- {
- yield return new object[] { CodeRegionMode.None - 1, null };
- yield return new object[] { CodeRegionMode.None, "" };
- yield return new object[] { CodeRegionMode.End + 1, "RegionText" };
- }
+ public static IEnumerable<object[]> Ctor_TestData()
+ {
+ yield return new object[] { CodeRegionMode.None - 1, null };
+ yield return new object[] { CodeRegionMode.None, "" };
+ yield return new object[] { CodeRegionMode.End + 1, "RegionText" };
+ }
- [Theory]
- [MemberData(nameof(Ctor_TestData))]
- public void Ctor_CodeRegionMode_String(CodeRegionMode regionMode, string regionText)
- {
- var region = new CodeRegionDirective(regionMode, regionText);
- Assert.Equal(regionMode, region.RegionMode);
- Assert.Equal(regionText ?? string.Empty, region.RegionText);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_TestData))]
+ public void Ctor_CodeRegionMode_String(CodeRegionMode regionMode, string regionText)
+ {
+ var region = new CodeRegionDirective(regionMode, regionText);
+ Assert.Equal(regionMode, region.RegionMode);
+ Assert.Equal(regionText ?? string.Empty, region.RegionText);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void RegionText_Set_Get_ReturnsExpected(string value)
- {
- var region = new CodeRegionDirective();
- region.RegionText = value;
- Assert.Equal(value ?? string.Empty, region.RegionText);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void RegionText_Set_Get_ReturnsExpected(string value)
+ {
+ var region = new CodeRegionDirective();
+ region.RegionText = value;
+ Assert.Equal(value ?? string.Empty, region.RegionText);
+ }
- [Theory]
- [InlineData(CodeRegionMode.None - 1)]
- [InlineData(CodeRegionMode.None)]
- [InlineData(CodeRegionMode.Start | CodeRegionMode.End)]
- public void Value_Set_Get_ReturnsExpected(CodeRegionMode value)
- {
- var region = new CodeRegionDirective();
- region.RegionMode = value;
- Assert.Equal(value, region.RegionMode);
- }
- }
+ [Theory]
+ [InlineData(CodeRegionMode.None - 1)]
+ [InlineData(CodeRegionMode.None)]
+ [InlineData(CodeRegionMode.Start | CodeRegionMode.End)]
+ public void Value_Set_Get_ReturnsExpected(CodeRegionMode value)
+ {
+ var region = new CodeRegionDirective();
+ region.RegionMode = value;
+ Assert.Equal(value, region.RegionMode);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeRemoveEventStatementTests : CodeStatementTestBase<CodeRemoveEventStatement>
- {
- [Fact]
- public void Ctor_Default()
- {
- var removeEvent = new CodeRemoveEventStatement();
- Assert.Empty(removeEvent.Event.EventName);
- Assert.Null(removeEvent.Event.TargetObject);
- Assert.Null(removeEvent.Listener);
- }
+ public class CodeRemoveEventStatementTests : CodeStatementTestBase<CodeRemoveEventStatement>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var removeEvent = new CodeRemoveEventStatement();
+ Assert.Empty(removeEvent.Event.EventName);
+ Assert.Null(removeEvent.Event.TargetObject);
+ Assert.Null(removeEvent.Listener);
+ }
- public static IEnumerable<object[]> Ctor_CodeExpression_String_CodeExpression_TestData()
- {
- yield return new object[] { null, null, null };
- yield return new object[] { new CodePrimitiveExpression("Value1"), "EventName", new CodePrimitiveExpression("Value2") };
- }
+ public static IEnumerable<object[]> Ctor_CodeExpression_String_CodeExpression_TestData()
+ {
+ yield return new object[] { null, null, null };
+ yield return new object[] { new CodePrimitiveExpression("Value1"), "EventName", new CodePrimitiveExpression("Value2") };
+ }
- [Theory]
- [MemberData(nameof(Ctor_CodeExpression_String_CodeExpression_TestData))]
- public void Ctor_CodeExpression_String_CodeExpression(CodeExpression targetObject, string eventName, CodeExpression listener)
- {
- var removeEvent = new CodeRemoveEventStatement(targetObject, eventName, listener);
- Assert.Equal(targetObject, removeEvent.Event.TargetObject);
- Assert.Equal(eventName ?? string.Empty, removeEvent.Event.EventName);
- Assert.Equal(listener, removeEvent.Listener);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_CodeExpression_String_CodeExpression_TestData))]
+ public void Ctor_CodeExpression_String_CodeExpression(CodeExpression targetObject, string eventName, CodeExpression listener)
+ {
+ var removeEvent = new CodeRemoveEventStatement(targetObject, eventName, listener);
+ Assert.Equal(targetObject, removeEvent.Event.TargetObject);
+ Assert.Equal(eventName ?? string.Empty, removeEvent.Event.EventName);
+ Assert.Equal(listener, removeEvent.Listener);
+ }
- public static IEnumerable<object[]> CodeEventReferenceExpression_CodeExpression_TestData()
- {
- yield return new object[] { null, null };
- yield return new object[] { new CodeEventReferenceExpression(null, null), null };
- yield return new object[] { new CodeEventReferenceExpression(new CodePrimitiveExpression("Value1"), "EventName"), new CodePrimitiveExpression("Value2") };
- }
+ public static IEnumerable<object[]> CodeEventReferenceExpression_CodeExpression_TestData()
+ {
+ yield return new object[] { null, null };
+ yield return new object[] { new CodeEventReferenceExpression(null, null), null };
+ yield return new object[] { new CodeEventReferenceExpression(new CodePrimitiveExpression("Value1"), "EventName"), new CodePrimitiveExpression("Value2") };
+ }
- [Theory]
- [MemberData(nameof(CodeEventReferenceExpression_CodeExpression_TestData))]
- public void Ctor_CodeEventReferenceExpression_CodeExpression(CodeEventReferenceExpression eventExpresion, CodeExpression listener)
- {
- var removeEvent = new CodeRemoveEventStatement(eventExpresion, listener);
- Assert.Equal((eventExpresion ?? new CodeEventReferenceExpression()).TargetObject, removeEvent.Event.TargetObject);
- Assert.Equal((eventExpresion ?? new CodeEventReferenceExpression()).EventName, removeEvent.Event.EventName);
- Assert.Equal(listener, removeEvent.Listener);
- }
+ [Theory]
+ [MemberData(nameof(CodeEventReferenceExpression_CodeExpression_TestData))]
+ public void Ctor_CodeEventReferenceExpression_CodeExpression(CodeEventReferenceExpression eventExpresion, CodeExpression listener)
+ {
+ var removeEvent = new CodeRemoveEventStatement(eventExpresion, listener);
+ Assert.Equal((eventExpresion ?? new CodeEventReferenceExpression()).TargetObject, removeEvent.Event.TargetObject);
+ Assert.Equal((eventExpresion ?? new CodeEventReferenceExpression()).EventName, removeEvent.Event.EventName);
+ Assert.Equal(listener, removeEvent.Listener);
+ }
- [Theory]
- [MemberData(nameof(CodeEventReferenceExpression_CodeExpression_TestData))]
- public void Event_Set_Get_ReturnsExpected(CodeEventReferenceExpression value, CodeExpression _)
- {
- var removeEvent = new CodeRemoveEventStatement();
- removeEvent.Event = value;
- Assert.Equal((value ?? new CodeEventReferenceExpression()).TargetObject, removeEvent.Event.TargetObject);
- Assert.Equal((value ?? new CodeEventReferenceExpression()).EventName, removeEvent.Event.EventName);
- }
+ [Theory]
+ [MemberData(nameof(CodeEventReferenceExpression_CodeExpression_TestData))]
+ public void Event_Set_Get_ReturnsExpected(CodeEventReferenceExpression value, CodeExpression _)
+ {
+ var removeEvent = new CodeRemoveEventStatement();
+ removeEvent.Event = value;
+ Assert.Equal((value ?? new CodeEventReferenceExpression()).TargetObject, removeEvent.Event.TargetObject);
+ Assert.Equal((value ?? new CodeEventReferenceExpression()).EventName, removeEvent.Event.EventName);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Listener_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var removeEvent = new CodeRemoveEventStatement();
- removeEvent.Listener = value;
- Assert.Equal(value, removeEvent.Listener);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Listener_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var removeEvent = new CodeRemoveEventStatement();
+ removeEvent.Listener = value;
+ Assert.Equal(value, removeEvent.Listener);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeSnippetCompileUnitTests : CodeObjectTestBase<CodeSnippetCompileUnit>
- {
- [Fact]
- public void Ctor_Default()
- {
- var compileUnit = new CodeSnippetCompileUnit();
- Assert.Empty(compileUnit.Value);
- Assert.Null(compileUnit.LinePragma);
- }
+ public class CodeSnippetCompileUnitTests : CodeObjectTestBase<CodeSnippetCompileUnit>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var compileUnit = new CodeSnippetCompileUnit();
+ Assert.Empty(compileUnit.Value);
+ Assert.Null(compileUnit.LinePragma);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Ctor_String(string value)
- {
- var compileUnit = new CodeSnippetCompileUnit(value);
- Assert.Equal(value ?? string.Empty, compileUnit.Value);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Ctor_String(string value)
+ {
+ var compileUnit = new CodeSnippetCompileUnit(value);
+ Assert.Equal(value ?? string.Empty, compileUnit.Value);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Value_Set_Get_ReturnsExpected(string value)
- {
- var compileUnit = new CodeSnippetCompileUnit();
- compileUnit.Value = value;
- Assert.Equal(value ?? string.Empty, compileUnit.Value);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Value_Set_Get_ReturnsExpected(string value)
+ {
+ var compileUnit = new CodeSnippetCompileUnit();
+ compileUnit.Value = value;
+ Assert.Equal(value ?? string.Empty, compileUnit.Value);
+ }
- [Theory]
- [MemberData(nameof(LinePragma_TestData))]
- public void LinePragma_Set_Get_ReturnsExpected(CodeLinePragma value)
- {
- var compileUnit = new CodeSnippetCompileUnit();
- compileUnit.LinePragma = value;
- Assert.Equal(value, compileUnit.LinePragma);
- }
- }
+ [Theory]
+ [MemberData(nameof(LinePragma_TestData))]
+ public void LinePragma_Set_Get_ReturnsExpected(CodeLinePragma value)
+ {
+ var compileUnit = new CodeSnippetCompileUnit();
+ compileUnit.LinePragma = value;
+ Assert.Equal(value, compileUnit.LinePragma);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeSnippetExpressionTests : CodeObjectTestBase<CodeSnippetExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var snippet = new CodeSnippetExpression();
- Assert.Empty(snippet.Value);
- }
+ public class CodeSnippetExpressionTests : CodeObjectTestBase<CodeSnippetExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var snippet = new CodeSnippetExpression();
+ Assert.Empty(snippet.Value);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Ctor_String(string value)
- {
- var snippet = new CodeSnippetExpression(value);
- Assert.Equal(value ?? string.Empty, snippet.Value);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Ctor_String(string value)
+ {
+ var snippet = new CodeSnippetExpression(value);
+ Assert.Equal(value ?? string.Empty, snippet.Value);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Value_Set_Get_ReturnsExpected(string value)
- {
- var snippet = new CodeSnippetExpression();
- snippet.Value = value;
- Assert.Equal(value ?? string.Empty, snippet.Value);
- }
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Value_Set_Get_ReturnsExpected(string value)
+ {
+ var snippet = new CodeSnippetExpression();
+ snippet.Value = value;
+ Assert.Equal(value ?? string.Empty, snippet.Value);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeSnippetStatementTests : CodeStatementTestBase<CodeSnippetStatement>
- {
- [Fact]
- public void Ctor_Default()
- {
- var snippet = new CodeSnippetStatement();
- Assert.Empty(snippet.Value);
- }
+ public class CodeSnippetStatementTests : CodeStatementTestBase<CodeSnippetStatement>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var snippet = new CodeSnippetStatement();
+ Assert.Empty(snippet.Value);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Ctor_String(string value)
- {
- var snippet = new CodeSnippetStatement(value);
- Assert.Equal(value ?? string.Empty, snippet.Value);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Ctor_String(string value)
+ {
+ var snippet = new CodeSnippetStatement(value);
+ Assert.Equal(value ?? string.Empty, snippet.Value);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Value_Set_Get_ReturnsExpected(string value)
- {
- var snippet = new CodeSnippetStatement();
- snippet.Value = value;
- Assert.Equal(value ?? string.Empty, snippet.Value);
- }
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Value_Set_Get_ReturnsExpected(string value)
+ {
+ var snippet = new CodeSnippetStatement();
+ snippet.Value = value;
+ Assert.Equal(value ?? string.Empty, snippet.Value);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeSnippetTypeMemberTests : CodeTypeMemberTestBase<CodeSnippetTypeMember>
- {
- [Fact]
- public void Ctor_Default()
- {
- var snippet = new CodeSnippetTypeMember();
- Assert.Empty(snippet.Name);
- }
+ public class CodeSnippetTypeMemberTests : CodeTypeMemberTestBase<CodeSnippetTypeMember>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var snippet = new CodeSnippetTypeMember();
+ Assert.Empty(snippet.Name);
+ }
- [Theory]
- [InlineData(null)]
- [InlineData("")]
- [InlineData("Text")]
- public void Ctor_String(string value)
- {
- var snippet = new CodeSnippetTypeMember(value);
- Assert.Equal(value ?? string.Empty, snippet.Text);
- }
+ [Theory]
+ [InlineData(null)]
+ [InlineData("")]
+ [InlineData("Text")]
+ public void Ctor_String(string value)
+ {
+ var snippet = new CodeSnippetTypeMember(value);
+ Assert.Equal(value ?? string.Empty, snippet.Text);
+ }
- [Theory]
- [InlineData(null)]
- [InlineData("")]
- [InlineData("Text")]
- public void Text_Set_Get_ReturnsExpected(string value)
- {
- var snippet = new CodeSnippetTypeMember();
- snippet.Text = value;
- Assert.Equal(value ?? string.Empty, snippet.Text);
- }
- }
+ [Theory]
+ [InlineData(null)]
+ [InlineData("")]
+ [InlineData("Text")]
+ public void Text_Set_Get_ReturnsExpected(string value)
+ {
+ var snippet = new CodeSnippetTypeMember();
+ snippet.Text = value;
+ Assert.Equal(value ?? string.Empty, snippet.Text);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public abstract class CodeStatementTestBase<T> : CodeObjectTestBase<T> where T : CodeStatement, new()
- {
- [Fact]
- public void Ctor_Default_StatementBase()
- {
- CodeStatement statement = new T();
- Assert.Null(statement.LinePragma);
-
- Assert.Empty(statement.StartDirectives);
- Assert.Empty(statement.EndDirectives);
- }
-
- [Theory]
- [MemberData(nameof(LinePragma_TestData))]
- public void LinePragma_Set_Get_ReturnsExpected(CodeLinePragma value)
- {
- CodeStatement statement = new T() { LinePragma = value };
- Assert.Equal(value, statement.LinePragma);
- }
-
- [Fact]
- public void StartDirectives_AddMultiple_ReturnsExpected()
- {
- CodeStatement statement = new T();
-
- CodeRegionDirective directive1 = new CodeRegionDirective(CodeRegionMode.None, "Region1");
- statement.StartDirectives.Add(directive1);
- Assert.Equal(new CodeRegionDirective[] { directive1 }, statement.StartDirectives.Cast<CodeDirective>());
-
- CodeRegionDirective directive2 = new CodeRegionDirective(CodeRegionMode.None, "Region2");
- statement.StartDirectives.Add(directive2);
- Assert.Equal(new CodeRegionDirective[] { directive1, directive2 }, statement.StartDirectives.Cast<CodeDirective>());
- }
-
- [Fact]
- public void EndDirectives_AddMultiple_ReturnsExpected()
- {
- CodeStatement statement = new T();
-
- CodeRegionDirective directive1 = new CodeRegionDirective(CodeRegionMode.None, "Region1");
- statement.EndDirectives.Add(directive1);
- Assert.Equal(new CodeRegionDirective[] { directive1 }, statement.EndDirectives.Cast<CodeDirective>());
-
- CodeRegionDirective directive2 = new CodeRegionDirective(CodeRegionMode.None, "Region2");
- statement.EndDirectives.Add(directive2);
- Assert.Equal(new CodeRegionDirective[] { directive1, directive2 }, statement.EndDirectives.Cast<CodeDirective>());
- }
- }
+ public abstract class CodeStatementTestBase<T> : CodeObjectTestBase<T> where T : CodeStatement, new()
+ {
+ [Fact]
+ public void Ctor_Default_StatementBase()
+ {
+ CodeStatement statement = new T();
+ Assert.Null(statement.LinePragma);
+
+ Assert.Empty(statement.StartDirectives);
+ Assert.Empty(statement.EndDirectives);
+ }
+
+ [Theory]
+ [MemberData(nameof(LinePragma_TestData))]
+ public void LinePragma_Set_Get_ReturnsExpected(CodeLinePragma value)
+ {
+ CodeStatement statement = new T() { LinePragma = value };
+ Assert.Equal(value, statement.LinePragma);
+ }
+
+ [Fact]
+ public void StartDirectives_AddMultiple_ReturnsExpected()
+ {
+ CodeStatement statement = new T();
+
+ CodeRegionDirective directive1 = new CodeRegionDirective(CodeRegionMode.None, "Region1");
+ statement.StartDirectives.Add(directive1);
+ Assert.Equal(new CodeRegionDirective[] { directive1 }, statement.StartDirectives.Cast<CodeDirective>());
+
+ CodeRegionDirective directive2 = new CodeRegionDirective(CodeRegionMode.None, "Region2");
+ statement.StartDirectives.Add(directive2);
+ Assert.Equal(new CodeRegionDirective[] { directive1, directive2 }, statement.StartDirectives.Cast<CodeDirective>());
+ }
+
+ [Fact]
+ public void EndDirectives_AddMultiple_ReturnsExpected()
+ {
+ CodeStatement statement = new T();
+
+ CodeRegionDirective directive1 = new CodeRegionDirective(CodeRegionMode.None, "Region1");
+ statement.EndDirectives.Add(directive1);
+ Assert.Equal(new CodeRegionDirective[] { directive1 }, statement.EndDirectives.Cast<CodeDirective>());
+
+ CodeRegionDirective directive2 = new CodeRegionDirective(CodeRegionMode.None, "Region2");
+ statement.EndDirectives.Add(directive2);
+ Assert.Equal(new CodeRegionDirective[] { directive1, directive2 }, statement.EndDirectives.Cast<CodeDirective>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeThrowExceptionStatementTests : CodeStatementTestBase<CodeThrowExceptionStatement>
- {
- [Fact]
- public void Ctor_Default()
- {
- var throwException = new CodeThrowExceptionStatement();
- Assert.Null(throwException.ToThrow);
- }
+ public class CodeThrowExceptionStatementTests : CodeStatementTestBase<CodeThrowExceptionStatement>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var throwException = new CodeThrowExceptionStatement();
+ Assert.Null(throwException.ToThrow);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Ctor_CodeExpression(CodeExpression expression)
- {
- var throwException = new CodeThrowExceptionStatement(expression);
- Assert.Equal(expression, throwException.ToThrow);
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Ctor_CodeExpression(CodeExpression expression)
+ {
+ var throwException = new CodeThrowExceptionStatement(expression);
+ Assert.Equal(expression, throwException.ToThrow);
+ }
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void Expression_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var throwException = new CodeThrowExceptionStatement();
- throwException.ToThrow = value;
- Assert.Equal(value, throwException.ToThrow);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void Expression_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var throwException = new CodeThrowExceptionStatement();
+ throwException.ToThrow = value;
+ Assert.Equal(value, throwException.ToThrow);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeTryCatchFinallyStatementTests : CodeStatementTestBase<CodeTryCatchFinallyStatement>
- {
- [Fact]
- public void Ctor_Default()
- {
- var tryCatchFinally = new CodeTryCatchFinallyStatement();
- Assert.Empty(tryCatchFinally.TryStatements);
- Assert.Empty(tryCatchFinally.CatchClauses);
- Assert.Empty(tryCatchFinally.FinallyStatements);
- }
-
- public static IEnumerable<object[]> Ctor_CodeStatementArray_CodeCatchClauseArray_TestData()
- {
- yield return new object[] { new CodeStatement[0], new CodeCatchClause[0] };
- yield return new object[] { new CodeStatement[] { new CodeCommentStatement("Comment") }, new CodeCatchClause[0] };
- yield return new object[] { new CodeStatement[0], new CodeCatchClause[] { new CodeCatchClause("Local") } };
- yield return new object[] { new CodeStatement[] { new CodeCommentStatement("Comment") }, new CodeCatchClause[] { new CodeCatchClause("Local") } };
- }
-
- [Theory]
- [MemberData(nameof(Ctor_CodeStatementArray_CodeCatchClauseArray_TestData))]
- public void Ctor_CodeStatementArray_CodeCatchClauseArray(CodeStatement[] tryStatements, CodeCatchClause[] catchClauses)
- {
- var tryCatchFinally = new CodeTryCatchFinallyStatement(tryStatements, catchClauses);
- Assert.Equal(tryStatements, tryCatchFinally.TryStatements.Cast<CodeStatement>());
- Assert.Equal(catchClauses, tryCatchFinally.CatchClauses.Cast<CodeCatchClause>());
- Assert.Empty(tryCatchFinally.FinallyStatements);
- }
-
- public static IEnumerable<object[]> Ctor_CodeStatementArray_CodeCatchClauseArray_CodeStatementArray_TestData()
- {
- yield return new object[] { new CodeStatement[0], new CodeCatchClause[0], new CodeStatement[0] };
- yield return new object[] { new CodeStatement[] { new CodeCommentStatement("Comment") }, new CodeCatchClause[0], new CodeStatement[0] };
- yield return new object[] { new CodeStatement[0], new CodeCatchClause[] { new CodeCatchClause("Local") }, new CodeStatement[0] };
- yield return new object[] { new CodeStatement[0], new CodeCatchClause[0], new CodeStatement[] { new CodeCommentStatement("Comment") } };
- yield return new object[] { new CodeStatement[] { new CodeCommentStatement("Comment") }, new CodeCatchClause[] { new CodeCatchClause("Local") }, new CodeStatement[] { new CodeCommentStatement("Comment") } };
- }
-
- [Theory]
- [MemberData(nameof(Ctor_CodeStatementArray_CodeCatchClauseArray_CodeStatementArray_TestData))]
- public void Ctor_CodeStatementArray_CodeCatchClauseArray_CodeStatementArray(CodeStatement[] tryStatements, CodeCatchClause[] catchClauses, CodeStatement[] finallyStatements)
- {
- var tryCatchFinally = new CodeTryCatchFinallyStatement(tryStatements, catchClauses, finallyStatements);
- Assert.Equal(tryStatements, tryCatchFinally.TryStatements.Cast<CodeStatement>());
- Assert.Equal(catchClauses, tryCatchFinally.CatchClauses.Cast<CodeCatchClause>());
- Assert.Equal(finallyStatements, tryCatchFinally.FinallyStatements.Cast<CodeStatement>());
- }
-
- [Fact]
- public void Ctor_NullTryStatements_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(null, new CodeCatchClause[0]));
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(null, new CodeCatchClause[0], new CodeStatement[0]));
- }
-
- [Fact]
- public void Ctor_NullObjectInTryStatements_ThrowsArgumentNullException()
- {
- CodeStatement[] tryStatements = new CodeStatement[] { null };
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(tryStatements, new CodeCatchClause[0]));
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(tryStatements, new CodeCatchClause[0], new CodeStatement[0]));
- }
-
- [Fact]
- public void Ctor_NullCodeCatchClauses_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(new CodeStatement[0], null));
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(new CodeStatement[0], null, new CodeStatement[0]));
- }
-
- [Fact]
- public void Ctor_NullObjectInCodeCatchClauses_ThrowsArgumentNullException()
- {
- CodeCatchClause[] catchClauses = new CodeCatchClause[] { null };
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(new CodeStatement[0], catchClauses));
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(new CodeStatement[0], catchClauses, new CodeStatement[0]));
- }
-
- [Fact]
- public void Ctor_NullFinallyStatements_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(new CodeStatement[0], new CodeCatchClause[0], null));
- }
-
- [Fact]
- public void Ctor_NullObjectInFinallyStatements_ThrowsArgumentNullException()
- {
- CodeStatement[] finallyStatements = new CodeStatement[] { null };
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(new CodeStatement[0], new CodeCatchClause[0], finallyStatements));
- }
-
- [Fact]
- public void TryStatements_AddMultiple_ReturnsExpected()
- {
- var tryCatchFinally = new CodeTryCatchFinallyStatement();
-
- CodeStatement statement1 = new CodeCommentStatement("Value1");
- tryCatchFinally.TryStatements.Add(statement1);
- Assert.Equal(new CodeStatement[] { statement1 }, tryCatchFinally.TryStatements.Cast<CodeStatement>());
-
- CodeStatement statement2 = new CodeCommentStatement("Value1");
- tryCatchFinally.TryStatements.Add(statement2);
- Assert.Equal(new CodeStatement[] { statement1, statement2 }, tryCatchFinally.TryStatements.Cast<CodeStatement>());
- }
-
- [Fact]
- public void CatchClauses_AddMultiple_ReturnsExpected()
- {
- var tryCatchFinally = new CodeTryCatchFinallyStatement();
-
- CodeCatchClause catchClause1 = new CodeCatchClause("Local1");
- tryCatchFinally.CatchClauses.Add(catchClause1);
- Assert.Equal(new CodeCatchClause[] { catchClause1 }, tryCatchFinally.CatchClauses.Cast<CodeCatchClause>());
-
- CodeCatchClause catchClause2 = new CodeCatchClause("Local2");
- tryCatchFinally.CatchClauses.Add(catchClause2);
- Assert.Equal(new CodeCatchClause[] { catchClause1, catchClause2 }, tryCatchFinally.CatchClauses.Cast<CodeCatchClause>());
- }
-
- [Fact]
- public void FinallyStatements_AddMultiple_ReturnsExpected()
- {
- var tryCatchFinally = new CodeTryCatchFinallyStatement();
-
- CodeStatement statement1 = new CodeCommentStatement("Value1");
- tryCatchFinally.FinallyStatements.Add(statement1);
- Assert.Equal(new CodeStatement[] { statement1 }, tryCatchFinally.FinallyStatements.Cast<CodeStatement>());
-
- CodeStatement statement2 = new CodeCommentStatement("Value1");
- tryCatchFinally.FinallyStatements.Add(statement2);
- Assert.Equal(new CodeStatement[] { statement1, statement2 }, tryCatchFinally.FinallyStatements.Cast<CodeStatement>());
- }
- }
+ public class CodeTryCatchFinallyStatementTests : CodeStatementTestBase<CodeTryCatchFinallyStatement>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var tryCatchFinally = new CodeTryCatchFinallyStatement();
+ Assert.Empty(tryCatchFinally.TryStatements);
+ Assert.Empty(tryCatchFinally.CatchClauses);
+ Assert.Empty(tryCatchFinally.FinallyStatements);
+ }
+
+ public static IEnumerable<object[]> Ctor_CodeStatementArray_CodeCatchClauseArray_TestData()
+ {
+ yield return new object[] { new CodeStatement[0], new CodeCatchClause[0] };
+ yield return new object[] { new CodeStatement[] { new CodeCommentStatement("Comment") }, new CodeCatchClause[0] };
+ yield return new object[] { new CodeStatement[0], new CodeCatchClause[] { new CodeCatchClause("Local") } };
+ yield return new object[] { new CodeStatement[] { new CodeCommentStatement("Comment") }, new CodeCatchClause[] { new CodeCatchClause("Local") } };
+ }
+
+ [Theory]
+ [MemberData(nameof(Ctor_CodeStatementArray_CodeCatchClauseArray_TestData))]
+ public void Ctor_CodeStatementArray_CodeCatchClauseArray(CodeStatement[] tryStatements, CodeCatchClause[] catchClauses)
+ {
+ var tryCatchFinally = new CodeTryCatchFinallyStatement(tryStatements, catchClauses);
+ Assert.Equal(tryStatements, tryCatchFinally.TryStatements.Cast<CodeStatement>());
+ Assert.Equal(catchClauses, tryCatchFinally.CatchClauses.Cast<CodeCatchClause>());
+ Assert.Empty(tryCatchFinally.FinallyStatements);
+ }
+
+ public static IEnumerable<object[]> Ctor_CodeStatementArray_CodeCatchClauseArray_CodeStatementArray_TestData()
+ {
+ yield return new object[] { new CodeStatement[0], new CodeCatchClause[0], new CodeStatement[0] };
+ yield return new object[] { new CodeStatement[] { new CodeCommentStatement("Comment") }, new CodeCatchClause[0], new CodeStatement[0] };
+ yield return new object[] { new CodeStatement[0], new CodeCatchClause[] { new CodeCatchClause("Local") }, new CodeStatement[0] };
+ yield return new object[] { new CodeStatement[0], new CodeCatchClause[0], new CodeStatement[] { new CodeCommentStatement("Comment") } };
+ yield return new object[] { new CodeStatement[] { new CodeCommentStatement("Comment") }, new CodeCatchClause[] { new CodeCatchClause("Local") }, new CodeStatement[] { new CodeCommentStatement("Comment") } };
+ }
+
+ [Theory]
+ [MemberData(nameof(Ctor_CodeStatementArray_CodeCatchClauseArray_CodeStatementArray_TestData))]
+ public void Ctor_CodeStatementArray_CodeCatchClauseArray_CodeStatementArray(CodeStatement[] tryStatements, CodeCatchClause[] catchClauses, CodeStatement[] finallyStatements)
+ {
+ var tryCatchFinally = new CodeTryCatchFinallyStatement(tryStatements, catchClauses, finallyStatements);
+ Assert.Equal(tryStatements, tryCatchFinally.TryStatements.Cast<CodeStatement>());
+ Assert.Equal(catchClauses, tryCatchFinally.CatchClauses.Cast<CodeCatchClause>());
+ Assert.Equal(finallyStatements, tryCatchFinally.FinallyStatements.Cast<CodeStatement>());
+ }
+
+ [Fact]
+ public void Ctor_NullTryStatements_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(null, new CodeCatchClause[0]));
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(null, new CodeCatchClause[0], new CodeStatement[0]));
+ }
+
+ [Fact]
+ public void Ctor_NullObjectInTryStatements_ThrowsArgumentNullException()
+ {
+ CodeStatement[] tryStatements = new CodeStatement[] { null };
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(tryStatements, new CodeCatchClause[0]));
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(tryStatements, new CodeCatchClause[0], new CodeStatement[0]));
+ }
+
+ [Fact]
+ public void Ctor_NullCodeCatchClauses_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(new CodeStatement[0], null));
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(new CodeStatement[0], null, new CodeStatement[0]));
+ }
+
+ [Fact]
+ public void Ctor_NullObjectInCodeCatchClauses_ThrowsArgumentNullException()
+ {
+ CodeCatchClause[] catchClauses = new CodeCatchClause[] { null };
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(new CodeStatement[0], catchClauses));
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(new CodeStatement[0], catchClauses, new CodeStatement[0]));
+ }
+
+ [Fact]
+ public void Ctor_NullFinallyStatements_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(new CodeStatement[0], new CodeCatchClause[0], null));
+ }
+
+ [Fact]
+ public void Ctor_NullObjectInFinallyStatements_ThrowsArgumentNullException()
+ {
+ CodeStatement[] finallyStatements = new CodeStatement[] { null };
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTryCatchFinallyStatement(new CodeStatement[0], new CodeCatchClause[0], finallyStatements));
+ }
+
+ [Fact]
+ public void TryStatements_AddMultiple_ReturnsExpected()
+ {
+ var tryCatchFinally = new CodeTryCatchFinallyStatement();
+
+ CodeStatement statement1 = new CodeCommentStatement("Value1");
+ tryCatchFinally.TryStatements.Add(statement1);
+ Assert.Equal(new CodeStatement[] { statement1 }, tryCatchFinally.TryStatements.Cast<CodeStatement>());
+
+ CodeStatement statement2 = new CodeCommentStatement("Value1");
+ tryCatchFinally.TryStatements.Add(statement2);
+ Assert.Equal(new CodeStatement[] { statement1, statement2 }, tryCatchFinally.TryStatements.Cast<CodeStatement>());
+ }
+
+ [Fact]
+ public void CatchClauses_AddMultiple_ReturnsExpected()
+ {
+ var tryCatchFinally = new CodeTryCatchFinallyStatement();
+
+ CodeCatchClause catchClause1 = new CodeCatchClause("Local1");
+ tryCatchFinally.CatchClauses.Add(catchClause1);
+ Assert.Equal(new CodeCatchClause[] { catchClause1 }, tryCatchFinally.CatchClauses.Cast<CodeCatchClause>());
+
+ CodeCatchClause catchClause2 = new CodeCatchClause("Local2");
+ tryCatchFinally.CatchClauses.Add(catchClause2);
+ Assert.Equal(new CodeCatchClause[] { catchClause1, catchClause2 }, tryCatchFinally.CatchClauses.Cast<CodeCatchClause>());
+ }
+
+ [Fact]
+ public void FinallyStatements_AddMultiple_ReturnsExpected()
+ {
+ var tryCatchFinally = new CodeTryCatchFinallyStatement();
+
+ CodeStatement statement1 = new CodeCommentStatement("Value1");
+ tryCatchFinally.FinallyStatements.Add(statement1);
+ Assert.Equal(new CodeStatement[] { statement1 }, tryCatchFinally.FinallyStatements.Cast<CodeStatement>());
+
+ CodeStatement statement2 = new CodeCommentStatement("Value1");
+ tryCatchFinally.FinallyStatements.Add(statement2);
+ Assert.Equal(new CodeStatement[] { statement1, statement2 }, tryCatchFinally.FinallyStatements.Cast<CodeStatement>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeTypeConstructorTests : CodeObjectTestBase<CodeTypeConstructor>
- {
- [Fact]
- public void Ctor_Default()
- {
- var constructor = new CodeTypeConstructor();
- Assert.Equal(".cctor", constructor.Name);
- }
- }
+ public class CodeTypeConstructorTests : CodeObjectTestBase<CodeTypeConstructor>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var constructor = new CodeTypeConstructor();
+ Assert.Equal(".cctor", constructor.Name);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeTypeDeclarationTests : CodeTypeMemberTestBase<CodeTypeDeclaration>
- {
- [Fact]
- public void Ctor_Default()
- {
- var declaration = new CodeTypeDeclaration();
- Assert.Empty(declaration.Name);
- Assert.True(declaration.IsClass);
- Assert.False(declaration.IsStruct);
- Assert.False(declaration.IsEnum);
- Assert.False(declaration.IsInterface);
- Assert.False(declaration.IsPartial);
- }
-
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Ctor_String(string name)
- {
- var declaration = new CodeTypeDeclaration(name);
- Assert.Equal(name ?? string.Empty, declaration.Name);
- }
-
- [Theory]
- [InlineData(true)]
- [InlineData(false)]
- public void IsClass_Set_Get_ReturnsTrue(bool value)
- {
- var declaration = new CodeTypeDeclaration();
- declaration.IsClass = value;
- Assert.True(declaration.IsClass);
- Assert.False(declaration.IsStruct);
- Assert.False(declaration.IsEnum);
- Assert.False(declaration.IsInterface);
- }
-
- [Fact]
- public void IsClass_SetTrue_WasStruct_ReturnsTrue()
- {
- var declaration = new CodeTypeDeclaration() { IsStruct = true };
- declaration.IsClass = true;
- Assert.False(declaration.IsStruct);
- Assert.False(declaration.IsEnum);
- Assert.False(declaration.IsInterface);
- }
-
- [Theory]
- [InlineData(true)]
- [InlineData(false)]
- public void IsStruct_Set_Get_ReturnsExpected(bool value)
- {
- var declaration = new CodeTypeDeclaration();
- declaration.IsStruct = value;
- Assert.Equal(value, declaration.IsStruct);
- Assert.Equal(!value, declaration.IsClass);
- Assert.False(declaration.IsEnum);
- Assert.False(declaration.IsInterface);
- }
-
- [Theory]
- [InlineData(true)]
- [InlineData(false)]
- public void IsEnum_Set_Get_ReturnsExpected(bool value)
- {
- var declaration = new CodeTypeDeclaration();
- declaration.IsEnum = value;
- Assert.Equal(value, declaration.IsEnum);
- Assert.Equal(!value, declaration.IsClass);
- Assert.False(declaration.IsStruct);
- Assert.False(declaration.IsInterface);
- }
-
- [Theory]
- [InlineData(true)]
- [InlineData(false)]
- public void IsInterface_Set_Get_ReturnsExpected(bool value)
- {
- var declaration = new CodeTypeDeclaration();
- declaration.IsInterface = value;
- Assert.Equal(value, declaration.IsInterface);
- Assert.Equal(!value, declaration.IsClass);
- Assert.False(declaration.IsStruct);
- Assert.False(declaration.IsEnum);
- }
-
- [Theory]
- [InlineData(true)]
- [InlineData(false)]
- public void IsPartial_Set_Get_ReturnsExpected(bool value)
- {
- var declaration = new CodeTypeDeclaration();
- declaration.IsPartial = value;
- Assert.Equal(value, declaration.IsPartial);
- }
-
- [Theory]
- [InlineData(TypeAttributes.Class - 1)]
- [InlineData(TypeAttributes.Class)]
- [InlineData(TypeAttributes.NotPublic | TypeAttributes.Public)]
- [InlineData((TypeAttributes)int.MaxValue)]
- public void TypeAttributes_Set_Get_ReturnExpected(TypeAttributes value)
- {
- var declaration = new CodeTypeDeclaration();
- declaration.TypeAttributes = value;
- Assert.Equal(value, declaration.TypeAttributes);
- }
-
- [Fact]
- public void BaseTypes_AddMultiple_ReturnsExpected()
- {
- var declaration = new CodeTypeDeclaration();
-
- CodeTypeReference type1 = new CodeTypeReference(typeof(int));
- declaration.BaseTypes.Add(type1);
- Assert.Equal(new CodeTypeReference[] { type1 }, declaration.BaseTypes.Cast<CodeTypeReference>());
-
- CodeTypeReference type2 = new CodeTypeReference(typeof(char));
- declaration.BaseTypes.Add(type2);
- Assert.Equal(new CodeTypeReference[] { type1, type2 }, declaration.BaseTypes.Cast<CodeTypeReference>());
- }
-
- [Fact]
- public void BaseTypes_Get_CallsPopulateBaseTypesOnce()
- {
- var declaration = new CodeTypeDeclaration();
- bool calledPopulateBaseTypes = false;
- declaration.PopulateBaseTypes += (object sender, EventArgs args) =>
- {
- calledPopulateBaseTypes = true;
- Assert.Same(declaration, sender);
- Assert.Equal(EventArgs.Empty, args);
- };
-
- declaration.BaseTypes.Add(new CodeTypeReference(typeof(int)));
- Assert.True(calledPopulateBaseTypes);
-
- // Only calls PopulateBaseTypes once
- calledPopulateBaseTypes = false;
- declaration.BaseTypes.Add(new CodeTypeReference(typeof(char)));
- Assert.False(calledPopulateBaseTypes);
- }
-
- [Fact]
- public void Members_AddMultiple_ReturnsExpected()
- {
- var declaration = new CodeTypeDeclaration();
-
- CodeTypeMember member1 = new CodeMemberField("Type", "Name1");
- declaration.Members.Add(member1);
- Assert.Equal(new CodeTypeMember[] { member1 }, declaration.Members.Cast<CodeTypeMember>());
-
- CodeTypeMember member2 = new CodeMemberField("Type", "Name1");
- declaration.Members.Add(member2);
- Assert.Equal(new CodeTypeMember[] { member1, member2 }, declaration.Members.Cast<CodeTypeMember>());
- }
-
- [Fact]
- public void Members_Get_CallsPopulateMembersOnce()
- {
- var declaration = new CodeTypeDeclaration();
- bool calledPopulateMembers = false;
- declaration.PopulateMembers += (object sender, EventArgs args) =>
- {
- calledPopulateMembers = true;
- Assert.Same(declaration, sender);
- Assert.Equal(EventArgs.Empty, args);
- };
-
- declaration.Members.Add(new CodeMemberField("Type", "Name1"));
- Assert.True(calledPopulateMembers);
-
- // Only calls PopulateMembers once
- calledPopulateMembers = false;
- declaration.Members.Add(new CodeMemberField("Type", "Name2"));
- Assert.False(calledPopulateMembers);
- }
-
- [Fact]
- public void TypeParameters_AddMultiple_ReturnsExpected()
- {
- var declaration = new CodeTypeDeclaration();
-
- CodeTypeParameter parameter1 = new CodeTypeParameter("Name1");
- declaration.TypeParameters.Add(parameter1);
- Assert.Equal(new CodeTypeParameter[] { parameter1 }, declaration.TypeParameters.Cast<CodeTypeParameter>());
-
- CodeTypeParameter parameter2 = new CodeTypeParameter("Name2");
- declaration.TypeParameters.Add(parameter2);
- Assert.Equal(new CodeTypeParameter[] { parameter1, parameter2 }, declaration.TypeParameters.Cast<CodeTypeParameter>());
- }
- }
+ public class CodeTypeDeclarationTests : CodeTypeMemberTestBase<CodeTypeDeclaration>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var declaration = new CodeTypeDeclaration();
+ Assert.Empty(declaration.Name);
+ Assert.True(declaration.IsClass);
+ Assert.False(declaration.IsStruct);
+ Assert.False(declaration.IsEnum);
+ Assert.False(declaration.IsInterface);
+ Assert.False(declaration.IsPartial);
+ }
+
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Ctor_String(string name)
+ {
+ var declaration = new CodeTypeDeclaration(name);
+ Assert.Equal(name ?? string.Empty, declaration.Name);
+ }
+
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void IsClass_Set_Get_ReturnsTrue(bool value)
+ {
+ var declaration = new CodeTypeDeclaration();
+ declaration.IsClass = value;
+ Assert.True(declaration.IsClass);
+ Assert.False(declaration.IsStruct);
+ Assert.False(declaration.IsEnum);
+ Assert.False(declaration.IsInterface);
+ }
+
+ [Fact]
+ public void IsClass_SetTrue_WasStruct_ReturnsTrue()
+ {
+ var declaration = new CodeTypeDeclaration() { IsStruct = true };
+ declaration.IsClass = true;
+ Assert.False(declaration.IsStruct);
+ Assert.False(declaration.IsEnum);
+ Assert.False(declaration.IsInterface);
+ }
+
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void IsStruct_Set_Get_ReturnsExpected(bool value)
+ {
+ var declaration = new CodeTypeDeclaration();
+ declaration.IsStruct = value;
+ Assert.Equal(value, declaration.IsStruct);
+ Assert.Equal(!value, declaration.IsClass);
+ Assert.False(declaration.IsEnum);
+ Assert.False(declaration.IsInterface);
+ }
+
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void IsEnum_Set_Get_ReturnsExpected(bool value)
+ {
+ var declaration = new CodeTypeDeclaration();
+ declaration.IsEnum = value;
+ Assert.Equal(value, declaration.IsEnum);
+ Assert.Equal(!value, declaration.IsClass);
+ Assert.False(declaration.IsStruct);
+ Assert.False(declaration.IsInterface);
+ }
+
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void IsInterface_Set_Get_ReturnsExpected(bool value)
+ {
+ var declaration = new CodeTypeDeclaration();
+ declaration.IsInterface = value;
+ Assert.Equal(value, declaration.IsInterface);
+ Assert.Equal(!value, declaration.IsClass);
+ Assert.False(declaration.IsStruct);
+ Assert.False(declaration.IsEnum);
+ }
+
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void IsPartial_Set_Get_ReturnsExpected(bool value)
+ {
+ var declaration = new CodeTypeDeclaration();
+ declaration.IsPartial = value;
+ Assert.Equal(value, declaration.IsPartial);
+ }
+
+ [Theory]
+ [InlineData(TypeAttributes.Class - 1)]
+ [InlineData(TypeAttributes.Class)]
+ [InlineData(TypeAttributes.NotPublic | TypeAttributes.Public)]
+ [InlineData((TypeAttributes)int.MaxValue)]
+ public void TypeAttributes_Set_Get_ReturnExpected(TypeAttributes value)
+ {
+ var declaration = new CodeTypeDeclaration();
+ declaration.TypeAttributes = value;
+ Assert.Equal(value, declaration.TypeAttributes);
+ }
+
+ [Fact]
+ public void BaseTypes_AddMultiple_ReturnsExpected()
+ {
+ var declaration = new CodeTypeDeclaration();
+
+ CodeTypeReference type1 = new CodeTypeReference(typeof(int));
+ declaration.BaseTypes.Add(type1);
+ Assert.Equal(new CodeTypeReference[] { type1 }, declaration.BaseTypes.Cast<CodeTypeReference>());
+
+ CodeTypeReference type2 = new CodeTypeReference(typeof(char));
+ declaration.BaseTypes.Add(type2);
+ Assert.Equal(new CodeTypeReference[] { type1, type2 }, declaration.BaseTypes.Cast<CodeTypeReference>());
+ }
+
+ [Fact]
+ public void BaseTypes_Get_CallsPopulateBaseTypesOnce()
+ {
+ var declaration = new CodeTypeDeclaration();
+ bool calledPopulateBaseTypes = false;
+ declaration.PopulateBaseTypes += (object sender, EventArgs args) =>
+ {
+ calledPopulateBaseTypes = true;
+ Assert.Same(declaration, sender);
+ Assert.Equal(EventArgs.Empty, args);
+ };
+
+ declaration.BaseTypes.Add(new CodeTypeReference(typeof(int)));
+ Assert.True(calledPopulateBaseTypes);
+
+ // Only calls PopulateBaseTypes once
+ calledPopulateBaseTypes = false;
+ declaration.BaseTypes.Add(new CodeTypeReference(typeof(char)));
+ Assert.False(calledPopulateBaseTypes);
+ }
+
+ [Fact]
+ public void Members_AddMultiple_ReturnsExpected()
+ {
+ var declaration = new CodeTypeDeclaration();
+
+ CodeTypeMember member1 = new CodeMemberField("Type", "Name1");
+ declaration.Members.Add(member1);
+ Assert.Equal(new CodeTypeMember[] { member1 }, declaration.Members.Cast<CodeTypeMember>());
+
+ CodeTypeMember member2 = new CodeMemberField("Type", "Name1");
+ declaration.Members.Add(member2);
+ Assert.Equal(new CodeTypeMember[] { member1, member2 }, declaration.Members.Cast<CodeTypeMember>());
+ }
+
+ [Fact]
+ public void Members_Get_CallsPopulateMembersOnce()
+ {
+ var declaration = new CodeTypeDeclaration();
+ bool calledPopulateMembers = false;
+ declaration.PopulateMembers += (object sender, EventArgs args) =>
+ {
+ calledPopulateMembers = true;
+ Assert.Same(declaration, sender);
+ Assert.Equal(EventArgs.Empty, args);
+ };
+
+ declaration.Members.Add(new CodeMemberField("Type", "Name1"));
+ Assert.True(calledPopulateMembers);
+
+ // Only calls PopulateMembers once
+ calledPopulateMembers = false;
+ declaration.Members.Add(new CodeMemberField("Type", "Name2"));
+ Assert.False(calledPopulateMembers);
+ }
+
+ [Fact]
+ public void TypeParameters_AddMultiple_ReturnsExpected()
+ {
+ var declaration = new CodeTypeDeclaration();
+
+ CodeTypeParameter parameter1 = new CodeTypeParameter("Name1");
+ declaration.TypeParameters.Add(parameter1);
+ Assert.Equal(new CodeTypeParameter[] { parameter1 }, declaration.TypeParameters.Cast<CodeTypeParameter>());
+
+ CodeTypeParameter parameter2 = new CodeTypeParameter("Name2");
+ declaration.TypeParameters.Add(parameter2);
+ Assert.Equal(new CodeTypeParameter[] { parameter1, parameter2 }, declaration.TypeParameters.Cast<CodeTypeParameter>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeTypeDelegateTests : CodeObjectTestBase<CodeTypeDelegate>
- {
- [Fact]
- public void Ctor_Default()
- {
- var typeDelegate = new CodeTypeDelegate();
- Assert.Empty(typeDelegate.Name);
+ public class CodeTypeDelegateTests : CodeObjectTestBase<CodeTypeDelegate>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var typeDelegate = new CodeTypeDelegate();
+ Assert.Empty(typeDelegate.Name);
- Assert.Equal(1, typeDelegate.BaseTypes.Count);
- Assert.Equal(typeof(Delegate).FullName, typeDelegate.BaseTypes[0].BaseType);
+ Assert.Equal(1, typeDelegate.BaseTypes.Count);
+ Assert.Equal(typeof(Delegate).FullName, typeDelegate.BaseTypes[0].BaseType);
- Assert.True(typeDelegate.IsClass);
+ Assert.True(typeDelegate.IsClass);
- Assert.Equal(typeof(void).FullName, typeDelegate.ReturnType.BaseType);
- Assert.Empty(typeDelegate.Parameters);
- }
+ Assert.Equal(typeof(void).FullName, typeDelegate.ReturnType.BaseType);
+ Assert.Empty(typeDelegate.Parameters);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Ctor_String(string name)
- {
- var typeDelegate = new CodeTypeDelegate(name);
- Assert.Equal(name ?? string.Empty, typeDelegate.Name);
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Ctor_String(string name)
+ {
+ var typeDelegate = new CodeTypeDelegate(name);
+ Assert.Equal(name ?? string.Empty, typeDelegate.Name);
- Assert.Equal(1, typeDelegate.BaseTypes.Count);
- Assert.Equal(typeof(Delegate).FullName, typeDelegate.BaseTypes[0].BaseType);
+ Assert.Equal(1, typeDelegate.BaseTypes.Count);
+ Assert.Equal(typeof(Delegate).FullName, typeDelegate.BaseTypes[0].BaseType);
- Assert.True(typeDelegate.IsClass);
+ Assert.True(typeDelegate.IsClass);
- Assert.Equal(typeof(void).FullName, typeDelegate.ReturnType.BaseType);
- Assert.Empty(typeDelegate.Parameters);
- }
+ Assert.Equal(typeof(void).FullName, typeDelegate.ReturnType.BaseType);
+ Assert.Empty(typeDelegate.Parameters);
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void ReturnType_Set_Get_ReturnsExpected(CodeTypeReference value)
- {
- var typeDelegate = new CodeTypeDelegate();
- typeDelegate.ReturnType = value;
- Assert.Equal((value ?? new CodeTypeReference("")).BaseType, typeDelegate.ReturnType.BaseType);
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void ReturnType_Set_Get_ReturnsExpected(CodeTypeReference value)
+ {
+ var typeDelegate = new CodeTypeDelegate();
+ typeDelegate.ReturnType = value;
+ Assert.Equal((value ?? new CodeTypeReference("")).BaseType, typeDelegate.ReturnType.BaseType);
+ }
- [Fact]
- public void Parameters_AddMultiple_ReturnsExpected()
- {
- var typeDelegate = new CodeTypeDelegate();
+ [Fact]
+ public void Parameters_AddMultiple_ReturnsExpected()
+ {
+ var typeDelegate = new CodeTypeDelegate();
- CodeParameterDeclarationExpression parameter1 = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name1");
- typeDelegate.Parameters.Add(parameter1);
- Assert.Equal(new CodeParameterDeclarationExpression[] { parameter1 }, typeDelegate.Parameters.Cast<CodeParameterDeclarationExpression>());
+ CodeParameterDeclarationExpression parameter1 = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name1");
+ typeDelegate.Parameters.Add(parameter1);
+ Assert.Equal(new CodeParameterDeclarationExpression[] { parameter1 }, typeDelegate.Parameters.Cast<CodeParameterDeclarationExpression>());
- CodeParameterDeclarationExpression parameter2 = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name2");
- typeDelegate.Parameters.Add(parameter2);
- Assert.Equal(new CodeParameterDeclarationExpression[] { parameter1, parameter2 }, typeDelegate.Parameters.Cast<CodeParameterDeclarationExpression>());
- }
- }
+ CodeParameterDeclarationExpression parameter2 = new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(int)), "name2");
+ typeDelegate.Parameters.Add(parameter2);
+ Assert.Equal(new CodeParameterDeclarationExpression[] { parameter1, parameter2 }, typeDelegate.Parameters.Cast<CodeParameterDeclarationExpression>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public abstract class CodeTypeMemberTestBase<T> : CodeObjectTestBase<T> where T : CodeTypeMember, new()
- {
- [Fact]
- public void Ctor_Default_MemberBase()
- {
- CodeTypeMember member = new T();
- Assert.Empty(member.Name);
-
- Assert.Equal(MemberAttributes.Private | MemberAttributes.Final, member.Attributes);
- Assert.Empty(member.CustomAttributes);
-
- Assert.Empty(member.Comments);
- Assert.Null(member.LinePragma);
-
- Assert.Empty(member.StartDirectives);
- Assert.Empty(member.EndDirectives);
- }
-
- [Theory]
- [InlineData("Name")]
- [InlineData("")]
- [InlineData(null)]
- public void Name_Set_Get_ReturnsExpected(string value)
- {
- CodeTypeMember member = new T() { Name = value };
- Assert.Equal(value ?? string.Empty, member.Name);
- }
-
- [Theory]
- [InlineData(MemberAttributes.Abstract)]
- [InlineData(MemberAttributes.Public)]
- [InlineData((MemberAttributes)0)]
- [InlineData((MemberAttributes)int.MaxValue)]
- public void Attrributes_Set_Get_ReturnsExpected(MemberAttributes value)
- {
- CodeTypeMember member = new T() { Attributes = value };
- Assert.Equal(value, member.Attributes);
- }
-
- [Fact]
- public void LinePragma_SetNull_Get_ReturnsNull()
- {
- CodeTypeMember member = new T() { LinePragma = null };
- Assert.Null(member.LinePragma);
- }
-
- [Fact]
- public void LinePragma_SetNonNull_Get_ReturnsExpected()
- {
- CodeLinePragma pragma = new CodeLinePragma("FileName", 1);
- CodeTypeMember member = new T() { LinePragma = pragma };
- Assert.Equal(pragma, member.LinePragma);
- }
-
- [Fact]
- public void CustomAttributes_SetNull_Get_ReturnsEmpty()
- {
- CodeTypeMember member = new T() { CustomAttributes = null };
- Assert.Empty(member.CustomAttributes);
- }
-
- [Fact]
- public void CustomAttributes_SetNonNull_Get_ReturnsExpected()
- {
- CodeTypeMember member = new T() { CustomAttributes = null };
- CodeAttributeDeclarationCollection value = new CodeAttributeDeclarationCollection();
- value.Add(new CodeAttributeDeclaration("Name1"));
- value.Add(new CodeAttributeDeclaration("Name2"));
-
- member.CustomAttributes = value;
- Assert.Equal(value, member.CustomAttributes);
- }
-
- [Fact]
- public void CustomAttributes_AddMultiple_ReturnsExpected()
- {
- CodeTypeMember member = new T();
-
- CodeAttributeDeclaration attribute1 = new CodeAttributeDeclaration("Name1");
- member.CustomAttributes.Add(attribute1);
- Assert.Equal(new CodeAttributeDeclaration[] { attribute1 }, member.CustomAttributes.Cast<CodeAttributeDeclaration>());
-
- CodeAttributeDeclaration attribute2 = new CodeAttributeDeclaration("Name2");
- member.CustomAttributes.Add(attribute2);
- Assert.Equal(new CodeAttributeDeclaration[] { attribute1, attribute2 }, member.CustomAttributes.Cast<CodeAttributeDeclaration>());
- }
-
- [Fact]
- public void Comments_AddMultiple_ReturnsExpected()
- {
- CodeTypeMember member = new T();
-
- CodeCommentStatement comment1 = new CodeCommentStatement("Comment1");
- member.Comments.Add(comment1);
- Assert.Equal(new CodeCommentStatement[] { comment1 }, member.Comments.Cast<CodeCommentStatement>());
-
- CodeCommentStatement comment2 = new CodeCommentStatement("Comment2");
- member.Comments.Add(comment2);
- Assert.Equal(new CodeCommentStatement[] { comment1, comment2 }, member.Comments.Cast<CodeCommentStatement>());
- }
-
- [Fact]
- public void StartDirectives_AddMultiple_ReturnsExpected()
- {
- CodeTypeMember member = new T();
-
- CodeRegionDirective directive1 = new CodeRegionDirective(CodeRegionMode.None, "Region1");
- member.StartDirectives.Add(directive1);
- Assert.Equal(new CodeRegionDirective[] { directive1 }, member.StartDirectives.Cast<CodeDirective>());
-
- CodeRegionDirective directive2 = new CodeRegionDirective(CodeRegionMode.None, "Region2");
- member.StartDirectives.Add(directive2);
- Assert.Equal(new CodeRegionDirective[] { directive1, directive2 }, member.StartDirectives.Cast<CodeDirective>());
- }
-
- [Fact]
- public void EndDirectives_AddMultiple_ReturnsExpected()
- {
- CodeTypeMember member = new T();
-
- CodeRegionDirective directive1 = new CodeRegionDirective(CodeRegionMode.None, "Region1");
- member.EndDirectives.Add(directive1);
- Assert.Equal(new CodeRegionDirective[] { directive1 }, member.EndDirectives.Cast<CodeDirective>());
-
- CodeRegionDirective directive2 = new CodeRegionDirective(CodeRegionMode.None, "Region2");
- member.EndDirectives.Add(directive2);
- Assert.Equal(new CodeRegionDirective[] { directive1, directive2 }, member.EndDirectives.Cast<CodeDirective>());
- }
- }
+ public abstract class CodeTypeMemberTestBase<T> : CodeObjectTestBase<T> where T : CodeTypeMember, new()
+ {
+ [Fact]
+ public void Ctor_Default_MemberBase()
+ {
+ CodeTypeMember member = new T();
+ Assert.Empty(member.Name);
+
+ Assert.Equal(MemberAttributes.Private | MemberAttributes.Final, member.Attributes);
+ Assert.Empty(member.CustomAttributes);
+
+ Assert.Empty(member.Comments);
+ Assert.Null(member.LinePragma);
+
+ Assert.Empty(member.StartDirectives);
+ Assert.Empty(member.EndDirectives);
+ }
+
+ [Theory]
+ [InlineData("Name")]
+ [InlineData("")]
+ [InlineData(null)]
+ public void Name_Set_Get_ReturnsExpected(string value)
+ {
+ CodeTypeMember member = new T() { Name = value };
+ Assert.Equal(value ?? string.Empty, member.Name);
+ }
+
+ [Theory]
+ [InlineData(MemberAttributes.Abstract)]
+ [InlineData(MemberAttributes.Public)]
+ [InlineData((MemberAttributes)0)]
+ [InlineData((MemberAttributes)int.MaxValue)]
+ public void Attrributes_Set_Get_ReturnsExpected(MemberAttributes value)
+ {
+ CodeTypeMember member = new T() { Attributes = value };
+ Assert.Equal(value, member.Attributes);
+ }
+
+ [Fact]
+ public void LinePragma_SetNull_Get_ReturnsNull()
+ {
+ CodeTypeMember member = new T() { LinePragma = null };
+ Assert.Null(member.LinePragma);
+ }
+
+ [Fact]
+ public void LinePragma_SetNonNull_Get_ReturnsExpected()
+ {
+ CodeLinePragma pragma = new CodeLinePragma("FileName", 1);
+ CodeTypeMember member = new T() { LinePragma = pragma };
+ Assert.Equal(pragma, member.LinePragma);
+ }
+
+ [Fact]
+ public void CustomAttributes_SetNull_Get_ReturnsEmpty()
+ {
+ CodeTypeMember member = new T() { CustomAttributes = null };
+ Assert.Empty(member.CustomAttributes);
+ }
+
+ [Fact]
+ public void CustomAttributes_SetNonNull_Get_ReturnsExpected()
+ {
+ CodeTypeMember member = new T() { CustomAttributes = null };
+ CodeAttributeDeclarationCollection value = new CodeAttributeDeclarationCollection();
+ value.Add(new CodeAttributeDeclaration("Name1"));
+ value.Add(new CodeAttributeDeclaration("Name2"));
+
+ member.CustomAttributes = value;
+ Assert.Equal(value, member.CustomAttributes);
+ }
+
+ [Fact]
+ public void CustomAttributes_AddMultiple_ReturnsExpected()
+ {
+ CodeTypeMember member = new T();
+
+ CodeAttributeDeclaration attribute1 = new CodeAttributeDeclaration("Name1");
+ member.CustomAttributes.Add(attribute1);
+ Assert.Equal(new CodeAttributeDeclaration[] { attribute1 }, member.CustomAttributes.Cast<CodeAttributeDeclaration>());
+
+ CodeAttributeDeclaration attribute2 = new CodeAttributeDeclaration("Name2");
+ member.CustomAttributes.Add(attribute2);
+ Assert.Equal(new CodeAttributeDeclaration[] { attribute1, attribute2 }, member.CustomAttributes.Cast<CodeAttributeDeclaration>());
+ }
+
+ [Fact]
+ public void Comments_AddMultiple_ReturnsExpected()
+ {
+ CodeTypeMember member = new T();
+
+ CodeCommentStatement comment1 = new CodeCommentStatement("Comment1");
+ member.Comments.Add(comment1);
+ Assert.Equal(new CodeCommentStatement[] { comment1 }, member.Comments.Cast<CodeCommentStatement>());
+
+ CodeCommentStatement comment2 = new CodeCommentStatement("Comment2");
+ member.Comments.Add(comment2);
+ Assert.Equal(new CodeCommentStatement[] { comment1, comment2 }, member.Comments.Cast<CodeCommentStatement>());
+ }
+
+ [Fact]
+ public void StartDirectives_AddMultiple_ReturnsExpected()
+ {
+ CodeTypeMember member = new T();
+
+ CodeRegionDirective directive1 = new CodeRegionDirective(CodeRegionMode.None, "Region1");
+ member.StartDirectives.Add(directive1);
+ Assert.Equal(new CodeRegionDirective[] { directive1 }, member.StartDirectives.Cast<CodeDirective>());
+
+ CodeRegionDirective directive2 = new CodeRegionDirective(CodeRegionMode.None, "Region2");
+ member.StartDirectives.Add(directive2);
+ Assert.Equal(new CodeRegionDirective[] { directive1, directive2 }, member.StartDirectives.Cast<CodeDirective>());
+ }
+
+ [Fact]
+ public void EndDirectives_AddMultiple_ReturnsExpected()
+ {
+ CodeTypeMember member = new T();
+
+ CodeRegionDirective directive1 = new CodeRegionDirective(CodeRegionMode.None, "Region1");
+ member.EndDirectives.Add(directive1);
+ Assert.Equal(new CodeRegionDirective[] { directive1 }, member.EndDirectives.Cast<CodeDirective>());
+
+ CodeRegionDirective directive2 = new CodeRegionDirective(CodeRegionMode.None, "Region2");
+ member.EndDirectives.Add(directive2);
+ Assert.Equal(new CodeRegionDirective[] { directive1, directive2 }, member.EndDirectives.Cast<CodeDirective>());
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeTypeOfExpressionTests : CodeObjectTestBase<CodeTypeOfExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var typeofExpression = new CodeTypeOfExpression();
- Assert.Equal(typeof(void).FullName, typeofExpression.Type.BaseType);
- }
+ public class CodeTypeOfExpressionTests : CodeObjectTestBase<CodeTypeOfExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var typeofExpression = new CodeTypeOfExpression();
+ Assert.Equal(typeof(void).FullName, typeofExpression.Type.BaseType);
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Ctor_CodeTypeReference_CodeExpression(CodeTypeReference type)
- {
- var typeofExpression = new CodeTypeOfExpression(type);
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, typeofExpression.Type.BaseType);
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Ctor_CodeTypeReference_CodeExpression(CodeTypeReference type)
+ {
+ var typeofExpression = new CodeTypeOfExpression(type);
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, typeofExpression.Type.BaseType);
+ }
- public static IEnumerable<object[]> Ctor_TypeString_TestData()
- {
- yield return new object[] { null, "System.Void" };
- yield return new object[] { "", "System.Void" };
- yield return new object[] { "Int32", "Int32" };
- }
+ public static IEnumerable<object[]> Ctor_TypeString_TestData()
+ {
+ yield return new object[] { null, "System.Void" };
+ yield return new object[] { "", "System.Void" };
+ yield return new object[] { "Int32", "Int32" };
+ }
- [Theory]
- [MemberData(nameof(Ctor_TypeString_TestData))]
- public void Ctor_String_CodeExpression(string type, string expectedBaseType)
- {
- var typeofExpression = new CodeTypeOfExpression(type);
- Assert.Equal(expectedBaseType, typeofExpression.Type.BaseType);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_TypeString_TestData))]
+ public void Ctor_String_CodeExpression(string type, string expectedBaseType)
+ {
+ var typeofExpression = new CodeTypeOfExpression(type);
+ Assert.Equal(expectedBaseType, typeofExpression.Type.BaseType);
+ }
- public static IEnumerable<object[]> Ctor_Type_TestData()
- {
- yield return new object[] { typeof(int), "System.Int32" };
- yield return new object[] { typeof(List<>), "System.Collections.Generic.List`1" };
- yield return new object[] { typeof(void), "System.Void" };
- }
+ public static IEnumerable<object[]> Ctor_Type_TestData()
+ {
+ yield return new object[] { typeof(int), "System.Int32" };
+ yield return new object[] { typeof(List<>), "System.Collections.Generic.List`1" };
+ yield return new object[] { typeof(void), "System.Void" };
+ }
- [Theory]
- [MemberData(nameof(Ctor_Type_TestData))]
- public void Ctor_Type_CodeExpression(Type type, string expectedBaseType)
- {
- var typeofExpression = new CodeTypeOfExpression(type);
- Assert.Equal(expectedBaseType, typeofExpression.Type.BaseType);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_Type_TestData))]
+ public void Ctor_Type_CodeExpression(Type type, string expectedBaseType)
+ {
+ var typeofExpression = new CodeTypeOfExpression(type);
+ Assert.Equal(expectedBaseType, typeofExpression.Type.BaseType);
+ }
- [Fact]
- public void Ctor_NullType_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeTypeOfExpression((Type)null));
- }
+ [Fact]
+ public void Ctor_NullType_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeTypeOfExpression((Type)null));
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Type_Set_Get_ReturnsExpected(CodeTypeReference value)
- {
- var typeofExpression = new CodeTypeOfExpression();
- typeofExpression.Type = value;
- Assert.Equal((value ?? new CodeTypeReference("")).BaseType, typeofExpression.Type.BaseType);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Type_Set_Get_ReturnsExpected(CodeTypeReference value)
+ {
+ var typeofExpression = new CodeTypeOfExpression();
+ typeofExpression.Type = value;
+ Assert.Equal((value ?? new CodeTypeReference("")).BaseType, typeofExpression.Type.BaseType);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeTypeParameterTests : CodeObjectTestBase<CodeTypeParameter>
- {
- [Fact]
- public void Ctor_Default()
- {
- var typeParameter = new CodeTypeParameter();
- Assert.Empty(typeParameter.Name);
- Assert.Empty(typeParameter.Constraints);
- Assert.Empty(typeParameter.CustomAttributes);
- Assert.False(typeParameter.HasConstructorConstraint);
- }
+ public class CodeTypeParameterTests : CodeObjectTestBase<CodeTypeParameter>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var typeParameter = new CodeTypeParameter();
+ Assert.Empty(typeParameter.Name);
+ Assert.Empty(typeParameter.Constraints);
+ Assert.Empty(typeParameter.CustomAttributes);
+ Assert.False(typeParameter.HasConstructorConstraint);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Ctor_String(string name)
- {
- var typeParameter = new CodeTypeParameter(name);
- Assert.Equal(name ?? string.Empty, typeParameter.Name);
- Assert.Empty(typeParameter.Constraints);
- Assert.Empty(typeParameter.CustomAttributes);
- Assert.False(typeParameter.HasConstructorConstraint);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Ctor_String(string name)
+ {
+ var typeParameter = new CodeTypeParameter(name);
+ Assert.Equal(name ?? string.Empty, typeParameter.Name);
+ Assert.Empty(typeParameter.Constraints);
+ Assert.Empty(typeParameter.CustomAttributes);
+ Assert.False(typeParameter.HasConstructorConstraint);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Name_Set_Get_ReturnsExpected(string value)
- {
- var typeParameter = new CodeTypeParameter();
- typeParameter.Name = value;
- Assert.Equal(value ?? string.Empty, typeParameter.Name);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Name_Set_Get_ReturnsExpected(string value)
+ {
+ var typeParameter = new CodeTypeParameter();
+ typeParameter.Name = value;
+ Assert.Equal(value ?? string.Empty, typeParameter.Name);
+ }
- [Fact]
- public void Constraints_AddMultiple_ReturnsExpected()
- {
- var typeParameter = new CodeTypeParameter();
+ [Fact]
+ public void Constraints_AddMultiple_ReturnsExpected()
+ {
+ var typeParameter = new CodeTypeParameter();
- CodeTypeReference type1 = new CodeTypeReference(typeof(int));
- typeParameter.Constraints.Add(type1);
- Assert.Equal(new CodeTypeReference[] { type1 }, typeParameter.Constraints.Cast<CodeTypeReference>());
+ CodeTypeReference type1 = new CodeTypeReference(typeof(int));
+ typeParameter.Constraints.Add(type1);
+ Assert.Equal(new CodeTypeReference[] { type1 }, typeParameter.Constraints.Cast<CodeTypeReference>());
- CodeTypeReference type2 = new CodeTypeReference(typeof(int));
- typeParameter.Constraints.Add(type2);
- Assert.Equal(new CodeTypeReference[] { type1, type2 }, typeParameter.Constraints.Cast<CodeTypeReference>());
- }
+ CodeTypeReference type2 = new CodeTypeReference(typeof(int));
+ typeParameter.Constraints.Add(type2);
+ Assert.Equal(new CodeTypeReference[] { type1, type2 }, typeParameter.Constraints.Cast<CodeTypeReference>());
+ }
- [Fact]
- public void CustomAttributes_AddMultiple_ReturnsExpected()
- {
- var typeParameter = new CodeTypeParameter();
+ [Fact]
+ public void CustomAttributes_AddMultiple_ReturnsExpected()
+ {
+ var typeParameter = new CodeTypeParameter();
- CodeAttributeDeclaration attribute1 = new CodeAttributeDeclaration("Name1");
- typeParameter.CustomAttributes.Add(attribute1);
- Assert.Equal(new CodeAttributeDeclaration[] { attribute1 }, typeParameter.CustomAttributes.Cast<CodeAttributeDeclaration>());
+ CodeAttributeDeclaration attribute1 = new CodeAttributeDeclaration("Name1");
+ typeParameter.CustomAttributes.Add(attribute1);
+ Assert.Equal(new CodeAttributeDeclaration[] { attribute1 }, typeParameter.CustomAttributes.Cast<CodeAttributeDeclaration>());
- CodeAttributeDeclaration attribute2 = new CodeAttributeDeclaration("Name2");
- typeParameter.CustomAttributes.Add(attribute2);
- Assert.Equal(new CodeAttributeDeclaration[] { attribute1, attribute2 }, typeParameter.CustomAttributes.Cast<CodeAttributeDeclaration>());
- }
+ CodeAttributeDeclaration attribute2 = new CodeAttributeDeclaration("Name2");
+ typeParameter.CustomAttributes.Add(attribute2);
+ Assert.Equal(new CodeAttributeDeclaration[] { attribute1, attribute2 }, typeParameter.CustomAttributes.Cast<CodeAttributeDeclaration>());
+ }
- [Theory]
- [InlineData(true)]
- [InlineData(false)]
- public void HasConstructorConstraint_Get_Set_ReturnsExpected(bool value)
- {
- var typeParameter = new CodeTypeParameter();
- typeParameter.HasConstructorConstraint = value;
- Assert.Equal(value, typeParameter.HasConstructorConstraint);
- }
- }
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void HasConstructorConstraint_Get_Set_ReturnsExpected(bool value)
+ {
+ var typeParameter = new CodeTypeParameter();
+ typeParameter.HasConstructorConstraint = value;
+ Assert.Equal(value, typeParameter.HasConstructorConstraint);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeTypeReferenceExpressionTests : CodeObjectTestBase<CodeTypeReferenceExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var typeReference = new CodeTypeReferenceExpression();
- Assert.Equal(typeof(void).FullName, typeReference.Type.BaseType);
- }
+ public class CodeTypeReferenceExpressionTests : CodeObjectTestBase<CodeTypeReferenceExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var typeReference = new CodeTypeReferenceExpression();
+ Assert.Equal(typeof(void).FullName, typeReference.Type.BaseType);
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Ctor_CodeTypeReference_CodeExpression(CodeTypeReference type)
- {
- var typeReference = new CodeTypeReferenceExpression(type);
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, typeReference.Type.BaseType);
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Ctor_CodeTypeReference_CodeExpression(CodeTypeReference type)
+ {
+ var typeReference = new CodeTypeReferenceExpression(type);
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, typeReference.Type.BaseType);
+ }
- public static IEnumerable<object[]> Ctor_TypeString_TestData()
- {
- yield return new object[] { null, "System.Void" };
- yield return new object[] { "", "System.Void" };
- yield return new object[] { "Int32", "Int32" };
- }
+ public static IEnumerable<object[]> Ctor_TypeString_TestData()
+ {
+ yield return new object[] { null, "System.Void" };
+ yield return new object[] { "", "System.Void" };
+ yield return new object[] { "Int32", "Int32" };
+ }
- [Theory]
- [MemberData(nameof(Ctor_TypeString_TestData))]
- public void Ctor_String_CodeExpression(string type, string expectedBaseType)
- {
- var typeReference = new CodeTypeReferenceExpression(type);
- Assert.Equal(expectedBaseType, typeReference.Type.BaseType);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_TypeString_TestData))]
+ public void Ctor_String_CodeExpression(string type, string expectedBaseType)
+ {
+ var typeReference = new CodeTypeReferenceExpression(type);
+ Assert.Equal(expectedBaseType, typeReference.Type.BaseType);
+ }
- public static IEnumerable<object[]> Ctor_Type_TestData()
- {
- yield return new object[] { typeof(int), "System.Int32" };
- yield return new object[] { typeof(List<>), "System.Collections.Generic.List`1" };
- yield return new object[] { typeof(void), "System.Void" };
- }
+ public static IEnumerable<object[]> Ctor_Type_TestData()
+ {
+ yield return new object[] { typeof(int), "System.Int32" };
+ yield return new object[] { typeof(List<>), "System.Collections.Generic.List`1" };
+ yield return new object[] { typeof(void), "System.Void" };
+ }
- [Theory]
- [MemberData(nameof(Ctor_Type_TestData))]
- public void Ctor_Type_CodeExpression(Type type, string expectedBaseType)
- {
- var typeReference = new CodeTypeReferenceExpression(type);
- Assert.Equal(expectedBaseType, typeReference.Type.BaseType);
- }
+ [Theory]
+ [MemberData(nameof(Ctor_Type_TestData))]
+ public void Ctor_Type_CodeExpression(Type type, string expectedBaseType)
+ {
+ var typeReference = new CodeTypeReferenceExpression(type);
+ Assert.Equal(expectedBaseType, typeReference.Type.BaseType);
+ }
- [Fact]
- public void Ctor_NullType_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeTypeReferenceExpression((Type)null));
- }
+ [Fact]
+ public void Ctor_NullType_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeTypeReferenceExpression((Type)null));
+ }
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Type_Set_Get_ReturnsExpected(CodeTypeReference value)
- {
- var typeReference = new CodeTypeReferenceExpression();
- typeReference.Type = value;
- Assert.Equal((value ?? new CodeTypeReference("")).BaseType, typeReference.Type.BaseType);
- }
- }
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Type_Set_Get_ReturnsExpected(CodeTypeReference value)
+ {
+ var typeReference = new CodeTypeReferenceExpression();
+ typeReference.Type = value;
+ Assert.Equal((value ?? new CodeTypeReference("")).BaseType, typeReference.Type.BaseType);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeTypeReferenceTests : CodeObjectTestBase<CodeTypeReference>
- {
- [Fact]
- public void Ctor_Default()
- {
- var type = new CodeTypeReference();
- Assert.Null(type.ArrayElementType);
- Assert.Equal(0, type.ArrayRank);
- Assert.Empty(type.BaseType);
- Assert.Equal((CodeTypeReferenceOptions)0, type.Options);
- Assert.Empty(type.TypeArguments);
- }
-
- public static IEnumerable<object[]> Ctor_Type_TestData()
- {
- yield return new object[] { typeof(int), typeof(int).FullName };
- yield return new object[] { typeof(int[]), typeof(int).FullName };
- yield return new object[] { typeof(int[,]), typeof(int).FullName };
- yield return new object[] { typeof(int).MakeByRefType(), typeof(int).MakeByRefType().FullName };
- yield return new object[] { typeof(int).MakePointerType(), typeof(int).MakePointerType().FullName };
- yield return new object[] { typeof(List<int>), typeof(List<>).FullName };
- yield return new object[] { typeof(List<>), typeof(List<>).FullName };
- yield return new object[] { typeof(List<>).GetGenericArguments()[0], "T" };
- yield return new object[] { typeof(void), typeof(void).FullName };
- yield return new object[] { typeof(NestedClass), typeof(NestedClass).FullName };
- yield return new object[] { typeof(ClassWithoutNamespace), typeof(ClassWithoutNamespace).FullName };
- yield return new object[] { typeof(Nullable), typeof(Nullable).FullName };
- }
-
- [Theory]
- [MemberData(nameof(Ctor_Type_TestData))]
- public void Ctor_Type(Type type, string expectedBaseType)
- {
- var typeReference = new CodeTypeReference(type);
- string expectedArrayElementType = type.IsArray ? type.GetElementType().FullName : null;
- int expectedArrayRank = type.IsArray ? type.GetArrayRank() : 0;
- string[] expectedTypeArguments = type.GenericTypeArguments.Select(arg => arg.IsGenericType ? arg.GetGenericTypeDefinition().FullName : arg.FullName).ToArray();
- VerifyCodeTypeReference(typeReference, expectedBaseType, expectedArrayElementType, expectedArrayRank, expectedTypeArguments);
- }
-
- [Theory]
- [InlineData(typeof(int), (CodeTypeReferenceOptions)(-1))]
- [InlineData(typeof(object), (CodeTypeReferenceOptions)0)]
- [InlineData(typeof(void), CodeTypeReferenceOptions.GenericTypeParameter)]
- [InlineData(typeof(string), CodeTypeReferenceOptions.GenericTypeParameter + 1)]
- public void Ctor_Type_CodeReferenceTypeOptions_TestData(Type type, CodeTypeReferenceOptions options)
- {
- var typeReference = new CodeTypeReference(type, options);
- Assert.Equal(type.FullName, typeReference.BaseType);
- Assert.Equal(options, typeReference.Options);
- }
-
- [Fact]
- public void Ctor_NullType_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeTypeReference((Type)null));
- AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeTypeReference((Type)null, CodeTypeReferenceOptions.GenericTypeParameter));
- }
-
- public static IEnumerable<object[]> Ctor_String_TestData()
- {
- // Basic
- yield return new object[] { "System.Int32", typeof(int).FullName, null, 0, new string[0] };
- yield return new object[] { "System.Int32*", typeof(int).MakePointerType().FullName, null, 0, new string[0] };
- yield return new object[] { "System.Int32&", typeof(int).MakeByRefType().FullName, null, 0, new string[0] };
- yield return new object[] { "NoSuchType", "NoSuchType", null, 0, new string[0] };
-
- // Arrays
- yield return new object[] { "System.Int32[]", typeof(int).FullName, typeof(int).FullName, 1, new string[0] };
- yield return new object[] { "System.Int32[,]", typeof(int).FullName, typeof(int).FullName, 2, new string[0] };
- yield return new object[] { "System.Int32[][]", typeof(int).FullName, typeof(int).FullName, 1, new string[0] };
-
- // Generic
- yield return new object[] { "System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089], [System.Collections.Generic.List`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", typeof(Dictionary<,>).FullName, null, 0, new string[] { "System.String", "System.Collections.Generic.List`1" } };
- yield return new object[] { "[System.Collections.Generic.List[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral,PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]", "System.Collections.Generic.List", null, 0, new string[] { "System.String" } };
-
- // Empty
- yield return new object[] { null, typeof(void).FullName, null, 0, new string[0] };
- yield return new object[] { "", typeof(void).FullName, null, 0, new string[0] };
- yield return new object[] { " \r \t \n ", " \r \t \n ", null, 0, new string[0] };
-
- // Invalid assembly qualified name
- yield return new object[] { "[]", "[]", null, 0, new string[0] };
- yield return new object[] { "[]]", "[]]", null, 0, new string[0] };
- yield return new object[] { "[[]", "[", "[", 1, new string[0] };
- yield return new object[] { "[[]]", "[[]]", null, 0, new string[0] };
- yield return new object[] { "]", "]", null, 0, new string[0] };
- yield return new object[] { "[", "[", null, 0, new string[0] };
- yield return new object[] { "[,,,,]", "", null, 0, new string[0] };
- yield return new object[] { "[a,b,c,d,e]", "a", null, 0, new string[0] };
- yield return new object[] { "[System.Int32,b,c,d,e]", typeof(int).FullName, null, 0, new string[0] };
-
- // Invalid generic
- yield return new object[] { "System.Collections.Generic.Dictionary`2", "System.Collections.Generic.Dictionary`2", null, 0, new string[0] };
- yield return new object[] { "System.Collections.Generic.Dictionary`2[System.String]", "System.Collections.Generic.Dictionary`2", null, 0, new string[] { "System.String" } };
- yield return new object[] { "System.Collections.Generic.Dictionary`2[System.String,", "System.Collections.Generic.Dictionary`2[System.String,", null, 0, new string[0] };
- yield return new object[] { "System.Collections.Generic.Dictionary`2[System.String,]", "System.Collections.Generic.Dictionary`2", null, 0, new string[] { "System.String" } };
- }
-
- [Theory]
- [MemberData(nameof(Ctor_String_TestData))]
- public void Ctor_String(string type, string expectedBaseType, string expectedArrayElementType, int expectedArrayRank, string[] expectedTypeArguments)
- {
- var typeReference = new CodeTypeReference(type);
- VerifyCodeTypeReference(typeReference, expectedBaseType, expectedArrayElementType, expectedArrayRank, expectedTypeArguments);
- }
-
- [Theory]
- [InlineData("System.Int32", (CodeTypeReferenceOptions)(-1))]
- [InlineData("System.Object", (CodeTypeReferenceOptions)0)]
- [InlineData("System.Void", CodeTypeReferenceOptions.GenericTypeParameter)]
- [InlineData("System.String", CodeTypeReferenceOptions.GenericTypeParameter + 1)]
- public void Ctor_String_CodeReferenceTypeOptions(string type, CodeTypeReferenceOptions options)
- {
- var typeReference = new CodeTypeReference(type, options);
- Assert.Equal(type, typeReference.BaseType);
- Assert.Equal(options, typeReference.Options);
- }
-
- public static IEnumerable<object[]> Ctor_CodeTypeReference_Int_TestData()
- {
- yield return new object[] { new CodeTypeReference(typeof(int)), -1, "" };
- yield return new object[] { new CodeTypeReference(typeof(void)), 0, "" };
- yield return new object[] { new CodeTypeReference(typeof(string)), 1, "System.String" };
- yield return new object[] { null, 1, "" };
- }
-
- [Theory]
- [MemberData(nameof(Ctor_CodeTypeReference_Int_TestData))]
- public void Ctor_CodeTypeReference_Int(CodeTypeReference type, int rank, string expectedBaseType)
- {
- var typeReference = new CodeTypeReference(type, rank);
- Assert.Equal(expectedBaseType, typeReference.BaseType);
- Assert.Equal(type?.BaseType, typeReference.ArrayElementType?.BaseType);
- Assert.Equal(rank, typeReference.ArrayRank);
- }
-
- [Theory]
- [InlineData("System.Int32", -1, "")]
- [InlineData("System.Void", 0, "")]
- [InlineData("System.String", 1, "System.String")]
- public void Ctor_String_Int(string type, int rank, string expectedBaseType)
- {
- var typeReference = new CodeTypeReference(type, rank);
- Assert.Equal(expectedBaseType, typeReference.BaseType);
- Assert.Equal(type, typeReference.ArrayElementType.BaseType);
- Assert.Equal(rank, typeReference.ArrayRank);
- }
-
- public static IEnumerable<object[]> Ctor_String_ParamsCodeTypeReference_TestData()
- {
- yield return new object[] { "System.String", null, "System.String" };
- yield return new object[] { "System.Void", new CodeTypeReference[0], "System.Void" };
- yield return new object[] { "System.Int32", new CodeTypeReference[] { new CodeTypeReference("System.String") }, "System.Int32`1" };
- }
-
- [Theory]
- [MemberData(nameof(Ctor_String_ParamsCodeTypeReference_TestData))]
- public void Ctor_String_ParamsCodeTypeReference(string name, CodeTypeReference[] typeArguments, string expectedBaseType)
- {
- var typeReference = new CodeTypeReference(name, typeArguments);
- Assert.Equal(expectedBaseType, typeReference.BaseType);
- Assert.Equal(typeArguments ?? new CodeTypeReference[0], typeReference.TypeArguments.Cast<CodeTypeReference>());
- }
-
- [Fact]
- public void Ctor_NullObjectInTypeArguments_ThrowsArgumentNullException()
- {
- CodeTypeReference[] typeArguments = new CodeTypeReference[] { null };
- AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTypeReference("System.Int32", typeArguments));
- }
-
- public static IEnumerable<object[]> Ctor_CodeTypeParameter_TestData()
- {
- yield return new object[] { null };
- yield return new object[] { new CodeTypeParameter() };
- yield return new object[] { new CodeTypeParameter("T") };
- yield return new object[] { new CodeTypeParameter("System.Int32") };
- }
-
- [Theory]
- [MemberData(nameof(Ctor_CodeTypeParameter_TestData))]
- public void Ctor_CodeTypeParameter(CodeTypeParameter parameter)
- {
- var typeReference = new CodeTypeReference(parameter);
- Assert.Equal(string.IsNullOrEmpty(parameter?.Name) ? "System.Void" : parameter.Name, typeReference.BaseType);
- Assert.Equal(CodeTypeReferenceOptions.GenericTypeParameter, typeReference.Options);
- }
-
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void ArrayElementType_Set_Get_ReturnsExpected(CodeTypeReference value)
- {
- var codeTypeReference = new CodeTypeReference();
- codeTypeReference.ArrayElementType = value;
- Assert.Equal(value, codeTypeReference.ArrayElementType);
- }
-
- [Theory]
- [InlineData(-1)]
- [InlineData(0)]
- [InlineData(1)]
- public void ArrayRank_Set_Get_ReturnsExpected(int value)
- {
- var codeTypeReference = new CodeTypeReference();
- codeTypeReference.ArrayRank = value;
- Assert.Equal(value, codeTypeReference.ArrayRank);
- }
-
- [Theory]
- [InlineData(null, "System.Void")]
- [InlineData("", "System.Void")]
- [InlineData("System.Int32", "System.Int32")]
- public void BaseType_Set_Get_ReturnsExpected(string value, string expected)
- {
- var codeTypeReference = new CodeTypeReference();
- codeTypeReference.BaseType = value;
- Assert.Equal(expected, codeTypeReference.BaseType);
- }
-
- [Fact]
- public void TypeArguments_AddMultiple_ReturnsExpected()
- {
- var codeTypeReference = new CodeTypeReference();
-
- CodeTypeReference type1 = new CodeTypeReference(typeof(int));
- codeTypeReference.TypeArguments.Add(type1);
- Assert.Equal(new CodeTypeReference[] { type1 }, codeTypeReference.TypeArguments.Cast<CodeTypeReference>());
-
- CodeTypeReference type2 = new CodeTypeReference(typeof(char));
- codeTypeReference.TypeArguments.Add(type2);
- Assert.Equal(new CodeTypeReference[] { type1, type2 }, codeTypeReference.TypeArguments.Cast<CodeTypeReference>());
- }
-
- private static void VerifyCodeTypeReference(CodeTypeReference typeReference, string expectedBaseType, string expectedArrayElementType, int expectedArrayRank, string[] expectedTypeArguments)
- {
- Assert.Equal(expectedBaseType, typeReference.BaseType);
-
- Assert.Equal(expectedArrayElementType, typeReference.ArrayElementType?.BaseType);
-
- Assert.Equal(expectedArrayRank, typeReference.ArrayRank);
-
- Assert.Equal((CodeTypeReferenceOptions)0, typeReference.Options);
-
- CodeTypeReference[] actualTypeArguments = typeReference.TypeArguments.Cast<CodeTypeReference>().ToArray();
- Assert.Equal(expectedTypeArguments.Length, actualTypeArguments.Length);
- for (int i = 0; i < expectedTypeArguments.Length; i++)
- {
- Assert.Equal(expectedTypeArguments[i], actualTypeArguments[i].BaseType);
- Assert.Equal((CodeTypeReferenceOptions)0, actualTypeArguments[i].Options);
- }
- }
-
- public class NestedClass { }
- }
+ public class CodeTypeReferenceTests : CodeObjectTestBase<CodeTypeReference>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var type = new CodeTypeReference();
+ Assert.Null(type.ArrayElementType);
+ Assert.Equal(0, type.ArrayRank);
+ Assert.Empty(type.BaseType);
+ Assert.Equal((CodeTypeReferenceOptions)0, type.Options);
+ Assert.Empty(type.TypeArguments);
+ }
+
+ public static IEnumerable<object[]> Ctor_Type_TestData()
+ {
+ yield return new object[] { typeof(int), typeof(int).FullName };
+ yield return new object[] { typeof(int[]), typeof(int).FullName };
+ yield return new object[] { typeof(int[,]), typeof(int).FullName };
+ yield return new object[] { typeof(int).MakeByRefType(), typeof(int).MakeByRefType().FullName };
+ yield return new object[] { typeof(int).MakePointerType(), typeof(int).MakePointerType().FullName };
+ yield return new object[] { typeof(List<int>), typeof(List<>).FullName };
+ yield return new object[] { typeof(List<>), typeof(List<>).FullName };
+ yield return new object[] { typeof(List<>).GetGenericArguments()[0], "T" };
+ yield return new object[] { typeof(void), typeof(void).FullName };
+ yield return new object[] { typeof(NestedClass), typeof(NestedClass).FullName };
+ yield return new object[] { typeof(ClassWithoutNamespace), typeof(ClassWithoutNamespace).FullName };
+ yield return new object[] { typeof(Nullable), typeof(Nullable).FullName };
+ }
+
+ [Theory]
+ [MemberData(nameof(Ctor_Type_TestData))]
+ public void Ctor_Type(Type type, string expectedBaseType)
+ {
+ var typeReference = new CodeTypeReference(type);
+ string expectedArrayElementType = type.IsArray ? type.GetElementType().FullName : null;
+ int expectedArrayRank = type.IsArray ? type.GetArrayRank() : 0;
+ string[] expectedTypeArguments = type.GenericTypeArguments.Select(arg => arg.IsGenericType ? arg.GetGenericTypeDefinition().FullName : arg.FullName).ToArray();
+ VerifyCodeTypeReference(typeReference, expectedBaseType, expectedArrayElementType, expectedArrayRank, expectedTypeArguments);
+ }
+
+ [Theory]
+ [InlineData(typeof(int), (CodeTypeReferenceOptions)(-1))]
+ [InlineData(typeof(object), (CodeTypeReferenceOptions)0)]
+ [InlineData(typeof(void), CodeTypeReferenceOptions.GenericTypeParameter)]
+ [InlineData(typeof(string), CodeTypeReferenceOptions.GenericTypeParameter + 1)]
+ public void Ctor_Type_CodeReferenceTypeOptions_TestData(Type type, CodeTypeReferenceOptions options)
+ {
+ var typeReference = new CodeTypeReference(type, options);
+ Assert.Equal(type.FullName, typeReference.BaseType);
+ Assert.Equal(options, typeReference.Options);
+ }
+
+ [Fact]
+ public void Ctor_NullType_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeTypeReference((Type)null));
+ AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeTypeReference((Type)null, CodeTypeReferenceOptions.GenericTypeParameter));
+ }
+
+ public static IEnumerable<object[]> Ctor_String_TestData()
+ {
+ // Basic
+ yield return new object[] { "System.Int32", typeof(int).FullName, null, 0, new string[0] };
+ yield return new object[] { "System.Int32*", typeof(int).MakePointerType().FullName, null, 0, new string[0] };
+ yield return new object[] { "System.Int32&", typeof(int).MakeByRefType().FullName, null, 0, new string[0] };
+ yield return new object[] { "NoSuchType", "NoSuchType", null, 0, new string[0] };
+
+ // Arrays
+ yield return new object[] { "System.Int32[]", typeof(int).FullName, typeof(int).FullName, 1, new string[0] };
+ yield return new object[] { "System.Int32[,]", typeof(int).FullName, typeof(int).FullName, 2, new string[0] };
+ yield return new object[] { "System.Int32[][]", typeof(int).FullName, typeof(int).FullName, 1, new string[0] };
+
+ // Generic
+ yield return new object[] { "System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089], [System.Collections.Generic.List`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", typeof(Dictionary<,>).FullName, null, 0, new string[] { "System.String", "System.Collections.Generic.List`1" } };
+ yield return new object[] { "[System.Collections.Generic.List[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral,PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]", "System.Collections.Generic.List", null, 0, new string[] { "System.String" } };
+
+ // Empty
+ yield return new object[] { null, typeof(void).FullName, null, 0, new string[0] };
+ yield return new object[] { "", typeof(void).FullName, null, 0, new string[0] };
+ yield return new object[] { " \r \t \n ", " \r \t \n ", null, 0, new string[0] };
+
+ // Invalid assembly qualified name
+ yield return new object[] { "[]", "[]", null, 0, new string[0] };
+ yield return new object[] { "[]]", "[]]", null, 0, new string[0] };
+ yield return new object[] { "[[]", "[", "[", 1, new string[0] };
+ yield return new object[] { "[[]]", "[[]]", null, 0, new string[0] };
+ yield return new object[] { "]", "]", null, 0, new string[0] };
+ yield return new object[] { "[", "[", null, 0, new string[0] };
+ yield return new object[] { "[,,,,]", "", null, 0, new string[0] };
+ yield return new object[] { "[a,b,c,d,e]", "a", null, 0, new string[0] };
+ yield return new object[] { "[System.Int32,b,c,d,e]", typeof(int).FullName, null, 0, new string[0] };
+
+ // Invalid generic
+ yield return new object[] { "System.Collections.Generic.Dictionary`2", "System.Collections.Generic.Dictionary`2", null, 0, new string[0] };
+ yield return new object[] { "System.Collections.Generic.Dictionary`2[System.String]", "System.Collections.Generic.Dictionary`2", null, 0, new string[] { "System.String" } };
+ yield return new object[] { "System.Collections.Generic.Dictionary`2[System.String,", "System.Collections.Generic.Dictionary`2[System.String,", null, 0, new string[0] };
+ yield return new object[] { "System.Collections.Generic.Dictionary`2[System.String,]", "System.Collections.Generic.Dictionary`2", null, 0, new string[] { "System.String" } };
+ }
+
+ [Theory]
+ [MemberData(nameof(Ctor_String_TestData))]
+ public void Ctor_String(string type, string expectedBaseType, string expectedArrayElementType, int expectedArrayRank, string[] expectedTypeArguments)
+ {
+ var typeReference = new CodeTypeReference(type);
+ VerifyCodeTypeReference(typeReference, expectedBaseType, expectedArrayElementType, expectedArrayRank, expectedTypeArguments);
+ }
+
+ [Theory]
+ [InlineData("System.Int32", (CodeTypeReferenceOptions)(-1))]
+ [InlineData("System.Object", (CodeTypeReferenceOptions)0)]
+ [InlineData("System.Void", CodeTypeReferenceOptions.GenericTypeParameter)]
+ [InlineData("System.String", CodeTypeReferenceOptions.GenericTypeParameter + 1)]
+ public void Ctor_String_CodeReferenceTypeOptions(string type, CodeTypeReferenceOptions options)
+ {
+ var typeReference = new CodeTypeReference(type, options);
+ Assert.Equal(type, typeReference.BaseType);
+ Assert.Equal(options, typeReference.Options);
+ }
+
+ public static IEnumerable<object[]> Ctor_CodeTypeReference_Int_TestData()
+ {
+ yield return new object[] { new CodeTypeReference(typeof(int)), -1, "" };
+ yield return new object[] { new CodeTypeReference(typeof(void)), 0, "" };
+ yield return new object[] { new CodeTypeReference(typeof(string)), 1, "System.String" };
+ yield return new object[] { null, 1, "" };
+ }
+
+ [Theory]
+ [MemberData(nameof(Ctor_CodeTypeReference_Int_TestData))]
+ public void Ctor_CodeTypeReference_Int(CodeTypeReference type, int rank, string expectedBaseType)
+ {
+ var typeReference = new CodeTypeReference(type, rank);
+ Assert.Equal(expectedBaseType, typeReference.BaseType);
+ Assert.Equal(type?.BaseType, typeReference.ArrayElementType?.BaseType);
+ Assert.Equal(rank, typeReference.ArrayRank);
+ }
+
+ [Theory]
+ [InlineData("System.Int32", -1, "")]
+ [InlineData("System.Void", 0, "")]
+ [InlineData("System.String", 1, "System.String")]
+ public void Ctor_String_Int(string type, int rank, string expectedBaseType)
+ {
+ var typeReference = new CodeTypeReference(type, rank);
+ Assert.Equal(expectedBaseType, typeReference.BaseType);
+ Assert.Equal(type, typeReference.ArrayElementType.BaseType);
+ Assert.Equal(rank, typeReference.ArrayRank);
+ }
+
+ public static IEnumerable<object[]> Ctor_String_ParamsCodeTypeReference_TestData()
+ {
+ yield return new object[] { "System.String", null, "System.String" };
+ yield return new object[] { "System.Void", new CodeTypeReference[0], "System.Void" };
+ yield return new object[] { "System.Int32", new CodeTypeReference[] { new CodeTypeReference("System.String") }, "System.Int32`1" };
+ }
+
+ [Theory]
+ [MemberData(nameof(Ctor_String_ParamsCodeTypeReference_TestData))]
+ public void Ctor_String_ParamsCodeTypeReference(string name, CodeTypeReference[] typeArguments, string expectedBaseType)
+ {
+ var typeReference = new CodeTypeReference(name, typeArguments);
+ Assert.Equal(expectedBaseType, typeReference.BaseType);
+ Assert.Equal(typeArguments ?? new CodeTypeReference[0], typeReference.TypeArguments.Cast<CodeTypeReference>());
+ }
+
+ [Fact]
+ public void Ctor_NullObjectInTypeArguments_ThrowsArgumentNullException()
+ {
+ CodeTypeReference[] typeArguments = new CodeTypeReference[] { null };
+ AssertExtensions.Throws<ArgumentNullException>("value", () => new CodeTypeReference("System.Int32", typeArguments));
+ }
+
+ public static IEnumerable<object[]> Ctor_CodeTypeParameter_TestData()
+ {
+ yield return new object[] { null };
+ yield return new object[] { new CodeTypeParameter() };
+ yield return new object[] { new CodeTypeParameter("T") };
+ yield return new object[] { new CodeTypeParameter("System.Int32") };
+ }
+
+ [Theory]
+ [MemberData(nameof(Ctor_CodeTypeParameter_TestData))]
+ public void Ctor_CodeTypeParameter(CodeTypeParameter parameter)
+ {
+ var typeReference = new CodeTypeReference(parameter);
+ Assert.Equal(string.IsNullOrEmpty(parameter?.Name) ? "System.Void" : parameter.Name, typeReference.BaseType);
+ Assert.Equal(CodeTypeReferenceOptions.GenericTypeParameter, typeReference.Options);
+ }
+
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void ArrayElementType_Set_Get_ReturnsExpected(CodeTypeReference value)
+ {
+ var codeTypeReference = new CodeTypeReference();
+ codeTypeReference.ArrayElementType = value;
+ Assert.Equal(value, codeTypeReference.ArrayElementType);
+ }
+
+ [Theory]
+ [InlineData(-1)]
+ [InlineData(0)]
+ [InlineData(1)]
+ public void ArrayRank_Set_Get_ReturnsExpected(int value)
+ {
+ var codeTypeReference = new CodeTypeReference();
+ codeTypeReference.ArrayRank = value;
+ Assert.Equal(value, codeTypeReference.ArrayRank);
+ }
+
+ [Theory]
+ [InlineData(null, "System.Void")]
+ [InlineData("", "System.Void")]
+ [InlineData("System.Int32", "System.Int32")]
+ public void BaseType_Set_Get_ReturnsExpected(string value, string expected)
+ {
+ var codeTypeReference = new CodeTypeReference();
+ codeTypeReference.BaseType = value;
+ Assert.Equal(expected, codeTypeReference.BaseType);
+ }
+
+ [Fact]
+ public void TypeArguments_AddMultiple_ReturnsExpected()
+ {
+ var codeTypeReference = new CodeTypeReference();
+
+ CodeTypeReference type1 = new CodeTypeReference(typeof(int));
+ codeTypeReference.TypeArguments.Add(type1);
+ Assert.Equal(new CodeTypeReference[] { type1 }, codeTypeReference.TypeArguments.Cast<CodeTypeReference>());
+
+ CodeTypeReference type2 = new CodeTypeReference(typeof(char));
+ codeTypeReference.TypeArguments.Add(type2);
+ Assert.Equal(new CodeTypeReference[] { type1, type2 }, codeTypeReference.TypeArguments.Cast<CodeTypeReference>());
+ }
+
+ private static void VerifyCodeTypeReference(CodeTypeReference typeReference, string expectedBaseType, string expectedArrayElementType, int expectedArrayRank, string[] expectedTypeArguments)
+ {
+ Assert.Equal(expectedBaseType, typeReference.BaseType);
+
+ Assert.Equal(expectedArrayElementType, typeReference.ArrayElementType?.BaseType);
+
+ Assert.Equal(expectedArrayRank, typeReference.ArrayRank);
+
+ Assert.Equal((CodeTypeReferenceOptions)0, typeReference.Options);
+
+ CodeTypeReference[] actualTypeArguments = typeReference.TypeArguments.Cast<CodeTypeReference>().ToArray();
+ Assert.Equal(expectedTypeArguments.Length, actualTypeArguments.Length);
+ for (int i = 0; i < expectedTypeArguments.Length; i++)
+ {
+ Assert.Equal(expectedTypeArguments[i], actualTypeArguments[i].BaseType);
+ Assert.Equal((CodeTypeReferenceOptions)0, actualTypeArguments[i].Options);
+ }
+ }
+
+ public class NestedClass { }
+ }
}
public class ClassWithoutNamespace { }
namespace System.CodeDom.Tests
{
- public class CodeVariableDeclarationStatementTests : CodeObjectTestBase<CodeVariableDeclarationStatement>
- {
- [Fact]
- public void Ctor_Default()
- {
- var variableDeclaration = new CodeVariableDeclarationStatement();
- Assert.Null(variableDeclaration.InitExpression);
- Assert.Empty(variableDeclaration.Name);
- Assert.Equal(typeof(void).FullName, variableDeclaration.Type.BaseType);
- }
-
- public static IEnumerable<object[]> Ctor_CodeTypeReference_String_TestData()
- {
- yield return new object[] { null, null };
- yield return new object[] { new CodeTypeReference(), "" };
- yield return new object[] { new CodeTypeReference(typeof(int)), "Name" };
- }
-
- [Theory]
- [MemberData(nameof(Ctor_CodeTypeReference_String_TestData))]
- public void Ctor_CodeTypeReference_String(CodeTypeReference type, string name)
- {
- var variableDeclaration = new CodeVariableDeclarationStatement(type, name);
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, variableDeclaration.Type.BaseType);
- Assert.Equal(name ?? string.Empty, variableDeclaration.Name);
- Assert.Null(variableDeclaration.InitExpression);
- }
-
- public static IEnumerable<object[]> Ctor_String_String_TestData()
- {
- yield return new object[] { null, null, "System.Void" };
- yield return new object[] { "", "", "System.Void" };
- yield return new object[] { "Int32", "Name", "Int32" };
- }
-
- [Theory]
- [MemberData(nameof(Ctor_String_String_TestData))]
- public void Ctor_String_String(string type, string name, string expectedBaseType)
- {
- var variableDeclaration = new CodeVariableDeclarationStatement(type, name);
- Assert.Equal(expectedBaseType, variableDeclaration.Type.BaseType);
- Assert.Equal(name ?? string.Empty, variableDeclaration.Name);
- Assert.Null(variableDeclaration.InitExpression);
- }
-
- public static IEnumerable<object[]> Ctor_Type_String_TestData()
- {
- yield return new object[] { typeof(int), null, "System.Int32" };
- yield return new object[] { typeof(List<>), "", "System.Collections.Generic.List`1" };
- yield return new object[] { typeof(void), "Name", "System.Void" };
- }
-
- [Theory]
- [MemberData(nameof(Ctor_Type_String_TestData))]
- public void Ctor_Type_String(Type type, string name, string expectedBaseType)
- {
- var variableDeclaration = new CodeVariableDeclarationStatement(type, name);
- Assert.Equal(expectedBaseType, variableDeclaration.Type.BaseType);
- Assert.Equal(name ?? string.Empty, variableDeclaration.Name);
- Assert.Null(variableDeclaration.InitExpression);
- }
-
- public static IEnumerable<object[]> Ctor_CodeTypeReference_String_CodeExpression_TestData()
- {
- yield return new object[] { null, null, null };
- yield return new object[] { new CodeTypeReference(), "", new CodeExpression() };
- yield return new object[] { new CodeTypeReference(typeof(int)), "Name", new CodePrimitiveExpression("Value") };
- }
-
- [Theory]
- [MemberData(nameof(Ctor_CodeTypeReference_String_CodeExpression_TestData))]
- public void Ctor_CodeTypeReference_String_CodeExpression(CodeTypeReference type, string name, CodeExpression initExpression)
- {
- var variableDeclaration = new CodeVariableDeclarationStatement(type, name, initExpression);
- Assert.Equal((type ?? new CodeTypeReference("")).BaseType, variableDeclaration.Type.BaseType);
- Assert.Equal(name ?? string.Empty, variableDeclaration.Name);
- Assert.Equal(initExpression, variableDeclaration.InitExpression);
- }
-
- public static IEnumerable<object[]> Ctor_String_String_CodeExpression_TestData()
- {
- yield return new object[] { null, null, null, "System.Void" };
- yield return new object[] { "", "", new CodeExpression(), "System.Void" };
- yield return new object[] { "Int32", "Name", new CodePrimitiveExpression("Value"), "Int32" };
- }
-
- [Theory]
- [MemberData(nameof(Ctor_String_String_CodeExpression_TestData))]
- public void Ctor_String_String_CodeExpression(string type, string name, CodeExpression initExpression, string expectedBaseType)
- {
- var variableDeclaration = new CodeVariableDeclarationStatement(type, name, initExpression);
- Assert.Equal(expectedBaseType, variableDeclaration.Type.BaseType);
- Assert.Equal(name ?? string.Empty, variableDeclaration.Name);
- Assert.Equal(initExpression, variableDeclaration.InitExpression);
- }
-
- public static IEnumerable<object[]> Ctor_Type_String_CodeExpression_TestData()
- {
- yield return new object[] { typeof(int), null, null, "System.Int32" };
- yield return new object[] { typeof(List<>), "", new CodeExpression(), "System.Collections.Generic.List`1" };
- yield return new object[] { typeof(void), "Name", new CodePrimitiveExpression("Value"), "System.Void" };
- }
-
- [Theory]
- [MemberData(nameof(Ctor_Type_String_CodeExpression_TestData))]
- public void Ctor_Type_String_CodeExpression(Type type, string name, CodeExpression initExpression, string expectedBaseType)
- {
- var variableDeclaration = new CodeVariableDeclarationStatement(type, name, initExpression);
- Assert.Equal(expectedBaseType, variableDeclaration.Type.BaseType);
- Assert.Equal(name ?? string.Empty, variableDeclaration.Name);
- Assert.Equal(initExpression, variableDeclaration.InitExpression);
- }
-
- [Fact]
- public void Ctor_NullType_ThrowsArgumentNullException()
- {
- AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeVariableDeclarationStatement((Type)null, "Name"));
- AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeVariableDeclarationStatement((Type)null, "Name", new CodePrimitiveExpression("Value")));
- }
-
- [Theory]
- [MemberData(nameof(CodeExpression_TestData))]
- public void InitExpression_Set_Get_ReturnsExpected(CodeExpression value)
- {
- var variableDeclaration = new CodeVariableDeclarationStatement();
- variableDeclaration.InitExpression = value;
- Assert.Equal(value, variableDeclaration.InitExpression);
- }
-
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Name_Set_Get_ReturnsExpected(string value)
- {
- var variableDeclaration = new CodeVariableDeclarationStatement();
- variableDeclaration.Name = value;
- Assert.Equal(value ?? string.Empty, variableDeclaration.Name);
- }
-
- [Theory]
- [MemberData(nameof(CodeTypeReference_TestData))]
- public void Type_Set_Get_ReturnsExpected(CodeTypeReference value)
- {
- var variableDeclaration = new CodeVariableDeclarationStatement();
- variableDeclaration.Type = value;
- Assert.Equal((value ?? new CodeTypeReference("")).BaseType, variableDeclaration.Type.BaseType);
- }
- }
+ public class CodeVariableDeclarationStatementTests : CodeObjectTestBase<CodeVariableDeclarationStatement>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var variableDeclaration = new CodeVariableDeclarationStatement();
+ Assert.Null(variableDeclaration.InitExpression);
+ Assert.Empty(variableDeclaration.Name);
+ Assert.Equal(typeof(void).FullName, variableDeclaration.Type.BaseType);
+ }
+
+ public static IEnumerable<object[]> Ctor_CodeTypeReference_String_TestData()
+ {
+ yield return new object[] { null, null };
+ yield return new object[] { new CodeTypeReference(), "" };
+ yield return new object[] { new CodeTypeReference(typeof(int)), "Name" };
+ }
+
+ [Theory]
+ [MemberData(nameof(Ctor_CodeTypeReference_String_TestData))]
+ public void Ctor_CodeTypeReference_String(CodeTypeReference type, string name)
+ {
+ var variableDeclaration = new CodeVariableDeclarationStatement(type, name);
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, variableDeclaration.Type.BaseType);
+ Assert.Equal(name ?? string.Empty, variableDeclaration.Name);
+ Assert.Null(variableDeclaration.InitExpression);
+ }
+
+ public static IEnumerable<object[]> Ctor_String_String_TestData()
+ {
+ yield return new object[] { null, null, "System.Void" };
+ yield return new object[] { "", "", "System.Void" };
+ yield return new object[] { "Int32", "Name", "Int32" };
+ }
+
+ [Theory]
+ [MemberData(nameof(Ctor_String_String_TestData))]
+ public void Ctor_String_String(string type, string name, string expectedBaseType)
+ {
+ var variableDeclaration = new CodeVariableDeclarationStatement(type, name);
+ Assert.Equal(expectedBaseType, variableDeclaration.Type.BaseType);
+ Assert.Equal(name ?? string.Empty, variableDeclaration.Name);
+ Assert.Null(variableDeclaration.InitExpression);
+ }
+
+ public static IEnumerable<object[]> Ctor_Type_String_TestData()
+ {
+ yield return new object[] { typeof(int), null, "System.Int32" };
+ yield return new object[] { typeof(List<>), "", "System.Collections.Generic.List`1" };
+ yield return new object[] { typeof(void), "Name", "System.Void" };
+ }
+
+ [Theory]
+ [MemberData(nameof(Ctor_Type_String_TestData))]
+ public void Ctor_Type_String(Type type, string name, string expectedBaseType)
+ {
+ var variableDeclaration = new CodeVariableDeclarationStatement(type, name);
+ Assert.Equal(expectedBaseType, variableDeclaration.Type.BaseType);
+ Assert.Equal(name ?? string.Empty, variableDeclaration.Name);
+ Assert.Null(variableDeclaration.InitExpression);
+ }
+
+ public static IEnumerable<object[]> Ctor_CodeTypeReference_String_CodeExpression_TestData()
+ {
+ yield return new object[] { null, null, null };
+ yield return new object[] { new CodeTypeReference(), "", new CodeExpression() };
+ yield return new object[] { new CodeTypeReference(typeof(int)), "Name", new CodePrimitiveExpression("Value") };
+ }
+
+ [Theory]
+ [MemberData(nameof(Ctor_CodeTypeReference_String_CodeExpression_TestData))]
+ public void Ctor_CodeTypeReference_String_CodeExpression(CodeTypeReference type, string name, CodeExpression initExpression)
+ {
+ var variableDeclaration = new CodeVariableDeclarationStatement(type, name, initExpression);
+ Assert.Equal((type ?? new CodeTypeReference("")).BaseType, variableDeclaration.Type.BaseType);
+ Assert.Equal(name ?? string.Empty, variableDeclaration.Name);
+ Assert.Equal(initExpression, variableDeclaration.InitExpression);
+ }
+
+ public static IEnumerable<object[]> Ctor_String_String_CodeExpression_TestData()
+ {
+ yield return new object[] { null, null, null, "System.Void" };
+ yield return new object[] { "", "", new CodeExpression(), "System.Void" };
+ yield return new object[] { "Int32", "Name", new CodePrimitiveExpression("Value"), "Int32" };
+ }
+
+ [Theory]
+ [MemberData(nameof(Ctor_String_String_CodeExpression_TestData))]
+ public void Ctor_String_String_CodeExpression(string type, string name, CodeExpression initExpression, string expectedBaseType)
+ {
+ var variableDeclaration = new CodeVariableDeclarationStatement(type, name, initExpression);
+ Assert.Equal(expectedBaseType, variableDeclaration.Type.BaseType);
+ Assert.Equal(name ?? string.Empty, variableDeclaration.Name);
+ Assert.Equal(initExpression, variableDeclaration.InitExpression);
+ }
+
+ public static IEnumerable<object[]> Ctor_Type_String_CodeExpression_TestData()
+ {
+ yield return new object[] { typeof(int), null, null, "System.Int32" };
+ yield return new object[] { typeof(List<>), "", new CodeExpression(), "System.Collections.Generic.List`1" };
+ yield return new object[] { typeof(void), "Name", new CodePrimitiveExpression("Value"), "System.Void" };
+ }
+
+ [Theory]
+ [MemberData(nameof(Ctor_Type_String_CodeExpression_TestData))]
+ public void Ctor_Type_String_CodeExpression(Type type, string name, CodeExpression initExpression, string expectedBaseType)
+ {
+ var variableDeclaration = new CodeVariableDeclarationStatement(type, name, initExpression);
+ Assert.Equal(expectedBaseType, variableDeclaration.Type.BaseType);
+ Assert.Equal(name ?? string.Empty, variableDeclaration.Name);
+ Assert.Equal(initExpression, variableDeclaration.InitExpression);
+ }
+
+ [Fact]
+ public void Ctor_NullType_ThrowsArgumentNullException()
+ {
+ AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeVariableDeclarationStatement((Type)null, "Name"));
+ AssertExtensions.Throws<ArgumentNullException>("type", () => new CodeVariableDeclarationStatement((Type)null, "Name", new CodePrimitiveExpression("Value")));
+ }
+
+ [Theory]
+ [MemberData(nameof(CodeExpression_TestData))]
+ public void InitExpression_Set_Get_ReturnsExpected(CodeExpression value)
+ {
+ var variableDeclaration = new CodeVariableDeclarationStatement();
+ variableDeclaration.InitExpression = value;
+ Assert.Equal(value, variableDeclaration.InitExpression);
+ }
+
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Name_Set_Get_ReturnsExpected(string value)
+ {
+ var variableDeclaration = new CodeVariableDeclarationStatement();
+ variableDeclaration.Name = value;
+ Assert.Equal(value ?? string.Empty, variableDeclaration.Name);
+ }
+
+ [Theory]
+ [MemberData(nameof(CodeTypeReference_TestData))]
+ public void Type_Set_Get_ReturnsExpected(CodeTypeReference value)
+ {
+ var variableDeclaration = new CodeVariableDeclarationStatement();
+ variableDeclaration.Type = value;
+ Assert.Equal((value ?? new CodeTypeReference("")).BaseType, variableDeclaration.Type.BaseType);
+ }
+ }
}
namespace System.CodeDom.Tests
{
- public class CodeVariableReferenceExpressionTests : CodeObjectTestBase<CodeVariableReferenceExpression>
- {
- [Fact]
- public void Ctor_Default()
- {
- var variableReference = new CodeVariableReferenceExpression();
- Assert.Empty(variableReference.VariableName);
- }
+ public class CodeVariableReferenceExpressionTests : CodeObjectTestBase<CodeVariableReferenceExpression>
+ {
+ [Fact]
+ public void Ctor_Default()
+ {
+ var variableReference = new CodeVariableReferenceExpression();
+ Assert.Empty(variableReference.VariableName);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void Ctor_String(string VariableName)
- {
- var variableReference = new CodeVariableReferenceExpression(VariableName);
- Assert.Equal(VariableName ?? string.Empty, variableReference.VariableName);
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void Ctor_String(string VariableName)
+ {
+ var variableReference = new CodeVariableReferenceExpression(VariableName);
+ Assert.Equal(VariableName ?? string.Empty, variableReference.VariableName);
+ }
- [Theory]
- [MemberData(nameof(String_TestData))]
- public void VariableName_Set_Get_ReturnsExpected(string VariableName)
- {
- var variableReference = new CodeVariableReferenceExpression();
- variableReference.VariableName = VariableName;
- Assert.Equal(VariableName ?? string.Empty, variableReference.VariableName);
- }
- }
+ [Theory]
+ [MemberData(nameof(String_TestData))]
+ public void VariableName_Set_Get_ReturnsExpected(string VariableName)
+ {
+ var variableReference = new CodeVariableReferenceExpression();
+ variableReference.VariableName = VariableName;
+ Assert.Equal(VariableName ?? string.Empty, variableReference.VariableName);
+ }
+ }
}
/// cref="System.Collections.Concurrent.BlockingCollection{T}"/> has been disposed.</exception>
/// <exception cref="System.ArgumentOutOfRangeException"><paramref name="timeout"/> is a negative number
/// other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than
- /// <see cref="System.Int32.MaxValue"/>.</exception>
+ /// <see cref="int.MaxValue"/>.</exception>
/// <exception cref="System.InvalidOperationException">The underlying collection didn't accept the item.</exception>
public bool TryAdd(T item, TimeSpan timeout)
{
/// cref="System.Collections.Concurrent.BlockingCollection{T}"/> has been disposed.</exception>
/// <exception cref="System.ArgumentOutOfRangeException"><paramref name="timeout"/> is a negative number
/// other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than
- /// <see cref="System.Int32.MaxValue"/>.</exception>
+ /// <see cref="int.MaxValue"/>.</exception>
/// <exception cref="System.InvalidOperationException">The underlying collection was modified
/// outside of this <see
/// cref="System.Collections.Concurrent.BlockingCollection{T}"/> instance.</exception>
/// cref="System.Collections.Concurrent.BlockingCollection{T}"/> instances has been disposed.</exception>
/// <exception cref="System.ArgumentOutOfRangeException"><paramref name="timeout"/> is a negative number
/// other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than
- /// <see cref="System.Int32.MaxValue"/>.</exception>
+ /// <see cref="int.MaxValue"/>.</exception>
/// <exception cref="System.InvalidOperationException">At least one underlying collection didn't accept the item.</exception>
/// <exception cref="System.ArgumentOutOfRangeException">The count of <paramref name="collections"/> is greater than the maximum size of
/// 62 for STA and 63 for MTA.</exception>
/// cref="System.Collections.Concurrent.BlockingCollection{T}"/> instances has been disposed.</exception>
/// <exception cref="System.ArgumentOutOfRangeException"><paramref name="timeout"/> is a negative number
/// other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than
- /// <see cref="System.Int32.MaxValue"/>.</exception>
+ /// <see cref="int.MaxValue"/>.</exception>
/// <exception cref="System.InvalidOperationException">At least one of the underlying collections was modified
/// outside of its <see
/// cref="System.Collections.Concurrent.BlockingCollection{T}"/> instance.</exception>
}
/// <summary>
- /// Determines whether the specified <see cref="Object"/> is equal to this instance.
+ /// Determines whether the specified <see cref="object"/> is equal to this instance.
/// </summary>
- /// <param name="obj">The <see cref="Object"/> to compare with this instance.</param>
+ /// <param name="obj">The <see cref="object"/> to compare with this instance.</param>
/// <returns>
- /// <c>true</c> if the specified <see cref="Object"/> is equal to this instance; otherwise, <c>false</c>.
+ /// <c>true</c> if the specified <see cref="object"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns>
[Pure]
public override bool Equals(object obj)
}
/// <summary>
- /// Gets or sets the <see cref="System.Object"/> at the specified index.
+ /// Gets or sets the <see cref="object"/> at the specified index.
/// </summary>
/// <value>
- /// The <see cref="System.Object"/>.
+ /// The <see cref="object"/>.
/// </value>
/// <param name="index">The index.</param>
/// <returns></returns>
{
if (_syncRoot == null)
{
- Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new object(), null);
+ Threading.Interlocked.CompareExchange<object>(ref _syncRoot, new object(), null);
}
return _syncRoot;
}
/// <summary>
- /// Gets or sets the <see cref="System.Object"/> at the specified index.
+ /// Gets or sets the <see cref="object"/> at the specified index.
/// </summary>
/// <value>
- /// The <see cref="System.Object"/>.
+ /// The <see cref="object"/>.
/// </value>
/// <param name="index">The index.</param>
/// <returns></returns>
{
if (_syncRoot == null)
{
- System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new object(), null);
+ System.Threading.Interlocked.CompareExchange<object>(ref _syncRoot, new object(), null);
}
return _syncRoot;
void IList.Remove(object value) => throw new NotSupportedException();
/// <summary>
- /// Gets or sets the <see cref="System.Object"/> at the specified index.
+ /// Gets or sets the <see cref="object"/> at the specified index.
/// </summary>
/// <value>
- /// The <see cref="System.Object"/>.
+ /// The <see cref="object"/>.
/// </value>
/// <param name="index">The index.</param>
/// <returns>The value at the specified index.</returns>
{
if (_syncRoot == null)
{
- Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new object(), null);
+ Threading.Interlocked.CompareExchange<object>(ref _syncRoot, new object(), null);
}
return _syncRoot;
{
if (_syncRoot == null)
{
- Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new object(), null);
+ Threading.Interlocked.CompareExchange<object>(ref _syncRoot, new object(), null);
}
return _syncRoot;
}
/// <summary>
- /// Gets or sets the <see cref="System.Object"/> at the specified index.
+ /// Gets or sets the <see cref="object"/> at the specified index.
/// </summary>
/// <value>
- /// The <see cref="System.Object"/>.
+ /// The <see cref="object"/>.
/// </value>
/// <param name="index">The index.</param>
/// <exception cref="System.NotSupportedException"></exception>
public virtual object[] ToArray()
{
if (_size == 0)
- return Array.Empty<Object>();
+ return Array.Empty<object>();
object[] arr = new object[_size];
if (_head < _tail)
private void Init()
{
- keys = Array.Empty<Object>();
- values = Array.Empty<Object>();
+ keys = Array.Empty<object>();
+ values = Array.Empty<object>();
_size = 0;
comparer = new Comparer(CultureInfo.CurrentCulture);
}
{
// size can only be zero here.
Debug.Assert(_size == 0, "Size is not zero");
- keys = Array.Empty<Object>();
- values = Array.Empty<Object>();
+ keys = Array.Empty<object>();
+ values = Array.Empty<object>();
}
}
}
public virtual object[] ToArray()
{
if (_size == 0)
- return Array.Empty<Object>();
+ return Array.Empty<object>();
object[] objArray = new object[_size];
int i = 0;
namespace System.Collections.Specialized
{
/// <devdoc>
- /// <para>Provides the <see langword='abstract '/>base class for a sorted collection of associated <see cref='System.String' qualify='true'/> keys
- /// and <see cref='System.Object' qualify='true'/> values that can be accessed either with the hash code of
+ /// <para>Provides the <see langword='abstract '/>base class for a sorted collection of associated <see cref='string' qualify='true'/> keys
+ /// and <see cref='object' qualify='true'/> values that can be accessed either with the hash code of
/// the key or with the index.</para>
/// </devdoc>
public abstract class NameObjectCollectionBase : ICollection, ISerializable, IDeserializationCallback
//
/// <devdoc>
- /// <para>Returns a <see cref='System.String' qualify='true'/> array containing all the keys in the
+ /// <para>Returns a <see cref='string' qualify='true'/> array containing all the keys in the
/// <see cref='System.Collections.Specialized.NameObjectCollectionBase'/> instance.</para>
/// </devdoc>
protected string[] BaseGetAllKeys()
}
/// <devdoc>
- /// <para>Returns an <see cref='System.Object' qualify='true'/> array containing all the values in the
+ /// <para>Returns an <see cref='object' qualify='true'/> array containing all the values in the
/// <see cref='System.Collections.Specialized.NameObjectCollectionBase'/> instance.</para>
/// </devdoc>
protected object[] BaseGetAllValues()
//
/// <devdoc>
- /// <para>Represents a collection of the <see cref='System.String' qualify='true'/> keys of a collection.</para>
+ /// <para>Represents a collection of the <see cref='string' qualify='true'/> keys of a collection.</para>
/// </devdoc>
public class KeysCollection : ICollection
{
namespace System.Collections.Specialized
{
/// <devdoc>
- /// <para>Represents a sorted collection of associated <see cref='System.String' qualify='true'/> keys and <see cref='System.String' qualify='true'/> values that
+ /// <para>Represents a sorted collection of associated <see cref='string' qualify='true'/> keys and <see cref='string' qualify='true'/> values that
/// can be accessed either with the hash code of the key or with the index.</para>
/// </devdoc>
public class NameValueCollection : NameObjectCollectionBase
if (_size == 0)
{
- result = default!;
+ result = default!;
return false;
}
{
if (_size == 0)
{
- result = default!;
+ result = default!;
return false;
}
int iterations = 0;
int expectedCount = expectedItems.Length;
- //[] Verify non deterministic behavior of current every time it is called before a call to MoveNext() has been made
+ //[] Verify non deterministic behavior of current every time it is called before a call to MoveNext() has been made
for (int i = 0; i < 3; i++)
{
try
int iterations = 0;
int expectedCount = expectedItems.Length;
- //[] Verify non deterministic behavior of current every time it is called before a call to MoveNext() has been made
+ //[] Verify non deterministic behavior of current every time it is called before a call to MoveNext() has been made
for (int i = 0; i < 3; i++)
{
try
tempNode1 = linkedList.First;
tempNode2 = linkedList.Last;
- linkedList.Remove(linkedList.First); //Remove when VS Whidbey: 234648 is resolved
+ linkedList.Remove(linkedList.First); //Remove when VS Whidbey: 234648 is resolved
linkedList.Remove(linkedList.Last); //Remove when VS Whidbey: 234648 is resolved
InitialItems_Tests(linkedList, new T[0]);
linkedList.AddLast(headItems[2]);
tempNode1 = linkedList.First.Next;
- linkedList.Remove(linkedList.First.Next); //Remove when VS Whidbey: 234648 is resolved
+ linkedList.Remove(linkedList.First.Next); //Remove when VS Whidbey: 234648 is resolved
InitialItems_Tests(linkedList, new T[] { headItems[0], headItems[2] });
VerifyRemovedNode(linkedList, new T[] { headItems[0], headItems[2] }, tempNode1, headItems[1]);
linkedList.AddLast(headItems[2]);
tempNode1 = linkedList.Last;
- linkedList.Remove(linkedList.Last); //Remove when VS Whidbey: 234648 is resolved
+ linkedList.Remove(linkedList.Last); //Remove when VS Whidbey: 234648 is resolved
InitialItems_Tests(linkedList, new T[] { headItems[0], headItems[1] });
VerifyRemovedNode(linkedList, new T[] { headItems[0], headItems[1] }, tempNode1, headItems[2]);
tempNode2 = linkedList.First.Next;
tempNode3 = linkedList.Last;
- linkedList.Remove(linkedList.First.Next.Next); //Remove when VS Whidbey: 234648 is resolved
+ linkedList.Remove(linkedList.First.Next.Next); //Remove when VS Whidbey: 234648 is resolved
linkedList.Remove(linkedList.First.Next); //Remove when VS Whidbey: 234648 is resolved
- linkedList.Remove(linkedList.First); //Remove when VS Whidbey: 234648 is resolved
+ linkedList.Remove(linkedList.First); //Remove when VS Whidbey: 234648 is resolved
InitialItems_Tests(linkedList, new T[0]);
VerifyRemovedNode(tempNode1, headItems[0]);
for (int i = 0; i < arraySize; ++i)
{
- linkedList.Remove(linkedList.First); //Remove when VS Whidbey: 234648 is resolved
+ linkedList.Remove(linkedList.First); //Remove when VS Whidbey: 234648 is resolved
int startIndex = i + 1;
int length = arraySize - i - 1;
T[] expectedItems = new T[length];
for (int i = arraySize - 1; 0 <= i; --i)
{
- linkedList.Remove(linkedList.Last); //Remove when VS Whidbey: 234648 is resolved
+ linkedList.Remove(linkedList.Last); //Remove when VS Whidbey: 234648 is resolved
T[] expectedItems = new T[i];
Array.Copy(headItems, 0, expectedItems, 0, i);
InitialItems_Tests(linkedList, expectedItems);
for (int i = 0; i < arraySize; ++i)
linkedList.AddFirst(headItems[i]);
- linkedList.Remove(linkedList.First.Next.Next); //Remove when VS Whidbey: 234648 is resolved
- linkedList.Remove(linkedList.Last.Previous.Previous); //Remove when VS Whidbey: 234648 is resolved
- linkedList.Remove(linkedList.First.Next); //Remove when VS Whidbey: 234648 is resolved
+ linkedList.Remove(linkedList.First.Next.Next); //Remove when VS Whidbey: 234648 is resolved
+ linkedList.Remove(linkedList.Last.Previous.Previous); //Remove when VS Whidbey: 234648 is resolved
+ linkedList.Remove(linkedList.First.Next); //Remove when VS Whidbey: 234648 is resolved
linkedList.Remove(linkedList.Last.Previous);
- linkedList.Remove(linkedList.First); //Remove when VS Whidbey: 234648 is resolved
+ linkedList.Remove(linkedList.First); //Remove when VS Whidbey: 234648 is resolved
linkedList.Remove(linkedList.Last); //Remove when VS Whidbey: 234648 is resolved
//With the above remove we should have removed the first and last 3 items
++index;
}
- linkedList.Remove(linkedList.First.Next.Next); //Remove when VS Whidbey: 234648 is resolved
- linkedList.Remove(linkedList.Last.Previous.Previous); //Remove when VS Whidbey: 234648 is resolved
- linkedList.Remove(linkedList.First.Next); //Remove when VS Whidbey: 234648 is resolved
+ linkedList.Remove(linkedList.First.Next.Next); //Remove when VS Whidbey: 234648 is resolved
+ linkedList.Remove(linkedList.Last.Previous.Previous); //Remove when VS Whidbey: 234648 is resolved
+ linkedList.Remove(linkedList.First.Next); //Remove when VS Whidbey: 234648 is resolved
linkedList.Remove(linkedList.Last.Previous);
- linkedList.Remove(linkedList.First); //Remove when VS Whidbey: 234648 is resolved
+ linkedList.Remove(linkedList.First); //Remove when VS Whidbey: 234648 is resolved
linkedList.Remove(linkedList.Last); //Remove when VS Whidbey: 234648 is resolved
//[] Verify that the duplicates were removed from the beginning of the collection
InitialItems_Tests(linkedList, items);
}
}
-}
\ No newline at end of file
+}
int iterations = 0;
int expectedCount = expectedItems.Length;
- //[] Verify non deterministic behavior of current every time it is called before a call to MoveNext() has been made
+ //[] Verify non deterministic behavior of current every time it is called before a call to MoveNext() has been made
for (int i = 0; i < 3; i++)
{
try
int iterations = 0;
int expectedCount = expectedItems.Length;
- //[] Verify non deterministic behavior of current every time it is called before a call to MoveNext() has been made
+ //[] Verify non deterministic behavior of current every time it is called before a call to MoveNext() has been made
for (int i = 0; i < 3; i++)
{
try
/// Using <see cref="NullDisplayTextResourceType" /> along with <see cref="NullDisplayText" />, allows the <see cref="GetNullDisplayText" />
/// method to return localized values.
/// </summary>
- public Type NullDisplayTextResourceType
+ public Type NullDisplayTextResourceType
{
get => _nullDisplayText.ResourceType;
set => _nullDisplayText.ResourceType = value;
/// <summary>
/// Override the string representation of this instance, returning
/// the <see cref="ErrorMessage" /> if not <c>null</c>, otherwise
- /// the base <see cref="Object.ToString" /> result.
+ /// the base <see cref="object.ToString" /> result.
/// </summary>
/// <remarks>
/// If the <see cref="ErrorMessage" /> is empty, it will still qualify
/// </remarks>
/// <returns>
/// The <see cref="ErrorMessage" /> property value if specified,
- /// otherwise, the base <see cref="Object.ToString" /> result.
+ /// otherwise, the base <see cref="object.ToString" /> result.
/// </returns>
public override string ToString() => ErrorMessage ?? base.ToString();
#endregion Methods
return list[1] as ExportMetadataAttribute;
}
- }
+ }
}
/// <param name="part">The part.</param>
/// <param name="contractType">Type of the contract.</param>
/// <returns>
- /// <c>true</c> if the specified part exports the specified contract; otherwise, <c>false</c>.
+ /// <c>true</c> if the specified part exports the specified contract; otherwise, <c>false</c>.
/// </returns>
public static bool Exports(this ComposablePartDefinition part, Type contractType)
{
/// <typeparam name="T">Type of the contract.</typeparam>
/// <param name="part">The part.</param>
/// <returns>
- /// <c>true</c> if the specified part exports the specified contract; otherwise, <c>false</c>.
+ /// <c>true</c> if the specified part exports the specified contract; otherwise, <c>false</c>.
/// </returns>
public static bool Exports<T>(this ComposablePartDefinition part)
{
/// <param name="part">The part.</param>
/// <param name="contractType">Type of the contract.</param>
/// <returns>
- /// <c>true</c> if the specified part imports the specified contract; otherwise, <c>false</c>.
+ /// <c>true</c> if the specified part imports the specified contract; otherwise, <c>false</c>.
/// </returns>
public static bool Imports(this ComposablePartDefinition part, Type contractType)
{
/// <param name="part">The part.</param>
/// <typeparam name="T">Type of the contract.</typeparam>
/// <returns>
- /// <c>true</c> if the specified part imports the specified contract; otherwise, <c>false</c>.
+ /// <c>true</c> if the specified part imports the specified contract; otherwise, <c>false</c>.
/// </returns>
public static bool Imports<T>(this ComposablePartDefinition part)
{
/// <param name="contractType">Type of the contract.</param>
/// <param name="importCardinality">The import cardinality.</param>
/// <returns>
- /// <c>true</c> if the specified part imports the specified contract with the given cardinality; otherwise, <c>false</c>.
+ /// <c>true</c> if the specified part imports the specified contract with the given cardinality; otherwise, <c>false</c>.
/// </returns>
public static bool Imports(this ComposablePartDefinition part, Type contractType, ImportCardinality importCardinality)
{
/// <typeparam name="T">Type of the contract.</typeparam>
/// <param name="importCardinality">The import cardinality.</param>
/// <returns>
- /// <c>true</c> if the specified part imports the specified contract with the given cardinality; otherwise, <c>false</c>.
+ /// <c>true</c> if the specified part imports the specified contract with the given cardinality; otherwise, <c>false</c>.
/// </returns>
public static bool Imports<T>(this ComposablePartDefinition part, ImportCardinality importCardinality)
{
/// Gets a message that describes the exception.
/// </summary>
/// <value>
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="ChangeRejectedException"/>.
/// </value>
public override string Message
/// with the specified error message.
/// </summary>
/// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="CompositionContractMismatchException"/>; or <see langword="null"/> to set
/// the <see cref="Exception.Message"/> property to its default value.
/// </param>
/// exception.
/// </summary>
/// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="CompositionContractMismatchException"/>; or <see langword="null"/> to set
/// the <see cref="Exception.Message"/> property to its default value.
/// </param>
/// with the specified error message.
/// </summary>
/// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="CompositionError"/>; or <see langword="null"/> to set the
/// <see cref="Description"/> property to an empty string ("").
/// </param>
/// <see langword="null"/>.
/// </param>
/// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="CompositionError"/>; or <see langword="null"/> to set the
/// <see cref="Description"/> property to an empty string ("").
/// </param>
/// composition error.
/// </summary>
/// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="CompositionError"/>; or <see langword="null"/> to set the
/// <see cref="Description"/> property to an empty string ("").
/// </param>
/// is the cause of the composition error.
/// </summary>
/// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="CompositionError"/>; or <see langword="null"/> to set the
/// <see cref="Description"/> property to an empty string ("").
/// </param>
/// Gets the message that describes the composition error.
/// </summary>
/// <value>
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="CompositionError"/>.
/// </value>
public string Description
/// Returns a string representation of the composition error.
/// </summary>
/// <returns>
- /// A <see cref="String"/> containing the <see cref="Description"/> property.
+ /// A <see cref="string"/> containing the <see cref="Description"/> property.
/// </returns>
public override string ToString()
{
/// with the specified error message.
/// </summary>
/// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="CompositionException"/>; or <see langword="null"/> to set
/// the <see cref="Exception.Message"/> property to its default value.
/// </param>
/// exception.
/// </summary>
/// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="CompositionException"/>; or <see langword="null"/> to set
/// the <see cref="Exception.Message"/> property to its default value.
/// </param>
/// Gets a message that describes the exception.
/// </summary>
/// <value>
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="CompositionException"/>.
/// </value>
public override string Message
/// type or member marked with this attribute under the specified contract name.
/// </summary>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name to export the type or member
+ /// A <see cref="string"/> containing the contract name to export the type or member
/// marked with this attribute, under; or <see langword="null"/> or an empty string
/// ("") to use the default contract name.
/// </param>
/// type or member marked with this attribute under the specified contract name.
/// </summary>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name to export the type or member
+ /// A <see cref="string"/> containing the contract name to export the type or member
/// marked with this attribute, under; or <see langword="null"/> or an empty string
/// ("") to use the default contract name.
/// </param>
/// Gets the contract name to export the type or member under.
/// </summary>
/// <value>
- /// A <see cref="String"/> containing the contract name to export the type or member
+ /// A <see cref="string"/> containing the contract name to export the type or member
/// marked with this attribute, under. The default value is an empty string ("").
/// </value>
public string ContractName { get; private set; }
/// specified name and metadata value.
/// </summary>
/// <param name="name">
- /// A <see cref="String"/> containing the name of the metadata value; or
+ /// A <see cref="string"/> containing the name of the metadata value; or
/// <see langword="null"/> to set the <see cref="Name"/> property to an empty
/// string ("").
/// </param>
/// Gets the name of the metadata value.
/// </summary>
/// <value>
- /// A <see cref="String"/> containing the name of the metadata value.
+ /// A <see cref="string"/> containing the name of the metadata value.
/// </value>
public string Name
{
/// empty <see cref="IEnumerable{T}"/>.
/// </result>
/// <remarks>
- /// <note type="inheritinfo">
+ /// <note type="inheritinfo">
/// The implementers should not treat the cardinality-related mismatches as errors, and are not
/// expected to throw exceptions in those cases.
/// For instance, if the import requests exactly one export and the provider has no matching exports or more than one,
/// Returns a string representation of the directory catalog.
/// </summary>
/// <returns>
- /// A <see cref="String"/> containing the string representation of the <see cref="DirectoryCatalog"/>.
+ /// A <see cref="string"/> containing the string representation of the <see cref="DirectoryCatalog"/>.
/// </returns>
public override string ToString()
{
/// Gets the display name of the ApplicationCatalog.
/// </summary>
/// <value>
- /// A <see cref="String"/> containing a human-readable display name of the <see cref="ApplicationCatalog"/>.
+ /// A <see cref="string"/> containing a human-readable display name of the <see cref="ApplicationCatalog"/>.
/// </value>
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
string ICompositionElement.DisplayName
/// with the specified code base.
/// </summary>
/// <param name="codeBase">
- /// A <see cref="String"/> containing the code base of the assembly containing the
+ /// A <see cref="string"/> containing the code base of the assembly containing the
/// attributed <see cref="Type"/> objects to add to the <see cref="AssemblyCatalog"/>.
/// </param>
/// <exception cref="ArgumentNullException">
/// with the specified code base.
/// </summary>
/// <param name="codeBase">
- /// A <see cref="String"/> containing the code base of the assembly containing the
+ /// A <see cref="string"/> containing the code base of the assembly containing the
/// attributed <see cref="Type"/> objects to add to the <see cref="AssemblyCatalog"/>.
/// </param>
/// <param name="reflectionContext">
/// with the specified code base.
/// </summary>
/// <param name="codeBase">
- /// A <see cref="String"/> containing the code base of the assembly containing the
+ /// A <see cref="string"/> containing the code base of the assembly containing the
/// attributed <see cref="Type"/> objects to add to the <see cref="AssemblyCatalog"/>.
/// </param>
/// <param name="definitionOrigin">
/// with the specified code base.
/// </summary>
/// <param name="codeBase">
- /// A <see cref="String"/> containing the code base of the assembly containing the
+ /// A <see cref="string"/> containing the code base of the assembly containing the
/// attributed <see cref="Type"/> objects to add to the <see cref="AssemblyCatalog"/>.
/// </param>
/// <param name="reflectionContext">
/// Gets the display name of the assembly catalog.
/// </summary>
/// <value>
- /// A <see cref="String"/> containing a human-readable display name of the <see cref="AssemblyCatalog"/>.
+ /// A <see cref="string"/> containing a human-readable display name of the <see cref="AssemblyCatalog"/>.
/// </value>
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
string ICompositionElement.DisplayName
/// Returns a string representation of the assembly catalog.
/// </summary>
/// <returns>
- /// A <see cref="String"/> containing the string representation of the <see cref="AssemblyCatalog"/>.
+ /// A <see cref="string"/> containing the string representation of the <see cref="AssemblyCatalog"/>.
/// </returns>
public override string ToString()
{
/// empty <see cref="IEnumerable{T}"/>.
/// </result>
/// <remarks>
- /// <note type="inheritinfo">
+ /// <note type="inheritinfo">
/// The implementers should not treat the cardinality-related mismatches as errors, and are not
/// expected to throw exceptions in those cases.
/// For instance, if the import requests exactly one export and the provider has no matching exports or more than one,
/// empty <see cref="IEnumerable{T}"/>.
/// </result>
/// <remarks>
- /// <note type="inheritinfo">
+ /// <note type="inheritinfo">
/// The implementers should not treat the cardinality-related mismatches as errors, and are not
/// expected to throw exceptions in those cases.
/// For instance, if the import requests exactly one export and the provider has no matching exports or more than one,
/// empty <see cref="IEnumerable{T}"/>.
/// </result>
/// <remarks>
- /// <note type="inheritinfo">
+ /// <note type="inheritinfo">
/// The implementers should not treat the cardinality-related mismatches as errors, and are not
/// expected to throw exceptions in those cases.
/// For instance, if the import requests exactly one export and the provider has no matching exports or more than one,
/// by <paramref name="definition"/>.
/// </returns>
/// <exception cref="ArgumentNullException">
- /// <paramref name="definition"/> is <see langword="null"/>.
+ /// <paramref name="definition"/> is <see langword="null"/>.
/// </exception>
/// <exception cref="ObjectDisposedException">
/// The <see cref="ComposablePartCatalog"/> has been disposed of.
/// </exception>
/// <remarks>
- /// <note type="inheritinfo">
+ /// <note type="inheritinfo">
/// Overriders of this property should never return <see langword="null"/>, if no
/// <see cref="ExportDefinition"/> match the conditions defined by
/// <paramref name="definition"/>, return an empty <see cref="IEnumerable{T}"/>.
/// Returns a string representation of the directory catalog.
/// </summary>
/// <returns>
- /// A <see cref="String"/> containing the string representation of the <see cref="DirectoryCatalog"/>.
+ /// A <see cref="string"/> containing the string representation of the <see cref="DirectoryCatalog"/>.
/// </returns>
public override string ToString()
{
/// Gets the display name of the directory catalog.
/// </summary>
/// <value>
- /// A <see cref="String"/> containing a human-readable display name of the <see cref="DirectoryCatalog"/>.
+ /// A <see cref="string"/> containing a human-readable display name of the <see cref="DirectoryCatalog"/>.
/// </value>
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
string ICompositionElement.DisplayName
/// <see cref="Lazy{T, TMetadataView}"/> underneath, where
/// <c>TMetadataView</c>
/// is <see cref="IDictionary{TKey, TValue}"/> and where <c>TKey</c>
- /// is <see cref="String"/> and <c>TValue</c> is <see cref="Object"/>.
+ /// is <see cref="string"/> and <c>TValue</c> is <see cref="object"/>.
/// </para>
/// <para>
/// The contract name is the result of calling
/// The type of the <see cref="Lazy{T}"/> object to return.
/// </typeparam>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the <see cref="Lazy{T}"/>
+ /// A <see cref="string"/> containing the contract name of the <see cref="Lazy{T}"/>
/// object to return; or <see langword="null"/> or an empty string ("") to use the
/// default contract name.
/// </param>
/// <see cref="Lazy{T, TMetadataView}"/> underneath, where
/// <c>TMetadataView</c>
/// is <see cref="IDictionary{TKey, TValue}"/> and where <c>TKey</c>
- /// is <see cref="String"/> and <c>TValue</c> is <see cref="Object"/>.
+ /// is <see cref="string"/> and <c>TValue</c> is <see cref="object"/>.
/// </para>
/// <para>
/// The contract name is the result of calling
/// to return.
/// </typeparam>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the
+ /// A <see cref="string"/> containing the contract name of the
/// <see cref="Lazy{T, TMetadataView}"/> object to return; or <see langword="null"/>
/// or an empty string ("") to use the default contract name.
/// </param>
/// return.
/// </param>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the
+ /// A <see cref="string"/> containing the contract name of the
/// <see cref="Export"/> object to return; or <see langword="null"/>
/// or an empty string ("") to use the default contract name.
/// </param>
/// <see cref="Lazy{T, TMetadataView}"/> underneath, where
/// <c>TMetadataView</c>
/// is <see cref="IDictionary{TKey, TValue}"/> and where <c>TKey</c>
- /// is <see cref="String"/> and <c>TValue</c> is <see cref="Object"/>.
+ /// is <see cref="string"/> and <c>TValue</c> is <see cref="object"/>.
/// </para>
/// <para>
/// The contract name is the result of calling
/// The type of the <see cref="Lazy{T}"/> objects to return.
/// </typeparam>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the <see cref="Lazy{T}"/>
+ /// A <see cref="string"/> containing the contract name of the <see cref="Lazy{T}"/>
/// objects to return; or <see langword="null"/> or an empty string ("") to use the
/// default contract name.
/// </param>
/// <see cref="Lazy{T, TMetadataView}"/> underneath, where
/// <c>TMetadataView</c>
/// is <see cref="IDictionary{TKey, TValue}"/> and where <c>TKey</c>
- /// is <see cref="String"/> and <c>TValue</c> is <see cref="Object"/>.
+ /// is <see cref="string"/> and <c>TValue</c> is <see cref="object"/>.
/// </para>
/// <para>
/// The default contract name is the result of calling
/// to return.
/// </typeparam>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the
+ /// A <see cref="string"/> containing the contract name of the
/// <see cref="Lazy{T, TMetadataView}"/> objects to return; or <see langword="null"/>
/// or an empty string ("") to use the default contract name.
/// </param>
/// derived from this type parameter.
/// </typeparam>
/// <returns>
- /// The exported <see cref="Object"/> with the contract name derived from
+ /// The exported <see cref="object"/> with the contract name derived from
/// <typeparamref name="T"/>.
/// </returns>
/// <remarks>
/// The type of the exported value to return.
/// </typeparam>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the exported value to return,
+ /// A <see cref="string"/> containing the contract name of the exported value to return,
/// or <see langword="null"/> or an empty string ("") to use the default contract name.
/// </param>
/// <returns>
- /// The exported <see cref="Object"/> with the specified contract name.
+ /// The exported <see cref="object"/> with the specified contract name.
/// </returns>
/// <remarks>
/// <para>
/// derived from this type parameter.
/// </typeparam>
/// <returns>
- /// The exported <see cref="Object"/> with the contract name derived from
+ /// The exported <see cref="object"/> with the contract name derived from
/// <typeparamref name="T"/>, if found; otherwise, the default value for
/// <typeparamref name="T"/>.
/// </returns>
/// The type of the exported value to return.
/// </typeparam>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the exported value to return,
+ /// A <see cref="string"/> containing the contract name of the exported value to return,
/// or <see langword="null"/> or an empty string ("") to use the default contract name.
/// </param>
/// <returns>
- /// The exported <see cref="Object"/> with the specified contract name, if found;
+ /// The exported <see cref="object"/> with the specified contract name, if found;
/// otherwise, the default value for <typeparamref name="T"/>.
/// </returns>
/// <remarks>
/// The type of the exported value to return.
/// </typeparam>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the exported values to
+ /// A <see cref="string"/> containing the contract name of the exported values to
/// return; or <see langword="null"/> or an empty string ("") to use the default
/// contract name.
/// </param>
/// by <paramref name="definition"/>.
/// </returns>
/// <exception cref="ArgumentNullException">
- /// <paramref name="definition"/> is <see langword="null"/>.
+ /// <paramref name="definition"/> is <see langword="null"/>.
/// </exception>
/// <exception cref="ObjectDisposedException">
/// The <see cref="ComposablePartCatalog"/> has been disposed of.
/// </exception>
/// <remarks>
- /// <note type="inheritinfo">
+ /// <note type="inheritinfo">
/// Overriders of this property should never return <see langword="null"/>, if no
/// <see cref="ExportDefinition"/> match the conditions defined by
/// <paramref name="definition"/>, return an empty <see cref="IEnumerable{T}"/>.
/// <param name="part">The part.</param>
/// <param name="contractName">Name of the contract.</param>
/// <returns>
- /// <c>true</c> if the specified part exports the specified contract; otherwise, <c>false</c>.
+ /// <c>true</c> if the specified part exports the specified contract; otherwise, <c>false</c>.
/// </returns>
public static bool Exports(this ComposablePartDefinition part, string contractName)
{
/// <param name="part">The part.</param>
/// <param name="contractName">Name of the contract.</param>
/// <returns>
- /// <c>true</c> if the specified part imports the specified contract; otherwise, <c>false</c>.
+ /// <c>true</c> if the specified part imports the specified contract; otherwise, <c>false</c>.
/// </returns>
public static bool Imports(this ComposablePartDefinition part, string contractName)
{
/// <param name="contractName">Name of the contract.</param>
/// <param name="importCardinality">The import cardinality.</param>
/// <returns>
- /// <c>true</c> if the specified part imports the specified contract with the given cardinality; otherwise, <c>false</c>.
+ /// <c>true</c> if the specified part imports the specified contract with the given cardinality; otherwise, <c>false</c>.
/// </returns>
public static bool Imports(this ComposablePartDefinition part, string contractName, ImportCardinality importCardinality)
{
/// <param name="part">The part.</param>
/// <param name="key">The key.</param>
/// <returns>
- /// <c>true</c> if the part contains a metadata entry with the specified key; otherwise, <c>false</c>.
+ /// <c>true</c> if the part contains a metadata entry with the specified key; otherwise, <c>false</c>.
/// </returns>
public static bool ContainsPartMetadataWithKey(this ComposablePartDefinition part, string key)
{
/// <param name="key">The key.</param>
/// <param name="value">The value.</param>
/// <returns>
- /// <c>true</c> the specified part contains a metadata entry with the specified key and value; otherwise, <c>false</c>.
+ /// <c>true</c> the specified part contains a metadata entry with the specified key and value; otherwise, <c>false</c>.
/// </returns>
public static bool ContainsPartMetadata<T>(this ComposablePartDefinition part, string key, T value)
{
/// Gets the display name of the type catalog.
/// </summary>
/// <value>
- /// A <see cref="String"/> containing a human-readable display name of the <see cref="TypeCatalog"/>.
+ /// A <see cref="string"/> containing a human-readable display name of the <see cref="TypeCatalog"/>.
/// </value>
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
string ICompositionElement.DisplayName
/// Returns a string representation of the type catalog.
/// </summary>
/// <returns>
- /// A <see cref="String"/> containing the string representation of the <see cref="TypeCatalog"/>.
+ /// A <see cref="string"/> containing the string representation of the <see cref="TypeCatalog"/>.
/// </returns>
public override string ToString()
{
/// export with the specified contract name.
/// </summary>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the export to import, or
+ /// A <see cref="string"/> containing the contract name of the export to import, or
/// <see langword="null"/> or an empty string ("") to use the default contract name.
/// </param>
/// <remarks>
/// Gets the contract name of the export to import.
/// </summary>
/// <value>
- /// A <see cref="String"/> containing the contract name of the export to import. The
+ /// A <see cref="string"/> containing the contract name of the export to import. The
/// default value is an empty string ("").
/// </value>
public string ContractName { get; private set; }
/// with the specified error message.
/// </summary>
/// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="ImportCardinalityMismatchException"/>; or <see langword="null"/> to set
/// the <see cref="Exception.Message"/> property to its default value.
/// </param>
/// exception.
/// </summary>
/// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="ImportCardinalityMismatchException"/>; or <see langword="null"/> to set
/// the <see cref="Exception.Message"/> property to its default value.
/// </param>
/// set of exports with the specified contract name.
/// </summary>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the exports to import, or
+ /// A <see cref="string"/> containing the contract name of the exports to import, or
/// <see langword="null"/> or an empty string ("") to use the default contract name.
/// </param>
/// <remarks>
/// Gets the contract name of the exports to import.
/// </summary>
/// <value>
- /// A <see cref="String"/> containing the contract name of the exports to import. The
+ /// A <see cref="string"/> containing the contract name of the exports to import. The
/// default value is an empty string ("").
/// </value>
public string ContractName { get; private set; }
/// type or member marked with this attribute under the specified contract name.
/// </summary>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name to export the type
+ /// A <see cref="string"/> containing the contract name to export the type
/// marked with this attribute, under; or <see langword="null"/> or an empty string
/// ("") to use the default contract name.
/// </param>
/// type or member marked with this attribute under the specified contract name.
/// </summary>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name to export the type
+ /// A <see cref="string"/> containing the contract name to export the type
/// marked with this attribute, under; or <see langword="null"/> or an empty string
/// ("") to use the default contract name.
/// </param>
/// specified name and metadata value.
/// </summary>
/// <param name="name">
- /// A <see cref="String"/> containing the name of the metadata value; or
+ /// A <see cref="string"/> containing the name of the metadata value; or
/// <see langword="null"/> to use an empty string ("").
/// </param>
/// <param name="value">
/// Gets the name of the metadata value.
/// </summary>
/// <value>
- /// A <see cref="String"/> containing the name of the metadata value.
+ /// A <see cref="string"/> containing the name of the metadata value.
/// </value>
public string Name
{
/// with the specified error message.
/// </summary>
/// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
/// the <see cref="Exception.Message"/> property to its default value.
/// </param>
/// the exception.
/// </summary>
/// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
/// the <see cref="Exception.Message"/> property to its default value.
/// </param>
/// exception.
/// </summary>
/// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
/// the <see cref="Exception.Message"/> property to its default value.
/// </param>
/// are the cause of the exception.
/// </summary>
/// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
+ /// A <see cref="string"/> containing a message that describes the
/// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
/// the <see cref="Exception.Message"/> property to its default value.
/// </param>
/// is a prerequisite.
/// </summary>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the
+ /// A <see cref="string"/> containing the contract name of the
/// <see cref="Export"/> required by the <see cref="ContractBasedImportDefinition"/>.
/// </param>
/// <param name="requiredTypeIdentity">
/// to generate a type identity for a given type. If no specific type is required pass <see langword="null"/>.
/// </param>
/// <param name="requiredMetadata">
- /// An <see cref="IEnumerable{T}"/> of <see cref="String"/> objects containing
+ /// An <see cref="IEnumerable{T}"/> of <see cref="string"/> objects containing
/// the metadata names of the <see cref="Export"/> required by the
/// <see cref="ContractBasedImportDefinition"/>; or <see langword="null"/> to
/// set the <see cref="RequiredMetadata"/> property to an empty <see cref="IEnumerable{T}"/>.
/// is a prerequisite.
/// </summary>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the
+ /// A <see cref="string"/> containing the contract name of the
/// <see cref="Export"/> required by the <see cref="ContractBasedImportDefinition"/>.
/// </param>
/// <param name="requiredTypeIdentity">
/// to generate a type identity for a given type. If no specific type is required pass <see langword="null"/>.
/// </param>
/// <param name="requiredMetadata">
- /// An <see cref="IEnumerable{T}"/> of <see cref="String"/> objects containing
+ /// An <see cref="IEnumerable{T}"/> of <see cref="string"/> objects containing
/// the metadata names of the <see cref="Export"/> required by the
/// <see cref="ContractBasedImportDefinition"/>; or <see langword="null"/> to
/// set the <see cref="RequiredMetadata"/> property to an empty <see cref="IEnumerable{T}"/>.
/// with the specified contract name and exported value getter.
/// </summary>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the
+ /// A <see cref="string"/> containing the contract name of the
/// <see cref="Export"/>.
/// </param>
/// <param name="exportedValueGetter">
/// with the specified contract name, metadata and exported value getter.
/// </summary>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the
+ /// A <see cref="string"/> containing the contract name of the
/// <see cref="Export"/>.
/// </param>
/// <param name="metadata">
/// Returns the exported value of the export.
/// </summary>
/// <returns>
- /// The exported <see cref="Object"/> of the <see cref="Export"/>.
+ /// The exported <see cref="object"/> of the <see cref="Export"/>.
/// </returns>
/// <exception cref="CompositionException">
/// An error occurred during composition. <see cref="CompositionException.Errors"/> will
/// Returns the exported value of the export.
/// </summary>
/// <returns>
- /// The exported <see cref="Object"/> of the <see cref="Export"/>.
+ /// The exported <see cref="object"/> of the <see cref="Export"/>.
/// </returns>
/// <exception cref="CompositionException">
/// An error occurred during composition. <see cref="CompositionException.Errors"/> will
/// the specified contract name and metadata.
/// </summary>
/// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the
+ /// A <see cref="string"/> containing the contract name of the
/// <see cref="ExportDefinition"/>.
/// </param>
/// <param name="metadata">
/// Gets the contract name of the export definition.
/// </summary>
/// <value>
- /// A <see cref="String"/> containing the contract name of the
+ /// A <see cref="string"/> containing the contract name of the
/// <see cref="ExportDefinition"/>.
/// </value>
/// <exception cref="NotImplementedException">
/// Returns a string representation of the export definition.
/// </summary>
/// <returns>
- /// A <see cref="String"/> containing the value of the <see cref="ContractName"/> property.
+ /// A <see cref="string"/> containing the value of the <see cref="ContractName"/> property.
/// </returns>
public override string ToString()
{
/// Gets the display name of the composition element.
/// </summary>
/// <value>
- /// A <see cref="String"/> containing a human-readable display name of the <see cref="ICompositionElement"/>.
+ /// A <see cref="string"/> containing a human-readable display name of the <see cref="ICompositionElement"/>.
/// </value>
/// <remarks>
/// <note type="implementnotes">
/// Gets the contract name of the export required by the import definition.
/// </summary>
/// <value>
- /// A <see cref="String"/> containing the contract name of the <see cref="Export"/>
+ /// A <see cref="string"/> containing the contract name of the <see cref="Export"/>
/// required by the <see cref="ContractBasedImportDefinition"/>. This property should
- /// return <see cref="String.Empty"/> for imports that do not require a specific
+ /// return <see cref="string.Empty"/> for imports that do not require a specific
/// contract name.
/// </value>
public virtual string ContractName
/// Returns a string representation of the import definition.
/// </summary>
/// <returns>
- /// A <see cref="String"/> containing the value of the <see cref="Constraint"/> property.
+ /// A <see cref="string"/> containing the value of the <see cref="Constraint"/> property.
/// </returns>
public override string ToString()
{
{
var catalog = CatalogFactory.Create();
catalog.Dispose();
- var definition = ImportDefinitionFactory.Create();
+ var definition = ImportDefinitionFactory.Create();
ExceptionAssert.ThrowsDisposed(catalog, () =>
{
protected bool DesignMode => _site?.DesignMode ?? false;
/// <summary>
- /// Returns a <see cref='System.String'/> containing the name of the
+ /// Returns a <see cref='string'/> containing the name of the
/// <see cref='System.ComponentModel.Component'/>, if any.
/// This method should not be overridden.
/// </summary>
}
/// <summary>
- /// Initializes a new instance of the <see cref='System.ComponentModel.AmbientValueAttribute'/> class using a <see cref='System.Boolean'/>
+ /// Initializes a new instance of the <see cref='System.ComponentModel.AmbientValueAttribute'/> class using a <see cref='bool'/>
/// value.
/// </summary>
public AmbientValueAttribute(bool value)
}
/// <summary>
- /// Initializes a new instance of the <see cref='System.ComponentModel.AmbientValueAttribute'/> class using a <see cref='System.String'/>.
+ /// Initializes a new instance of the <see cref='System.ComponentModel.AmbientValueAttribute'/> class using a <see cref='string'/>.
/// </summary>
public AmbientValueAttribute(string value)
{
if (dt.Ticks == 0)
{
// Special case for empty DateTime
- ConstructorInfo ctr = typeof(DateTime).GetConstructor(new Type[] { typeof(Int64) });
+ ConstructorInfo ctr = typeof(DateTime).GetConstructor(new Type[] { typeof(long) });
if (ctr != null)
{
namespace System.ComponentModel
{
/// <summary>
- /// Provides a type converter to convert <see cref='System.Decimal'/>
+ /// Provides a type converter to convert <see cref='decimal'/>
/// objects to and from various other representations.
/// </summary>
public class DecimalConverter : BaseNumberConverter
public virtual bool DesignMode => _site?.DesignMode ?? false;
/// <summary>
- /// Returns a <see cref='System.String'/> containing the name of the <see cref='System.ComponentModel.Component'/> , if any. This method should not be
+ /// Returns a <see cref='string'/> containing the name of the <see cref='System.ComponentModel.Component'/> , if any. This method should not be
/// overridden. For
/// internal use only.
/// </summary>
public virtual string Name => _name ?? "";
/// <summary>
- /// Gets the hash code for the name of the member as specified in <see cref='System.String.GetHashCode()'/>.
+ /// Gets the hash code for the name of the member as specified in <see cref='string.GetHashCode()'/>.
/// </summary>
protected virtual int NameHashCode => _nameHash;
}
/// <summary>
- /// Re-creates an <see cref='System.Object'/> given a set of property values for the object.
+ /// Re-creates an <see cref='object'/> given a set of property values for the object.
/// </summary>
public object CreateInstance(IDictionary propertyValues)
{
}
/// <summary>
- /// Re-creates an <see cref='System.Object'/> given a set of property values for the object.
+ /// Re-creates an <see cref='object'/> given a set of property values for the object.
/// </summary>
public virtual object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues) => null;
// System.ComponentModel.Container test cases
//
// Authors:
-// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
// Ivan N. Zlatev (contact i-nZ.net)
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
//
// ContextStackTest.cs - Unit tests for
-// System.ComponentModel.Design.Serialization.ContextStack
+// System.ComponentModel.Design.Serialization.ContextStack
//
// Author:
-// Ivan N. Zlatev <contact@i-nz.net>
+// Ivan N. Zlatev <contact@i-nz.net>
//
// Copyright (C) 2007 Ivan N. Zlatev <contact@i-nz.net>
//
{
}
}
-}
\ No newline at end of file
+}
//
// InstanceDescriptorTest.cs - Unit tests for
-// System.ComponentModel.Design.Serialization.InstanceDescriptor
+// System.ComponentModel.Design.Serialization.InstanceDescriptor
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// System.ComponentModel.LicenseManagerTests test cases
//
// Authors:
-// Ivan Hamilton (ivan@chimerical.com.au)
-// Gonzalo Paniagua Javier (gonzalo@ximian.com)
-// Martin Willemoes Hansen (mwh@sysrq.dk)
+// Ivan Hamilton (ivan@chimerical.com.au)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Martin Willemoes Hansen (mwh@sysrq.dk)
//
// (c) 2002 Ximian, Inc. (http://www.ximian.com)
// (c) 2003 Martin Willemoes Hansen
{
public class ExtendedProtectionPolicyTypeConverterTests
{
- [Theory]
- [InlineData(typeof(int))]
- [InlineData(typeof(ExtendedProtectionPolicy))]
- [InlineData(typeof(bool))]
- [InlineData(null)]
- [InlineData(typeof(float))]
- [InlineData(typeof(TypeConverter))]
- public void CanConvertTo_NegativeTests(Type destinationType)
- {
- Assert.False(converter.CanConvertTo(null, destinationType));
- }
+ [Theory]
+ [InlineData(typeof(int))]
+ [InlineData(typeof(ExtendedProtectionPolicy))]
+ [InlineData(typeof(bool))]
+ [InlineData(null)]
+ [InlineData(typeof(float))]
+ [InlineData(typeof(TypeConverter))]
+ public void CanConvertTo_NegativeTests(Type destinationType)
+ {
+ Assert.False(converter.CanConvertTo(null, destinationType));
+ }
- [Fact]
- public void CanConvertTo_PositiveTests()
- {
- Assert.True(converter.CanConvertTo(null, typeof(string)));
- Assert.True(converter.CanConvertTo(null, typeof(InstanceDescriptor)));
- }
+ [Fact]
+ public void CanConvertTo_PositiveTests()
+ {
+ Assert.True(converter.CanConvertTo(null, typeof(string)));
+ Assert.True(converter.CanConvertTo(null, typeof(InstanceDescriptor)));
+ }
- [Fact]
- public void ConvertTo_NullTypeTests()
- {
- Assert.Throws<ArgumentNullException>(() => converter.ConvertTo(null, CultureInfo.InvariantCulture, new ExtendedProtectionPolicy(PolicyEnforcement.Never), null));
- }
+ [Fact]
+ public void ConvertTo_NullTypeTests()
+ {
+ Assert.Throws<ArgumentNullException>(() => converter.ConvertTo(null, CultureInfo.InvariantCulture, new ExtendedProtectionPolicy(PolicyEnforcement.Never), null));
+ }
- [Fact]
- public void ConvertTo_PositiveTests()
- {
- ExtendedProtectionPolicy policy = new ExtendedProtectionPolicy(PolicyEnforcement.Never);
-
- InstanceDescriptor instanceDescriptor = converter.ConvertTo(null, CultureInfo.InvariantCulture, policy, typeof(InstanceDescriptor)) as InstanceDescriptor;
- ExtendedProtectionPolicy instanceResult = instanceDescriptor.Invoke() as ExtendedProtectionPolicy;
- Assert.NotNull(instanceDescriptor);
- Assert.NotNull(instanceResult);
- Assert.Equal(PolicyEnforcement.Never, instanceResult.PolicyEnforcement);
- Assert.Equal(policy.ProtectionScenario, instanceResult.ProtectionScenario);
- Assert.Null(instanceResult.CustomServiceNames);
+ [Fact]
+ public void ConvertTo_PositiveTests()
+ {
+ ExtendedProtectionPolicy policy = new ExtendedProtectionPolicy(PolicyEnforcement.Never);
+
+ InstanceDescriptor instanceDescriptor = converter.ConvertTo(null, CultureInfo.InvariantCulture, policy, typeof(InstanceDescriptor)) as InstanceDescriptor;
+ ExtendedProtectionPolicy instanceResult = instanceDescriptor.Invoke() as ExtendedProtectionPolicy;
+ Assert.NotNull(instanceDescriptor);
+ Assert.NotNull(instanceResult);
+ Assert.Equal(PolicyEnforcement.Never, instanceResult.PolicyEnforcement);
+ Assert.Equal(policy.ProtectionScenario, instanceResult.ProtectionScenario);
+ Assert.Null(instanceResult.CustomServiceNames);
- Assert.Equal(string.Empty,
- converter.ConvertTo(null, CultureInfo.InvariantCulture, null, typeof(string)) as string);
- Assert.Equal(policy.ToString(),
- converter.ConvertTo(null, CultureInfo.InvariantCulture, policy, typeof(string)) as string);
- }
+ Assert.Equal(string.Empty,
+ converter.ConvertTo(null, CultureInfo.InvariantCulture, null, typeof(string)) as string);
+ Assert.Equal(policy.ToString(),
+ converter.ConvertTo(null, CultureInfo.InvariantCulture, policy, typeof(string)) as string);
+ }
- [Theory]
- [InlineData(typeof(int))]
- [InlineData(typeof(ExtendedProtectionPolicy))]
- [InlineData(typeof(bool))]
- [InlineData(typeof(float))]
- [InlineData(typeof(TypeConverter))]
- public void ConvertTo_NegativeTests(Type destinationType)
- {
- ExtendedProtectionPolicy policy = new ExtendedProtectionPolicy(PolicyEnforcement.Never);
+ [Theory]
+ [InlineData(typeof(int))]
+ [InlineData(typeof(ExtendedProtectionPolicy))]
+ [InlineData(typeof(bool))]
+ [InlineData(typeof(float))]
+ [InlineData(typeof(TypeConverter))]
+ public void ConvertTo_NegativeTests(Type destinationType)
+ {
+ ExtendedProtectionPolicy policy = new ExtendedProtectionPolicy(PolicyEnforcement.Never);
- Assert.Throws<NotSupportedException>(() => converter.ConvertTo(null, CultureInfo.InvariantCulture, policy, destinationType));
- }
+ Assert.Throws<NotSupportedException>(() => converter.ConvertTo(null, CultureInfo.InvariantCulture, policy, destinationType));
+ }
- private ExtendedProtectionPolicyTypeConverter converter = new ExtendedProtectionPolicyTypeConverter();
+ private ExtendedProtectionPolicyTypeConverter converter = new ExtendedProtectionPolicyTypeConverter();
}
}
// for System.Configuration.CallbackValidator.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.CommaDelimitedStringCollectionConverter.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.CommaDelimitedStringCollection.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.ConfigurationElement.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
// ConfigurationErrorsExceptionTest.cs
//
// Author:
-// Gert Driesen <drieseng@users.sourceforge.net>
+// Gert Driesen <drieseng@users.sourceforge.net>
//
// Copyright (C) 2008 Gert Driesen
//
// tests for System.Configuration.ConfigurationLockCollection.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.ConfigurationManager.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
-// Atsushi Enomoto <atsushi@ximian.com>
+// Chris Toshok <toshok@ximian.com>
+// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2005-2006 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.ConfigurationElement.
//
// Author:
-// Konstantin Triger <kostat@mainsoft.com>
+// Konstantin Triger <kostat@mainsoft.com>
//
// Copyright (C) 2006 Mainsoft, Inc (http://www.mainsoft.com)
//
// ConfigurationSectionGroupTest.cs
//
// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
+// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
// System.Configuration.ConfigurationSectionTest.cs - Unit tests
//
// Author:
-// Greg Smolyn
-// Gonzalo Paniagua Javier <gonzalo@novell.com
+// Greg Smolyn
+// Gonzalo Paniagua Javier <gonzalo@novell.com
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.ConnectionStringSettings
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.DefaultValidator.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.ExeConfigurationFileMap.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.GenericEnumConverter.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.InfiniteIntConverter.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.InfiniteTimeSpanConverter.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.IntegerValidator.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
-// Andres G. Aragoneses <andres@7digital.com>
+// Chris Toshok <toshok@ximian.com>
+// Andres G. Aragoneses <andres@7digital.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
// Copyright (C) 2012 7digital Media, Ltd (http://www.7digital.com)
// for System.Configuration.KeyValueConfigurationCollection.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.KeyValueConfigurationElement.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.LongValidator.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.PositiveTimeSpanValidator.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.RegexStringValidator.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.StringValidator.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.SubclassTypeValidator.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.TimeSpanMinutesConverter.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.TimeSpanMinutesOrInfiniteConverter.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.TimeSpanSecondsConverter.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.TimeSpanSecondsOrInfiniteConverter.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.TimeSpanValidator.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.TypeNameConverter.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// for System.Configuration.WhiteSpaceTrimStringConverter.
//
// Author:
-// Chris Toshok <toshok@ximian.com>
+// Chris Toshok <toshok@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
}
}
- public unsafe static string Title
+ public static unsafe string Title
{
get
{
value = null;
return false;
}
- }
+ }
}
\ No newline at end of file
finalPredicate =
(DataRow row) =>
{
- if (!Object.ReferenceEquals(row, _selector((TRow)(object)row)))
+ if (!object.ReferenceEquals(row, _selector((TRow)(object)row)))
{
throw DataSetUtil.NotSupported(SR.ToLDVUnsupported);
}
finalPredicate =
(DataRow row) =>
{
- if (!Object.ReferenceEquals(row, _selector((TRow)(object)row)))
+ if (!object.ReferenceEquals(row, _selector((TRow)(object)row)))
{
throw DataSetUtil.NotSupported(SR.ToLDVUnsupported);
}
internal const int Minus = 16; // -
internal const int Multiply = 17; // *
internal const int Divide = 18; // /
- //internal final static int IntegerDiv = 19; // \
+ //internal final static int IntegerDiv = 19; // \
internal const int Modulo = 20; // %
- //internal final static int Exponent = 21; // **
+ //internal final static int Exponent = 21; // **
/* End of arithmetic operators */
/* Beginning of bitwise operators */
"Between", //Between = 6;
/* Beginning of Comparison (relationa) operators */
- "=", //EqualTo = 7; // =
- ">", //GreaterThen = 8; // >
- "<", //LessThen = 9; // <
+ "=", //EqualTo = 7; // =
+ ">", //GreaterThen = 8; // >
+ "<", //LessThen = 9; // <
">=", //GreaterOrEqual = 10;// >=
- "<=", //LessOrEqual = 11; // <=
- "<>", //NotEqual = 12; // <>
+ "<=", //LessOrEqual = 11; // <=
+ "<>", //NotEqual = 12; // <>
/* End of Comparison (relational) operators */
"Is", //Is = 13;
"Like", //Like = 14;
/* Beginning of arithmetic operators */
- "+", //Plus = 15; // +
- "-", //Minus = 16; // -
- "*", //Multiply = 17; // *
- "/", //Divide = 18; // /
- "\\", //IntegerDiv = 19; // \
- "Mod", //Modulo = 20; // %
- "**", //Exponent = 21; // **
+ "+", //Plus = 15; // +
+ "-", //Minus = 16; // -
+ "*", //Multiply = 17; // *
+ "/", //Divide = 18; // /
+ "\\", //IntegerDiv = 19; // \
+ "Mod", //Modulo = 20; // %
+ "**", //Exponent = 21; // **
/* End of arithmetic operators */
/* Beginning of bitwise operators */
- "&", //BitwiseAnd = 22; // &
- "|", //BitwiseOr = 23; // |
- "^", //BitwiseXor = 24; // ^
- "~", //BitwiseNot = 25; // ~
+ "&", //BitwiseAnd = 22; // &
+ "|", //BitwiseOr = 23; // |
+ "^", //BitwiseXor = 24; // ^
+ "~", //BitwiseNot = 25; // ~
/* End of bitwise operators */
/* Beginning of logical operators */
- "And", //And = 26; // AND
- "Or", //Or = 27; // OR
+ "And", //And = 26; // AND
+ "Or", //Or = 27; // OR
// Not is in the unary ops
/* End of logical operators */
"True", //True = 33;
"False", //False = 34;
- "Date", //Date = 35; // Date constant
- "GenUniqueId()", //GenUniqueId = 36; // Generate unique ID
- "GenGuid()", //GenGUID = 37; // Generate GUID
- "Guid {..}", //GUID = 38; // GUID constant
+ "Date", //Date = 35; // Date constant
+ "GenUniqueId()", //GenUniqueId = 36; // Generate unique ID
+ "GenGuid()", //GenGUID = 37; // Generate GUID
+ "Guid {..}", //GUID = 38; // GUID constant
- "Is Not", //IsNot = 39; // internal only
+ "Is Not", //IsNot = 39; // internal only
};
internal static string ToString(int op)
if (value == null)
{
base.RowPredicate = null;
- base.RowFilter = String.Empty; // INDEX rebuild twice
+ base.RowFilter = string.Empty; // INDEX rebuild twice
}
else
{
internal override int FindByKey(object key)
{
Debug.Assert(base.Sort != null);
- Debug.Assert(!(!String.IsNullOrEmpty(base.Sort) && base.SortComparison != null),
+ Debug.Assert(!(!string.IsNullOrEmpty(base.Sort) && base.SortComparison != null),
"string and expression based sort cannot both be set");
- if (!String.IsNullOrEmpty(base.Sort)) // use find for DV's sort string
+ if (!string.IsNullOrEmpty(base.Sort)) // use find for DV's sort string
{
return base.FindByKey(key);
}
internal override int FindByKey(object[] key)
{
// must have string or expression based sort specified
- if (base.SortComparison == null && String.IsNullOrEmpty(base.Sort))
+ if (base.SortComparison == null && string.IsNullOrEmpty(base.Sort))
{
// This is the exception message from DataView that we want to use
throw ExceptionBuilder.IndexKeyLength(0, 0);
internal override DataRowView[] FindRowsByKey(object[] key)
{
// must have string or expression based sort specified
- if (base.SortComparison == null && String.IsNullOrEmpty(base.Sort))
+ if (base.SortComparison == null && string.IsNullOrEmpty(base.Sort))
{
// This is the exception message from DataView that we want to use
throw ExceptionBuilder.IndexKeyLength(0, 0);
/// </summary>
void IBindingList.RemoveSort()
{
- base.Sort = String.Empty;
+ base.Sort = string.Empty;
base.SortComparison = null;
}
public sealed class SqlBytes : INullable, IXmlSerializable, ISerializable
{
// --------------------------------------------------------------
- // Data members
+ // Data members
// --------------------------------------------------------------
// SqlBytes has five possible states
// 1) SqlBytes is Null
- // - m_stream must be null, m_lCuLen must be x_lNull.
+ // - m_stream must be null, m_lCuLen must be x_lNull.
// 2) SqlBytes contains a valid buffer,
- // - m_rgbBuf must not be null,m_stream must be null
+ // - m_rgbBuf must not be null,m_stream must be null
// 3) SqlBytes contains a valid pointer
- // - m_rgbBuf could be null or not,
- // if not null, content is garbage, should never look into it.
+ // - m_rgbBuf could be null or not,
+ // if not null, content is garbage, should never look into it.
// - m_stream must be null.
// 4) SqlBytes contains a Stream
// - m_stream must not be null
// - m_rgbBuf could be null or not. if not null, content is garbage, should never look into it.
- // - m_lCurLen must be x_lNull.
+ // - m_lCurLen must be x_lNull.
// 5) SqlBytes contains a Lazy Materialized Blob (ie, StorageState.Delayed)
//
internal byte[] _rgbBuf; // Data buffer
private const long x_lNull = -1L;
// --------------------------------------------------------------
- // Constructor(s)
+ // Constructor(s)
// --------------------------------------------------------------
// Public default constructor used for XML serialization
// --------------------------------------------------------------
- // Public properties
+ // Public properties
// --------------------------------------------------------------
// INullable
}
// Property: the in-memory buffer of SqlBytes
- // Return Buffer even if SqlBytes is Null.
+ // Return Buffer even if SqlBytes is Null.
public byte[] Buffer
{
get
}
// Property: the max length of the data
- // Return MaxLength even if SqlBytes is Null.
- // When the buffer is also null, return -1.
- // If containing a Stream, return -1.
+ // Return MaxLength even if SqlBytes is Null.
+ // When the buffer is also null, return -1.
+ // If containing a Stream, return -1.
public long MaxLength
{
get
}
// --------------------------------------------------------------
- // Public methods
+ // Public methods
// --------------------------------------------------------------
public void SetNull()
}
// --------------------------------------------------------------
- // Conversion operators
+ // Conversion operators
// --------------------------------------------------------------
// Alternative method: ToSqlBinary()
}
// --------------------------------------------------------------
- // Private utility functions
+ // Private utility functions
// --------------------------------------------------------------
[Conditional("DEBUG")]
}
// --------------------------------------------------------------
- // XML Serialization
+ // XML Serialization
// --------------------------------------------------------------
XmlSchema IXmlSerializable.GetSchema()
// --------------------------------------------------------------
- // Serialization using ISerializable
+ // Serialization using ISerializable
// --------------------------------------------------------------
// State information is not saved. The current state is converted to Buffer and only the underlying
}
// --------------------------------------------------------------
- // Static fields, properties
+ // Static fields, properties
// --------------------------------------------------------------
// Get a Null instance.
internal sealed class StreamOnSqlBytes : Stream
{
// --------------------------------------------------------------
- // Data members
+ // Data members
// --------------------------------------------------------------
private SqlBytes _sb; // the SqlBytes object
private long _lPosition;
// --------------------------------------------------------------
- // Constructor(s)
+ // Constructor(s)
// --------------------------------------------------------------
internal StreamOnSqlBytes(SqlBytes sb)
}
// --------------------------------------------------------------
- // Public properties
+ // Public properties
// --------------------------------------------------------------
// Always can read/write/seek, unless sb is null,
}
// --------------------------------------------------------------
- // Public methods
+ // Public methods
// --------------------------------------------------------------
public override long Seek(long offset, SeekOrigin origin)
}
// --------------------------------------------------------------
- // Private utility functions
+ // Private utility functions
// --------------------------------------------------------------
private bool FClosed()
public sealed class SqlChars : INullable, IXmlSerializable, ISerializable
{
// --------------------------------------------------------------
- // Data members
+ // Data members
// --------------------------------------------------------------
// SqlChars has five possible states
// 1) SqlChars is Null
- // - m_stream must be null, m_lCuLen must be x_lNull
+ // - m_stream must be null, m_lCuLen must be x_lNull
// 2) SqlChars contains a valid buffer,
- // - m_rgchBuf must not be null, and m_stream must be null
+ // - m_rgchBuf must not be null, and m_stream must be null
// 3) SqlChars contains a valid pointer
- // - m_rgchBuf could be null or not,
- // if not null, content is garbage, should never look into it.
+ // - m_rgchBuf could be null or not,
+ // if not null, content is garbage, should never look into it.
// - m_stream must be null.
// 4) SqlChars contains a SqlStreamChars
// - m_stream must not be null
// - m_rgchBuf could be null or not. if not null, content is garbage, should never look into it.
- // - m_lCurLen must be x_lNull.
+ // - m_lCurLen must be x_lNull.
// 5) SqlChars contains a Lazy Materialized Blob (ie, StorageState.Delayed)
//
internal char[] _rgchBuf; // Data buffer
private const long x_lNull = -1L;
// --------------------------------------------------------------
- // Constructor(s)
+ // Constructor(s)
// --------------------------------------------------------------
// Public default constructor used for XML serialization
}
// --------------------------------------------------------------
- // Public properties
+ // Public properties
// --------------------------------------------------------------
// INullable
}
// Property: the in-memory buffer of SqlChars
- // Return Buffer even if SqlChars is Null.
+ // Return Buffer even if SqlChars is Null.
public char[] Buffer
{
}
// Property: the max length of the data
- // Return MaxLength even if SqlChars is Null.
- // When the buffer is also null, return -1.
- // If containing a Stream, return -1.
+ // Return MaxLength even if SqlChars is Null.
+ // When the buffer is also null, return -1.
+ // If containing a Stream, return -1.
public long MaxLength
{
}
// --------------------------------------------------------------
- // Public methods
+ // Public methods
// --------------------------------------------------------------
public void SetNull()
}
// --------------------------------------------------------------
- // Conversion operators
+ // Conversion operators
// --------------------------------------------------------------
// Alternative method: ToSqlString()
}
// --------------------------------------------------------------
- // Private utility functions
+ // Private utility functions
// --------------------------------------------------------------
[Conditional("DEBUG")]
}
// --------------------------------------------------------------
- // XML Serialization
+ // XML Serialization
// --------------------------------------------------------------
}
// --------------------------------------------------------------
- // Serialization using ISerializable
+ // Serialization using ISerializable
// --------------------------------------------------------------
// State information is not saved. The current state is converted to Buffer and only the underlying
}
// --------------------------------------------------------------
- // Static fields, properties
+ // Static fields, properties
// --------------------------------------------------------------
// Get a Null instance.
internal sealed class SqlStreamChars
{
// --------------------------------------------------------------
- // Data members
+ // Data members
// --------------------------------------------------------------
private SqlChars _sqlchars; // the SqlChars object
private long _lPosition;
// --------------------------------------------------------------
- // Constructor(s)
+ // Constructor(s)
// --------------------------------------------------------------
internal SqlStreamChars(SqlChars s)
}
// --------------------------------------------------------------
- // Public properties
+ // Public properties
// --------------------------------------------------------------
public long Length
}
// --------------------------------------------------------------
- // Public methods
+ // Public methods
// --------------------------------------------------------------
public long Seek(long offset, SeekOrigin origin)
}
// --------------------------------------------------------------
- // Private utility functions
+ // Private utility functions
// --------------------------------------------------------------
private bool FClosed()
public SqlXml(XmlReader value)
{
- // whoever pass in the XmlReader is responsible for closing it
+ // whoever pass in the XmlReader is responsible for closing it
if (value == null)
{
SetNull();
ww.WriteNode(reader, true);
}
ww.Flush();
- // set the stream to the beginning
+ // set the stream to the beginning
writerStream.Seek(0, SeekOrigin.Begin);
return writerStream;
}
{
return new XmlQualifiedName("anyType", XmlSchema.Namespace);
}
- } // SqlXml
+ } // SqlXml
// two purposes for this class
// 1) keep its internal position so one reader positions on the orginial stream
- // will not interface with the other
+ // will not interface with the other
// 2) when xmlreader calls close, do not close the orginial stream
//
internal sealed class SqlXmlStreamWrapper : Stream
{
// --------------------------------------------------------------
- // Data members
+ // Data members
// --------------------------------------------------------------
private Stream _stream;
private bool _isClosed;
// --------------------------------------------------------------
- // Constructor(s)
+ // Constructor(s)
// --------------------------------------------------------------
internal SqlXmlStreamWrapper(Stream stream)
}
// --------------------------------------------------------------
- // Public properties
+ // Public properties
// --------------------------------------------------------------
// Always can read/write/seek, unless stream is null,
}
// --------------------------------------------------------------
- // Public methods
+ // Public methods
// --------------------------------------------------------------
public override long Seek(long offset, SeekOrigin origin)
[Fact]
public void Equals()
{
- // DataColumnMappingCollection collect2=new DataColumnMappingCollection();
+ // DataColumnMappingCollection collect2=new DataColumnMappingCollection();
_columnMapCollection.AddRange(_cols);
- // collect2.AddRange(cols);
+ // collect2.AddRange(cols);
DataColumnMappingCollection copy1;
copy1 = _columnMapCollection;
- // Assert.Equal (false, columnMapCollection.Equals(collect2));
+ // Assert.Equal (false, columnMapCollection.Equals(collect2));
Assert.True(_columnMapCollection.Equals(copy1));
- // Assert.Equal (false, collect2.Equals(columnMapCollection));
+ // Assert.Equal (false, collect2.Equals(columnMapCollection));
Assert.True(copy1.Equals(_columnMapCollection));
- // Assert.Equal (false, collect2.Equals(copy1));
+ // Assert.Equal (false, collect2.Equals(copy1));
Assert.True(copy1.Equals(_columnMapCollection));
Assert.True(_columnMapCollection.Equals(_columnMapCollection));
- // Assert.Equal (true, collect2.Equals(collect2));
+ // Assert.Equal (true, collect2.Equals(collect2));
Assert.True(copy1.Equals(copy1));
- // Assert.Equal (false, Object.Equals(collect2, columnMapCollection));
+ // Assert.Equal (false, Object.Equals(collect2, columnMapCollection));
Assert.True(object.Equals(copy1, _columnMapCollection));
- // Assert.Equal (false, Object.Equals(columnMapCollection, collect2));
+ // Assert.Equal (false, Object.Equals(columnMapCollection, collect2));
Assert.True(object.Equals(_columnMapCollection, copy1));
- // Assert.Equal (false, Object.Equals(copy1, collect2));
+ // Assert.Equal (false, Object.Equals(copy1, collect2));
Assert.True(object.Equals(_columnMapCollection, copy1));
Assert.True(object.Equals(_columnMapCollection, _columnMapCollection));
- // Assert.Equal (true, Object.Equals(collect2, collect2));
+ // Assert.Equal (true, Object.Equals(collect2, collect2));
Assert.True(object.Equals(copy1, copy1));
- // Assert.Equal (false, Object.Equals(columnMapCollection, collect2));
+ // Assert.Equal (false, Object.Equals(columnMapCollection, collect2));
Assert.True(object.Equals(_columnMapCollection, copy1));
- // Assert.Equal (false, Object.Equals(collect2, columnMapCollection));
+ // Assert.Equal (false, Object.Equals(collect2, columnMapCollection));
Assert.True(object.Equals(copy1, _columnMapCollection));
- // Assert.Equal (false, Object.Equals(collect2, copy1));
+ // Assert.Equal (false, Object.Equals(collect2, copy1));
Assert.True(object.Equals(copy1, _columnMapCollection));
}
[Fact]
public void Equals()
{
- // DataTableMappingCollection collect2=new DataTableMappingCollection();
+ // DataTableMappingCollection collect2=new DataTableMappingCollection();
_tableMapCollection.AddRange(_tabs);
- // collect2.AddRange(tabs);
+ // collect2.AddRange(tabs);
DataTableMappingCollection copy1;
copy1 = _tableMapCollection;
- // Assert.False(tableMapCollection.Equals(collect2));
+ // Assert.False(tableMapCollection.Equals(collect2));
Assert.True(_tableMapCollection.Equals(copy1));
- // Assert.False(collect2.Equals(tableMapCollection));
+ // Assert.False(collect2.Equals(tableMapCollection));
Assert.True(copy1.Equals(_tableMapCollection));
- // Assert.False(collect2.Equals(copy1));
+ // Assert.False(collect2.Equals(copy1));
Assert.True(copy1.Equals(_tableMapCollection));
Assert.True(_tableMapCollection.Equals(_tableMapCollection));
- // Assert.True(collect2.Equals(collect2));
+ // Assert.True(collect2.Equals(collect2));
Assert.True(copy1.Equals(copy1));
- // Assert.False(Object.Equals(collect2, tableMapCollection));
+ // Assert.False(Object.Equals(collect2, tableMapCollection));
Assert.True(object.Equals(copy1, _tableMapCollection));
- // Assert.False(Object.Equals(tableMapCollection, collect2));
+ // Assert.False(Object.Equals(tableMapCollection, collect2));
Assert.True(object.Equals(_tableMapCollection, copy1));
- // Assert.False(Object.Equals(copy1, collect2));
+ // Assert.False(Object.Equals(copy1, collect2));
Assert.True(object.Equals(_tableMapCollection, copy1));
Assert.True(object.Equals(_tableMapCollection, _tableMapCollection));
- // Assert.True(Object.Equals(collect2, collect2));
+ // Assert.True(Object.Equals(collect2, collect2));
Assert.True(object.Equals(copy1, copy1));
- // Assert.False(Object.Equals(tableMapCollection, collect2));
+ // Assert.False(Object.Equals(tableMapCollection, collect2));
Assert.True(object.Equals(_tableMapCollection, copy1));
- // Assert.False(Object.Equals(collect2, tableMapCollection));
+ // Assert.False(Object.Equals(collect2, tableMapCollection));
Assert.True(object.Equals(copy1, _tableMapCollection));
- // Assert.False(Object.Equals(collect2, copy1));
+ // Assert.False(Object.Equals(collect2, copy1));
Assert.True(object.Equals(copy1, _tableMapCollection));
}
ds.Tables.Add(DataProvider.CreateChildDataTable());
Constraint badConstraint = new UniqueConstraint(ds.Tables[0].Columns[0]);
- ds.Tables[1].Constraints.AddRange(new Constraint[] { badConstraint }); //Cuz foreign key belongs to child table
+ ds.Tables[1].Constraints.AddRange(new Constraint[] { badConstraint }); //Cuz foreign key belongs to child table
});
}
}
catch (ArgumentException e)
{
- // Assert.Equal (typeof (ArgumentException), e.GetType ());
- // Assert.Equal ("Column 'test' already belongs to this or another DataTable.", e.Message);
+ // Assert.Equal (typeof (ArgumentException), e.GetType ());
+ // Assert.Equal ("Column 'test' already belongs to this or another DataTable.", e.Message);
}
try
}
catch (ArgumentException e)
{
- // Assert.Equal (typeof (ArgumentException), e.GetType ());
- // Assert.Equal ("Column 'test' already belongs to this or another DataTable.", e.Message);
+ // Assert.Equal (typeof (ArgumentException), e.GetType ());
+ // Assert.Equal ("Column 'test' already belongs to this or another DataTable.", e.Message);
}
DataColumn C2 = new DataColumn("test");
}
catch (DuplicateNameException e)
{
- // Assert.Equal (typeof (DuplicateNameException), e.GetType ());
- // Assert.Equal ("A DataColumn named 'test' already belongs to this DataTable.", e.Message);
+ // Assert.Equal (typeof (DuplicateNameException), e.GetType ());
+ // Assert.Equal ("A DataColumn named 'test' already belongs to this DataTable.", e.Message);
}
try
}
catch (InvalidExpressionException e)
{
- // Assert.True (e is InvalidExpressionException);
- // Assert.Equal ("Expression 'substring ('fdsafewq', 2)' is invalid.", e.Message);
+ // Assert.True (e is InvalidExpressionException);
+ // Assert.Equal ("Expression 'substring ('fdsafewq', 2)' is invalid.", e.Message);
}
}
Assert.Equal(typeof(ArgumentNullException), ex.GetType());
Assert.Null(ex.InnerException);
// Never premise English.
- // Assert.NotNull (ex.Message);
+ // Assert.NotNull (ex.Message);
Assert.NotNull(ex.ParamName);
Assert.Equal("dataType", ex.ParamName);
}
#if false
// Check Windows output for the row [0] value
- [Fact]
- public void NullStrings ()
- {
- var a = MakeColumn ("nullbar", "null+'bar'");
- var b = MakeColumn ("barnull", "'bar'+null");
- var c = MakeColumn ("foobar", "'foo'+'bar'");
-
- var table = new DataTable();
-
- table.Columns.Add(a);
- table.Columns.Add(b);
- table.Columns.Add(c);
-
- var row = table.NewRow();
- table.Rows.Add(row);
- Assert.Equal (row [0], DBNull.Value);
- Assert.Equal (row [1], DBNull.Value);
- Assert.Equal (row [2], "foobar");
- }
+ [Fact]
+ public void NullStrings ()
+ {
+ var a = MakeColumn ("nullbar", "null+'bar'");
+ var b = MakeColumn ("barnull", "'bar'+null");
+ var c = MakeColumn ("foobar", "'foo'+'bar'");
+
+ var table = new DataTable();
+
+ table.Columns.Add(a);
+ table.Columns.Add(b);
+ table.Columns.Add(c);
+
+ var row = table.NewRow();
+ table.Rows.Add(row);
+ Assert.Equal (row [0], DBNull.Value);
+ Assert.Equal (row [1], DBNull.Value);
+ Assert.Equal (row [2], "foobar");
+ }
#endif
}
}
string sColName, sExp;
dc = new DataColumn();
- //ToString = ColumnName
+ //ToString = ColumnName
sColName = "Test1";
dc.ColumnName = sColName;
// ToString - ColumnName
catch (ArgumentException e)
{
// MSDN says this exception is InvalidCastException
- // Assert.Equal (typeof (ArgumentException), e.GetType ());
+ // Assert.Equal (typeof (ArgumentException), e.GetType ());
}
object[] obs1 = new object[5];
{
DataSet ds = DataProvider.CreateForeignConstraint();
- ds.Tables[0].Rows.Clear(); //Try to clear the parent table
+ ds.Tables[0].Rows.Clear(); //Try to clear the parent table
});
}
// Item - columnn,Current
Assert.Equal(1, (int)myRow[dc, DataRowVersion.Current]);
- // testMore();
+ // testMore();
}
/*public void testMore()
- {
- DataTable dt = DataProvider.CreateParentDataTable();
- dt.Rows[0].BeginEdit();
- dt.Rows[0][0] = 10;
- dt.Rows[0].EndEdit();
- dt.AcceptChanges();
- }*/
+ {
+ DataTable dt = DataProvider.CreateParentDataTable();
+ dt.Rows[0].BeginEdit();
+ dt.Rows[0][0] = 10;
+ dt.Rows[0].EndEdit();
+ dt.AcceptChanges();
+ }*/
[Fact]
public void RejectChanges()
<child_after_significant_space />
</root>";
// This is useless ... since xml:space becomes a DataColumn here.
- // string xml12 = "<root xml:space='preserve'> </root>";
+ // string xml12 = "<root xml:space='preserve'> </root>";
// The result is silly under MS.NET. It never ignores comment, so
// They differ:
// 1) <root>simple string.</root>
// 2) <root>simple <!-- comment -->string.</root>
// The same applies to PI.
- // string xml13 = "<root><tab><col>test <!-- out --> comment</col></tab></root>";
+ // string xml13 = "<root><tab><col>test <!-- out --> comment</col></tab></root>";
// simple namespace/prefix support
private string _xml14 = "<p:root xmlns:p='urn:foo'>test string</p:root>";
// (regardless of its schema type), the elements will
// never be treated as a DataSet.
string xsbase = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' id='hoge'>
- <xs:element name='Root'> <!-- When simple, it becomes table. When complex, it becomes DataSet -->
- <xs:complexType>
- <xs:choice>
- {0}
- </xs:choice>
- </xs:complexType>
- </xs:element>
+ <xs:element name='Root'> <!-- When simple, it becomes table. When complex, it becomes DataSet -->
+ <xs:complexType>
+ <xs:choice>
+ {0}
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
</xs:schema>";
string xsbase2 = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' id='hoge'>
- <xs:element name='Root'> <!-- When simple, it becomes table. When complex, it becomes DataSet -->
- <xs:complexType>
- <xs:choice>
- {0}
- </xs:choice>
- </xs:complexType>
- </xs:element>
- <xs:element name='more' type='xs:string' />
+ <xs:element name='Root'> <!-- When simple, it becomes table. When complex, it becomes DataSet -->
+ <xs:complexType>
+ <xs:choice>
+ {0}
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name='more' type='xs:string' />
</xs:schema>";
string simple = "<xs:element name='Child' type='xs:string' />";
string complex = @"<xs:element name='Child'>
- <xs:complexType>
- <xs:attribute name='a1' />
- <xs:attribute name='a2' type='xs:integer' />
- </xs:complexType>
+ <xs:complexType>
+ <xs:attribute name='a1' />
+ <xs:attribute name='a2' type='xs:integer' />
+ </xs:complexType>
</xs:element>";
string elref = "<xs:element ref='more' />";
string xs2 = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' id='hoge'>
- <xs:element name='Root' type='RootType' />
- <xs:complexType name='RootType'>
- <xs:choice>
- <xs:element name='Child'>
- <xs:complexType>
- <xs:attribute name='a1' />
- <xs:attribute name='a2' type='xs:integer' />
- </xs:complexType>
- </xs:element>
- </xs:choice>
- </xs:complexType>
+ <xs:element name='Root' type='RootType' />
+ <xs:complexType name='RootType'>
+ <xs:choice>
+ <xs:element name='Child'>
+ <xs:complexType>
+ <xs:attribute name='a1' />
+ <xs:attribute name='a2' type='xs:integer' />
+ </xs:complexType>
+ </xs:element>
+ </xs:choice>
+ </xs:complexType>
</xs:schema>";
var ds = new DataSet();
{
string schema = @"<?xml version='1.0'?>
<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
- <xsd:attribute name='foo' type='xsd:string'/>
- <xsd:attribute name='bar' type='xsd:string'/>
- <xsd:complexType name='attRef'>
- <xsd:attribute name='att1' type='xsd:int'/>
- <xsd:attribute name='att2' type='xsd:string'/>
- </xsd:complexType>
- <xsd:element name='doc'>
- <xsd:complexType>
- <xsd:choice>
- <xsd:element name='elem' type='attRef'/>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
+ <xsd:attribute name='foo' type='xsd:string'/>
+ <xsd:attribute name='bar' type='xsd:string'/>
+ <xsd:complexType name='attRef'>
+ <xsd:attribute name='att1' type='xsd:int'/>
+ <xsd:attribute name='att2' type='xsd:string'/>
+ </xsd:complexType>
+ <xsd:element name='doc'>
+ <xsd:complexType>
+ <xsd:choice>
+ <xsd:element name='elem' type='attRef'/>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
</xsd:schema>";
var ds = new DataSet();
ds.ReadXmlSchema(new StringReader(schema));
public void UnusedComplexTypesIgnored()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' id='hoge'>
- <xs:element name='Root'>
- <xs:complexType>
- <xs:sequence>
- <xs:element name='Child' type='xs:string' />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:complexType name='unusedType'>
- <xs:sequence>
- <xs:element name='Orphan' type='xs:string' />
- </xs:sequence>
- </xs:complexType>
+ <xs:element name='Root'>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name='Child' type='xs:string' />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name='unusedType'>
+ <xs:sequence>
+ <xs:element name='Orphan' type='xs:string' />
+ </xs:sequence>
+ </xs:complexType>
</xs:schema>";
var ds = new DataSet();
public void SimpleTypeComponentsIgnored()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
- <xs:element name='Root' type='xs:string'/>
- <xs:attribute name='Attr' type='xs:string'/>
+ <xs:element name='Root' type='xs:string'/>
+ <xs:attribute name='Attr' type='xs:string'/>
</xs:schema>";
var ds = new DataSet();
public void IsDataSetAndTypeIgnored()
{
string xsbase = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
- <xs:element name='Root' type='unusedType' msdata:IsDataSet='{0}'>
- </xs:element>
- <xs:complexType name='unusedType'>
- <xs:sequence>
- <xs:element name='Child' type='xs:string' />
- </xs:sequence>
- </xs:complexType>
+ <xs:element name='Root' type='unusedType' msdata:IsDataSet='{0}'>
+ </xs:element>
+ <xs:complexType name='unusedType'>
+ <xs:sequence>
+ <xs:element name='Child' type='xs:string' />
+ </xs:sequence>
+ </xs:complexType>
</xs:schema>";
// Even if a global element uses a complexType, it will be
public void NestedReferenceNotAllowed()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
- <xs:element name='Root' type='unusedType' msdata:IsDataSet='true'>
- </xs:element>
- <xs:complexType name='unusedType'>
- <xs:sequence>
- <xs:element name='Child' type='xs:string' />
- </xs:sequence>
- </xs:complexType>
- <xs:element name='Foo'>
- <xs:complexType>
- <xs:sequence>
- <xs:element ref='Root' />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
+ <xs:element name='Root' type='unusedType' msdata:IsDataSet='true'>
+ </xs:element>
+ <xs:complexType name='unusedType'>
+ <xs:sequence>
+ <xs:element name='Child' type='xs:string' />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name='Foo'>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref='Root' />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
</xs:schema>";
// DataSet element cannot be converted into a DataTable.
public void IsDataSetOnLocalElementIgnored()
{
string xsbase = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
- <xs:element name='Root' type='unusedType'>
- </xs:element>
- <xs:complexType name='unusedType'>
- <xs:sequence>
- <xs:element name='Child' type='xs:string' msdata:IsDataSet='True' />
- </xs:sequence>
- </xs:complexType>
+ <xs:element name='Root' type='unusedType'>
+ </xs:element>
+ <xs:complexType name='unusedType'>
+ <xs:sequence>
+ <xs:element name='Child' type='xs:string' msdata:IsDataSet='True' />
+ </xs:sequence>
+ </xs:complexType>
</xs:schema>";
// msdata:IsDataSet does not affect even if the value is invalid
{
CultureInfo.CurrentCulture = new CultureInfo("fi-FI");
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
- <xs:element name='Root' msdata:Locale='ja-JP'>
- <xs:complexType>
- <xs:sequence>
- <xs:element name='Child' type='xs:string' />
- </xs:sequence>
- <xs:attribute name='Attr' type='xs:integer' />
- </xs:complexType>
- </xs:element>
+ <xs:element name='Root' msdata:Locale='ja-JP'>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name='Child' type='xs:string' />
+ </xs:sequence>
+ <xs:attribute name='Attr' type='xs:integer' />
+ </xs:complexType>
+ </xs:element>
</xs:schema>";
var ds = new DataSet();
public void ElementHasIdentityConstraint()
{
string constraints = @"
- <xs:key name='key'>
- <xs:selector xpath='./any/string_is_OK/R1'/>
- <xs:field xpath='Child2'/>
- </xs:key>
- <xs:keyref name='kref' refer='key'>
- <xs:selector xpath='.//R2'/>
- <xs:field xpath='Child2'/>
- </xs:keyref>";
+ <xs:key name='key'>
+ <xs:selector xpath='./any/string_is_OK/R1'/>
+ <xs:field xpath='Child2'/>
+ </xs:key>
+ <xs:keyref name='kref' refer='key'>
+ <xs:selector xpath='.//R2'/>
+ <xs:field xpath='Child2'/>
+ </xs:keyref>";
string xsbase = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
- <xs:element name='DS' msdata:IsDataSet='true'>
- <xs:complexType>
- <xs:choice>
- <xs:element ref='R1' />
- <xs:element ref='R2' />
- </xs:choice>
- </xs:complexType>
- {0}
- </xs:element>
- <xs:element name='R1' type='RootType'>
- {1}
- </xs:element>
- <xs:element name='R2' type='RootType'>
- </xs:element>
- <xs:complexType name='RootType'>
- <xs:choice>
- <xs:element name='Child1' type='xs:string'>
- {2}
- </xs:element>
- <xs:element name='Child2' type='xs:string' />
- </xs:choice>
- <xs:attribute name='Attr' type='xs:integer' />
- </xs:complexType>
+ <xs:element name='DS' msdata:IsDataSet='true'>
+ <xs:complexType>
+ <xs:choice>
+ <xs:element ref='R1' />
+ <xs:element ref='R2' />
+ </xs:choice>
+ </xs:complexType>
+ {0}
+ </xs:element>
+ <xs:element name='R1' type='RootType'>
+ {1}
+ </xs:element>
+ <xs:element name='R2' type='RootType'>
+ </xs:element>
+ <xs:complexType name='RootType'>
+ <xs:choice>
+ <xs:element name='Child1' type='xs:string'>
+ {2}
+ </xs:element>
+ <xs:element name='Child2' type='xs:string' />
+ </xs:choice>
+ <xs:attribute name='Attr' type='xs:integer' />
+ </xs:complexType>
</xs:schema>";
// Constraints on DataSet element.
public void PrefixedTargetNS()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:x='urn:foo' targetNamespace='urn:foo' elementFormDefault='qualified'>
- <xs:element name='DS' msdata:IsDataSet='true'>
- <xs:complexType>
- <xs:choice>
- <xs:element ref='x:R1' />
- <xs:element ref='x:R2' />
- </xs:choice>
- </xs:complexType>
- <xs:key name='key'>
- <xs:selector xpath='./any/string_is_OK/x:R1'/>
- <xs:field xpath='x:Child2'/>
- </xs:key>
- <xs:keyref name='kref' refer='x:key'>
- <xs:selector xpath='.//x:R2'/>
- <xs:field xpath='x:Child2'/>
- </xs:keyref>
- </xs:element>
- <xs:element name='R3' type='x:RootType' />
- <xs:complexType name='extracted'>
- <xs:choice>
- <xs:element ref='x:R1' />
- <xs:element ref='x:R2' />
- </xs:choice>
- </xs:complexType>
- <xs:element name='R1' type='x:RootType'>
- <xs:unique name='Rkey'>
- <xs:selector xpath='.//x:Child1'/>
- <xs:field xpath='.'/>
- </xs:unique>
- <xs:keyref name='Rkref' refer='x:Rkey'>
- <xs:selector xpath='.//x:Child2'/>
- <xs:field xpath='.'/>
- </xs:keyref>
- </xs:element>
- <xs:element name='R2' type='x:RootType'>
- </xs:element>
- <xs:complexType name='RootType'>
- <xs:choice>
- <xs:element name='Child1' type='xs:string'>
- </xs:element>
- <xs:element name='Child2' type='xs:string' />
- </xs:choice>
- <xs:attribute name='Attr' type='xs:integer' />
- </xs:complexType>
+ <xs:element name='DS' msdata:IsDataSet='true'>
+ <xs:complexType>
+ <xs:choice>
+ <xs:element ref='x:R1' />
+ <xs:element ref='x:R2' />
+ </xs:choice>
+ </xs:complexType>
+ <xs:key name='key'>
+ <xs:selector xpath='./any/string_is_OK/x:R1'/>
+ <xs:field xpath='x:Child2'/>
+ </xs:key>
+ <xs:keyref name='kref' refer='x:key'>
+ <xs:selector xpath='.//x:R2'/>
+ <xs:field xpath='x:Child2'/>
+ </xs:keyref>
+ </xs:element>
+ <xs:element name='R3' type='x:RootType' />
+ <xs:complexType name='extracted'>
+ <xs:choice>
+ <xs:element ref='x:R1' />
+ <xs:element ref='x:R2' />
+ </xs:choice>
+ </xs:complexType>
+ <xs:element name='R1' type='x:RootType'>
+ <xs:unique name='Rkey'>
+ <xs:selector xpath='.//x:Child1'/>
+ <xs:field xpath='.'/>
+ </xs:unique>
+ <xs:keyref name='Rkref' refer='x:Rkey'>
+ <xs:selector xpath='.//x:Child2'/>
+ <xs:field xpath='.'/>
+ </xs:keyref>
+ </xs:element>
+ <xs:element name='R2' type='x:RootType'>
+ </xs:element>
+ <xs:complexType name='RootType'>
+ <xs:choice>
+ <xs:element name='Child1' type='xs:string'>
+ </xs:element>
+ <xs:element name='Child2' type='xs:string' />
+ </xs:choice>
+ <xs:attribute name='Attr' type='xs:integer' />
+ </xs:complexType>
</xs:schema>";
// No prefixes on tables and columns
var ds = new DataSet();
ds.ReadXmlSchema(new StringReader(
@"<!-- Modified w3ctests attQ014.xsd -->
<xsd:schema xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" targetNamespace=""http://xsdtesting"" xmlns:x=""http://xsdtesting"">
- <xsd:element name=""root"">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name=""e"">
- <xsd:complexType>
- <xsd:simpleContent>
- <xsd:extension base=""xsd:decimal"">
- <xsd:attribute name=""a"" type=""xsd:string""/>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
+ <xsd:element name=""root"">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name=""e"">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base=""xsd:decimal"">
+ <xsd:attribute name=""a"" type=""xsd:string""/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
</xsd:schema>"));
DataSetAssertion.AssertDataSet("013", ds, "root", 1, 0);
ds.ReadXmlSchema(new StringReader(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<xs:schema targetNamespace=""http://neurosaudio.com/Tracks.xsd"" xmlns=""http://neurosaudio.com/Tracks.xsd"" xmlns:mstns=""http://neurosaudio.com/Tracks.xsd"" xmlns:xs=""http://www.w3.org/2001/XMLSchema"" xmlns:msdata=""urn:schemas-microsoft-com:xml-msdata"" elementFormDefault=""qualified"" id=""Tracks"">
- <xs:element name=""Tracks"">
- <xs:complexType>
- <xs:sequence>
- <xs:element name=""Track"" minOccurs=""0"" maxOccurs=""unbounded"">
- <xs:complexType>
- <xs:sequence>
- <xs:element name=""Title"" type=""xs:string"" />
- <xs:element name=""Artist"" type=""xs:string"" minOccurs=""0"" />
- <xs:element name=""Album"" type=""xs:string"" minOccurs=""0"" />
- <xs:element name=""Performer"" type=""xs:string"" minOccurs=""0"" />
- <xs:element name=""Sequence"" type=""xs:unsignedInt"" minOccurs=""0"" />
- <xs:element name=""Genre"" type=""xs:string"" minOccurs=""0"" />
- <xs:element name=""Comment"" type=""xs:string"" minOccurs=""0"" />
- <xs:element name=""Year"" type=""xs:string"" minOccurs=""0"" />
- <xs:element name=""Duration"" type=""xs:unsignedInt"" minOccurs=""0"" />
- <xs:element name=""Path"" type=""xs:string"" />
- <xs:element name=""DevicePath"" type=""xs:string"" minOccurs=""0"" />
- <xs:element name=""FileSize"" type=""xs:unsignedInt"" minOccurs=""0"" />
- <xs:element name=""Source"" type=""xs:string"" minOccurs=""0"" />
- <xs:element name=""FlashStatus"" type=""xs:unsignedInt"" />
- <xs:element name=""HDStatus"" type=""xs:unsignedInt"" />
- </xs:sequence>
- <xs:attribute name=""ID"" type=""xs:unsignedInt"" msdata:AutoIncrement=""true"" msdata:AutoIncrementSeed=""1"" />
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- <xs:key name=""TrackPK"" msdata:PrimaryKey=""true"">
- <xs:selector xpath="".//mstns:Track"" />
- <xs:field xpath=""@ID"" />
- </xs:key>
- </xs:element>
+ <xs:element name=""Tracks"">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name=""Track"" minOccurs=""0"" maxOccurs=""unbounded"">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name=""Title"" type=""xs:string"" />
+ <xs:element name=""Artist"" type=""xs:string"" minOccurs=""0"" />
+ <xs:element name=""Album"" type=""xs:string"" minOccurs=""0"" />
+ <xs:element name=""Performer"" type=""xs:string"" minOccurs=""0"" />
+ <xs:element name=""Sequence"" type=""xs:unsignedInt"" minOccurs=""0"" />
+ <xs:element name=""Genre"" type=""xs:string"" minOccurs=""0"" />
+ <xs:element name=""Comment"" type=""xs:string"" minOccurs=""0"" />
+ <xs:element name=""Year"" type=""xs:string"" minOccurs=""0"" />
+ <xs:element name=""Duration"" type=""xs:unsignedInt"" minOccurs=""0"" />
+ <xs:element name=""Path"" type=""xs:string"" />
+ <xs:element name=""DevicePath"" type=""xs:string"" minOccurs=""0"" />
+ <xs:element name=""FileSize"" type=""xs:unsignedInt"" minOccurs=""0"" />
+ <xs:element name=""Source"" type=""xs:string"" minOccurs=""0"" />
+ <xs:element name=""FlashStatus"" type=""xs:unsignedInt"" />
+ <xs:element name=""HDStatus"" type=""xs:unsignedInt"" />
+ </xs:sequence>
+ <xs:attribute name=""ID"" type=""xs:unsignedInt"" msdata:AutoIncrement=""true"" msdata:AutoIncrementSeed=""1"" />
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:key name=""TrackPK"" msdata:PrimaryKey=""true"">
+ <xs:selector xpath="".//mstns:Track"" />
+ <xs:field xpath=""@ID"" />
+ </xs:key>
+ </xs:element>
</xs:schema>"));
}
<xs:element name='Foo' type='FooType' />
<!-- defining externally to avoid being regarded as dataset element -->
<xs:complexType name='FooType'>
- <xs:sequence>
- <xs:element name='Bar' maxOccurs='2' />
- </xs:sequence>
+ <xs:sequence>
+ <xs:element name='Bar' maxOccurs='2' />
+ </xs:sequence>
</xs:complexType>
</xs:schema>"));
DataSetAssertion.AssertDataSet("012", ds, "NewDataSet", 2, 1);
var ds = new DataSet();
ds.ReadXmlSchema(new StringReader(
@"<xsd:schema xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
- <xsd:element name=""root"">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name=""x"" maxOccurs=""2"" />
- <xsd:element ref=""y"" maxOccurs=""unbounded"" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name=""y"" />
+ <xsd:element name=""root"">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name=""x"" maxOccurs=""2"" />
+ <xsd:element ref=""y"" maxOccurs=""unbounded"" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name=""y"" />
</xsd:schema>"));
DataSetAssertion.AssertDataSet("014", ds, "NewDataSet", 3, 2);
private const string diff2 = diff1 + xml8;
private const string schema1 = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
- <xs:element name='Root'>
- <xs:complexType>
- <xs:sequence>
- <xs:element name='Child' type='xs:string' />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
+ <xs:element name='Root'>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name='Child' type='xs:string' />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
</xs:schema>";
private const string schema2 = schema1 + xml8;
public void NameConflictDSAndTable()
{
string xml = @"<PriceListDetails>
- <PriceListList>
- <Id>1</Id>
- </PriceListList>
- <PriceListDetails>
- <Id>1</Id>
- <Status>0</Status>
- </PriceListDetails>
+ <PriceListList>
+ <Id>1</Id>
+ </PriceListList>
+ <PriceListDetails>
+ <Id>1</Id>
+ <Status>0</Status>
+ </PriceListDetails>
</PriceListDetails>";
var ds = new DataSet();
ds.WriteXmlSchema(writer);
string TextString = DataSetAssertion.GetNormalizedSchema(writer.ToString());
- // string TextString = writer.ToString ();
+ // string TextString = writer.ToString ();
string substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' }));
TextString = TextString.Substring(TextString.IndexOf('\n') + 1);
substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' }));
TextString = TextString.Substring(TextString.IndexOf('\n') + 1);
// This is original DataSet.WriteXmlSchema() output
- // Assert.Equal ("<xs:schema id=\"test_dataset\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">", substring);
+ // Assert.Equal ("<xs:schema id=\"test_dataset\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">", substring);
Assert.Equal("<xs:schema id=\"test_dataset\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">", substring);
substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' }));
TextString = TextString.Substring(TextString.IndexOf('\n') + 1);
// This is original DataSet.WriteXmlSchema() output
- // Assert.Equal (" <xs:element name=\"test_dataset\" msdata:IsDataSet=\"true\" msdata:Locale=\"fi-FI\">", substring);
+ // Assert.Equal (" <xs:element name=\"test_dataset\" msdata:IsDataSet=\"true\" msdata:Locale=\"fi-FI\">", substring);
Assert.Equal(" <xs:element msdata:IsDataSet=\"true\" msdata:UseCurrentLocale=\"true\" name=\"test_dataset\">", substring);
substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' }));
substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' }));
TextString = TextString.Substring(TextString.IndexOf('\n') + 1);
// This is original DataSet.WriteXmlSchema() output
- // Assert.Equal (" <xs:element name=\"first\" msdata:Caption=\"test\" default=\"test_default_value\" minOccurs=\"0\">", substring);
+ // Assert.Equal (" <xs:element name=\"first\" msdata:Caption=\"test\" default=\"test_default_value\" minOccurs=\"0\">", substring);
Assert.Equal(" <xs:element default=\"test_default_value\" minOccurs=\"0\" msdata:Caption=\"test\" name=\"first\">", substring);
substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' }));
substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' }));
TextString = TextString.Substring(TextString.IndexOf('\n') + 1);
// This is original DataSet.WriteXmlSchema() output
- // Assert.Equal (" <xs:element name=\"second_first\" default=\"default_value\" minOccurs=\"0\">", substring);
+ // Assert.Equal (" <xs:element name=\"second_first\" default=\"default_value\" minOccurs=\"0\">", substring);
Assert.Equal(" <xs:element default=\"default_value\" minOccurs=\"0\" name=\"second_first\">", substring);
substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' }));
substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' }));
TextString = TextString.Substring(TextString.IndexOf('\n') + 1);
// This is original DataSet.WriteXmlSchema() output
- // Assert.Equal (" <xs:unique name=\"second_test_table_Constraint1\" msdata:ConstraintName=\"Constraint1\">", substring);
+ // Assert.Equal (" <xs:unique name=\"second_test_table_Constraint1\" msdata:ConstraintName=\"Constraint1\">", substring);
Assert.Equal(" <xs:unique msdata:ConstraintName=\"Constraint1\" name=\"second_test_table_Constraint1\">", substring);
substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' }));
}
/* To be added
- [Fact]
- public void WriteDiffReadAutoWriteSchema ()
- {
- DataSet ds = new DataSet ();
- ds.Tables.Add ("Table1");
- ds.Tables.Add ("Table2");
- ds.Tables [0].Columns.Add ("Column1_1");
- ds.Tables [0].Columns.Add ("Column1_2");
- ds.Tables [0].Columns.Add ("Column1_3");
- ds.Tables [1].Columns.Add ("Column2_1");
- ds.Tables [1].Columns.Add ("Column2_2");
- ds.Tables [1].Columns.Add ("Column2_3");
- ds.Tables [0].Rows.Add (new object [] {"ppp", "www", "xxx"});
-
- // save as diffgram
- StringWriter sw = new StringWriter ();
- ds.WriteXml (sw, XmlWriteMode.DiffGram);
- string xml = sw.ToString ();
- string result = new StreamReader ("Test/System.Data/DataSetReadXmlTest1.xml", Encoding.ASCII).ReadToEnd ();
- Assert.Equal (result, xml);
-
- // load diffgram above
- ds.ReadXml (new StringReader (sw.ToString ()));
- sw = new StringWriter ();
- ds.WriteXml (sw, XmlWriteMode.WriteSchema);
- xml = sw.ToString ();
- result = new StreamReader ("Test/System.Data/DataSetReadXmlTest2.xml", Encoding.ASCII).ReadToEnd ();
- Assert.Equal (result, xml);
- }
- */
+ [Fact]
+ public void WriteDiffReadAutoWriteSchema ()
+ {
+ DataSet ds = new DataSet ();
+ ds.Tables.Add ("Table1");
+ ds.Tables.Add ("Table2");
+ ds.Tables [0].Columns.Add ("Column1_1");
+ ds.Tables [0].Columns.Add ("Column1_2");
+ ds.Tables [0].Columns.Add ("Column1_3");
+ ds.Tables [1].Columns.Add ("Column2_1");
+ ds.Tables [1].Columns.Add ("Column2_2");
+ ds.Tables [1].Columns.Add ("Column2_3");
+ ds.Tables [0].Rows.Add (new object [] {"ppp", "www", "xxx"});
+
+ // save as diffgram
+ StringWriter sw = new StringWriter ();
+ ds.WriteXml (sw, XmlWriteMode.DiffGram);
+ string xml = sw.ToString ();
+ string result = new StreamReader ("Test/System.Data/DataSetReadXmlTest1.xml", Encoding.ASCII).ReadToEnd ();
+ Assert.Equal (result, xml);
+
+ // load diffgram above
+ ds.ReadXml (new StringReader (sw.ToString ()));
+ sw = new StringWriter ();
+ ds.WriteXml (sw, XmlWriteMode.WriteSchema);
+ xml = sw.ToString ();
+ result = new StreamReader ("Test/System.Data/DataSetReadXmlTest2.xml", Encoding.ASCII).ReadToEnd ();
+ Assert.Equal (result, xml);
+ }
+ */
[Fact]
public void CloneCopy()
{
// Never premise English.
//Assert.Equal ("Failed to enable constraints. One or more rows contain values " +
- // "violating non-null, unique, or foreign-key constraints.", e.Message, "#2");
+ // "violating non-null, unique, or foreign-key constraints.", e.Message, "#2");
}
}
{
// Never premise English.
//Assert.Equal ("Failed to enable constraints. One or more rows contain values " +
- // "violating non-null, unique, or foreign-key constraints.", e.Message, "#2");
+ // "violating non-null, unique, or foreign-key constraints.", e.Message, "#2");
}
}
//make some changes
// can't check detached
- // dr = ds.Tables[0].Rows[0];
- // arrDetached = dr.ItemArray;
- // dr.Delete();
- // ds.Tables[0].AcceptChanges();
+ // dr = ds.Tables[0].Rows[0];
+ // arrDetached = dr.ItemArray;
+ // dr.Delete();
+ // ds.Tables[0].AcceptChanges();
dr = ds.Tables[0].Rows[1];
arrDeleted = dr.ItemArray;
object[] tmp = new object[] { dr[0, DataRowVersion.Original], dr[1, DataRowVersion.Original], dr[2, DataRowVersion.Original], dr[3, DataRowVersion.Original], dr[4, DataRowVersion.Original], dr[5, DataRowVersion.Original] };
Assert.Equal(arrDeleted, tmp);
- // can't check it
- // // GetChanges Detached
- // dr = ds.GetChanges(DataRowState.Detached).Tables[0].Rows[0];
- // object[] tmp = new object[] {dr[0,DataRowVersion.Original],dr[1,DataRowVersion.Original],dr[2,DataRowVersion.Original]};
- // Assert.Equal(arrDetached, tmp);
+ // can't check it
+ // // GetChanges Detached
+ // dr = ds.GetChanges(DataRowState.Detached).Tables[0].Rows[0];
+ // object[] tmp = new object[] {dr[0,DataRowVersion.Original],dr[1,DataRowVersion.Original],dr[2,DataRowVersion.Original]};
+ // Assert.Equal(arrDetached, tmp);
// GetChanges Modified
Assert.Equal(arrModified, ds.GetChanges(DataRowState.Modified).Tables[0].Rows[0].ItemArray);
MemoryStream myStream = new MemoryStream(new ASCIIEncoding().GetBytes(sb.ToString()));
var ds = new DataSet();
- // ds.ReadXml(myStream);
+ // ds.ReadXml(myStream);
ds.InferXmlSchema(myStream, new string[] { "urn:schemas-microsoft-com:officedata" });
Assert.Equal(2, ds.Tables.Count);
Assert.Equal("CategoryID", ds.Tables[0].Columns[0].ColumnName);
MemoryStream myStream = new MemoryStream(new ASCIIEncoding().GetBytes(sb.ToString()));
var ds = new DataSet();
- // ds.ReadXml(myStream);
+ // ds.ReadXml(myStream);
ds.InferXmlSchema(myStream, new string[] { "urn:schemas-microsoft-com:officedata" });
Assert.Equal(3, ds.Tables.Count);
ds.InferXmlSchema(myStream, new string[] { "http://www.xml.com/books", "http://www.w3.org/HTML/1998/html4" });
//Assert.Equal(8, ds.Tables.Count);
- // string str1 = tempDs.GetXmlSchema(); //DataProvider.GetDSSchema(tempDs);
- // string str2 = ds.GetXmlSchema(); //DataProvider.GetDSSchema(ds);
+ // string str1 = tempDs.GetXmlSchema(); //DataProvider.GetDSSchema(tempDs);
+ // string str2 = ds.GetXmlSchema(); //DataProvider.GetDSSchema(ds);
Assert.Equal(3, ds.Tables.Count);
Assert.Equal("bookreview", ds.Tables[2].TableName);
Assert.Equal(2, ds.Tables[2].Columns.Count);
Assert.True(dsTarget1.Tables.Contains("NewTable"));
//failed, should be success by MSDN Library documentation
- // // Merge MissingSchemaAction.Add - PrimaryKey
- // Assert.Equal(0, dsTarget1.Tables["NewTable"].PrimaryKey.Length);
+ // // Merge MissingSchemaAction.Add - PrimaryKey
+ // Assert.Equal(0, dsTarget1.Tables["NewTable"].PrimaryKey.Length);
#endregion
#region "ds,false,MissingSchemaAction.AddWithKey)"
//MissingSchemaAction.Add,MissingSchemaAction.AddWithKey - behave the same, checked only Add
- // DataSet dsTarget2 = dsTarget.Copy();
- // dsTarget2.Merge(ds,false,MissingSchemaAction.AddWithKey);
- // // Merge MissingSchemaAction.AddWithKey - Column
- // Assert.True(dsTarget2.Tables["Table1"].Columns.Contains("NewColumn"));
+ // DataSet dsTarget2 = dsTarget.Copy();
+ // dsTarget2.Merge(ds,false,MissingSchemaAction.AddWithKey);
+ // // Merge MissingSchemaAction.AddWithKey - Column
+ // Assert.True(dsTarget2.Tables["Table1"].Columns.Contains("NewColumn"));
//
- // // Merge MissingSchemaAction.AddWithKey - Table
- // Assert.True(dsTarget2.Tables.Contains("NewTable"));
+ // // Merge MissingSchemaAction.AddWithKey - Table
+ // Assert.True(dsTarget2.Tables.Contains("NewTable"));
//
- // // Merge MissingSchemaAction.AddWithKey - PrimaryKey
- // Assert.Equal(dsTarget2.Tables["NewTable"].Columns["NewColumn1"], dsTarget2.Tables["NewTable"].PrimaryKey[0]);
+ // // Merge MissingSchemaAction.AddWithKey - PrimaryKey
+ // Assert.Equal(dsTarget2.Tables["NewTable"].Columns["NewColumn1"], dsTarget2.Tables["NewTable"].PrimaryKey[0]);
#endregion
#region "ds,false,MissingSchemaAction.Ignore )"
input += "<?xml version=\"1.0\"?>";
input += "<Stock name=\"MSFT\">";
- input += " <Company name=\"Microsoft Corp.\"/>";
- input += " <Price type=\"high\">";
- input += " <Value>10.0</Value>";
- input += " <Date>01/20/2000</Date>";
- input += " </Price>";
- input += " <Price type=\"low\">";
- input += " <Value>1.0</Value>";
- input += " <Date>03/21/2002</Date>";
- input += " </Price>";
- input += " <Price type=\"current\">";
- input += " <Value>3.0</Value>";
- input += " <Date>TODAY</Date>";
- input += " </Price>";
+ input += " <Company name=\"Microsoft Corp.\"/>";
+ input += " <Price type=\"high\">";
+ input += " <Value>10.0</Value>";
+ input += " <Date>01/20/2000</Date>";
+ input += " </Price>";
+ input += " <Price type=\"low\">";
+ input += " <Value>1.0</Value>";
+ input += " <Date>03/21/2002</Date>";
+ input += " </Price>";
+ input += " <Price type=\"current\">";
+ input += " <Value>3.0</Value>";
+ input += " <Date>TODAY</Date>";
+ input += " </Price>";
input += "</Stock>";
sr = new StringReader(input);
input += "<?xml version=\"1.0\"?>";
input += "<Stocks>";
- input += " <Stock name=\"MSFT\">";
- input += " <Company name=\"Microsoft Corp.\" />";
- input += " <Company name=\"General Electric\"/>";
- input += " <Price type=\"high\">";
- input += " <Value>10.0</Value>";
- input += " <Date>01/20/2000</Date>";
- input += " </Price>";
- input += " <Price type=\"low\">";
- input += " <Value>1.0</Value>";
- input += " <Date>03/21/2002</Date>";
- input += " </Price>";
- input += " <Price type=\"current\">";
- input += " <Value>3.0</Value>";
- input += " <Date>TODAY</Date>";
- input += " </Price>";
- input += " </Stock>";
- input += " <Stock name=\"GE\">";
- input += " <Company name=\"GE company\"/>";
- input += " <Price type=\"high\">";
- input += " <Value>22.23</Value>";
- input += " <Date>02/12/2001</Date>";
- input += " </Price>";
- input += " <Price type=\"low\">";
- input += " <Value>1.97</Value>";
- input += " <Date>04/20/2003</Date>";
- input += " </Price>";
- input += " <Price type=\"current\">";
- input += " <Value>3.0</Value>";
- input += " <Date>TODAY</Date>";
- input += " </Price>";
- input += " </Stock>";
- input += " <Stock name=\"Intel\">";
- input += " <Company name=\"Intel Corp.\"/>";
- input += " <Company name=\"Test1\" />";
- input += " <Company name=\"Test2\"/>";
- input += " <Price type=\"high\">";
- input += " <Value>15.0</Value>";
- input += " <Date>01/25/2000</Date>";
- input += " </Price>";
- input += " <Price type=\"low\">";
- input += " <Value>1.0</Value>";
- input += " <Date>03/23/2002</Date>";
- input += " </Price>";
- input += " <Price type=\"current\">";
- input += " <Value>3.0</Value>";
- input += " <Date>TODAY</Date>";
- input += " </Price>";
- input += " </Stock>";
- input += " <Stock name=\"Mainsoft\">";
- input += " <Company name=\"Mainsoft Corp.\"/>";
- input += " <Price type=\"high\">";
- input += " <Value>30.0</Value>";
- input += " <Date>01/26/2000</Date>";
- input += " </Price>";
- input += " <Price type=\"low\">";
- input += " <Value>1.0</Value>";
- input += " <Date>03/26/2002</Date>";
- input += " </Price>";
- input += " <Price type=\"current\">";
- input += " <Value>27.0</Value>";
- input += " <Date>TODAY</Date>";
- input += " </Price>";
- input += " </Stock>";
+ input += " <Stock name=\"MSFT\">";
+ input += " <Company name=\"Microsoft Corp.\" />";
+ input += " <Company name=\"General Electric\"/>";
+ input += " <Price type=\"high\">";
+ input += " <Value>10.0</Value>";
+ input += " <Date>01/20/2000</Date>";
+ input += " </Price>";
+ input += " <Price type=\"low\">";
+ input += " <Value>1.0</Value>";
+ input += " <Date>03/21/2002</Date>";
+ input += " </Price>";
+ input += " <Price type=\"current\">";
+ input += " <Value>3.0</Value>";
+ input += " <Date>TODAY</Date>";
+ input += " </Price>";
+ input += " </Stock>";
+ input += " <Stock name=\"GE\">";
+ input += " <Company name=\"GE company\"/>";
+ input += " <Price type=\"high\">";
+ input += " <Value>22.23</Value>";
+ input += " <Date>02/12/2001</Date>";
+ input += " </Price>";
+ input += " <Price type=\"low\">";
+ input += " <Value>1.97</Value>";
+ input += " <Date>04/20/2003</Date>";
+ input += " </Price>";
+ input += " <Price type=\"current\">";
+ input += " <Value>3.0</Value>";
+ input += " <Date>TODAY</Date>";
+ input += " </Price>";
+ input += " </Stock>";
+ input += " <Stock name=\"Intel\">";
+ input += " <Company name=\"Intel Corp.\"/>";
+ input += " <Company name=\"Test1\" />";
+ input += " <Company name=\"Test2\"/>";
+ input += " <Price type=\"high\">";
+ input += " <Value>15.0</Value>";
+ input += " <Date>01/25/2000</Date>";
+ input += " </Price>";
+ input += " <Price type=\"low\">";
+ input += " <Value>1.0</Value>";
+ input += " <Date>03/23/2002</Date>";
+ input += " </Price>";
+ input += " <Price type=\"current\">";
+ input += " <Value>3.0</Value>";
+ input += " <Date>TODAY</Date>";
+ input += " </Price>";
+ input += " </Stock>";
+ input += " <Stock name=\"Mainsoft\">";
+ input += " <Company name=\"Mainsoft Corp.\"/>";
+ input += " <Price type=\"high\">";
+ input += " <Value>30.0</Value>";
+ input += " <Date>01/26/2000</Date>";
+ input += " </Price>";
+ input += " <Price type=\"low\">";
+ input += " <Value>1.0</Value>";
+ input += " <Date>03/26/2002</Date>";
+ input += " </Price>";
+ input += " <Price type=\"current\">";
+ input += " <Value>27.0</Value>";
+ input += " <Date>TODAY</Date>";
+ input += " </Price>";
+ input += " </Stock>";
input += "</Stocks>";
sr = new StringReader(input);
}
catch (InvalidOperationException e)
{
- //ok
+ //ok
}
}
///<?xml version="1.0" encoding="utf-16"?>
///<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- /// <xs:element name="NewDataSet" msdata:IsDataSet="true">
- /// <xs:complexType>
- /// <xs:choice maxOccurs="unbounded">
- /// <xs:element name="Parent">
- /// <xs:complexType>
- /// <xs:sequence>
- /// <xs:element name="ParentId" type="xs:int" minOccurs="0"/>
- /// <xs:element name="String1" type="xs:string" minOccurs="0"/>
- /// <xs:element name="String2" type="xs:string" minOccurs="0"/>
- /// <xs:element name="ParentDateTime" type="xs:dateTime" minOccurs="0"/>
- /// <xs:element name="ParentDouble" type="xs:double" minOccurs="0"/>
- /// <xs:element name="ParentBool" type="xs:boolean" minOccurs="0"/>
- /// </xs:sequence>
- /// </xs:complexType>
- /// </xs:element>
- /// </xs:choice>
- /// </xs:complexType>
- /// </xs:element>
+ /// <xs:element name="NewDataSet" msdata:IsDataSet="true">
+ /// <xs:complexType>
+ /// <xs:choice maxOccurs="unbounded">
+ /// <xs:element name="Parent">
+ /// <xs:complexType>
+ /// <xs:sequence>
+ /// <xs:element name="ParentId" type="xs:int" minOccurs="0"/>
+ /// <xs:element name="String1" type="xs:string" minOccurs="0"/>
+ /// <xs:element name="String2" type="xs:string" minOccurs="0"/>
+ /// <xs:element name="ParentDateTime" type="xs:dateTime" minOccurs="0"/>
+ /// <xs:element name="ParentDouble" type="xs:double" minOccurs="0"/>
+ /// <xs:element name="ParentBool" type="xs:boolean" minOccurs="0"/>
+ /// </xs:sequence>
+ /// </xs:complexType>
+ /// </xs:element>
+ /// </xs:choice>
+ /// </xs:complexType>
+ /// </xs:element>
///</xs:schema>
[Fact]
drOrders.ShipAddress = "Food Market";
drOrders.ShipCity = "Baker Blvd.";
drOrders.ShipRegion = "Eugene";
- drOrders.ShipPostalCode = "OR 97403";
+ drOrders.ShipPostalCode = "OR 97403";
drOrders.ShipCountry = "USA";
i = tblOrders.Rows.Count;
{
string schema = @"<?xml version='1.0'?>
<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
- <xsd:attribute name='foo' type='xsd:string'/>
- <xsd:attribute name='bar' type='xsd:string'/>
- <xsd:complexType name='attRef'>
- <xsd:attribute name='att1' type='xsd:int'/>
- <xsd:attribute name='att2' type='xsd:string'/>
- </xsd:complexType>
- <xsd:element name='doc'>
- <xsd:complexType>
- <xsd:choice>
- <xsd:element name='elem' type='attRef'/>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
+ <xsd:attribute name='foo' type='xsd:string'/>
+ <xsd:attribute name='bar' type='xsd:string'/>
+ <xsd:complexType name='attRef'>
+ <xsd:attribute name='att1' type='xsd:int'/>
+ <xsd:attribute name='att2' type='xsd:string'/>
+ </xsd:complexType>
+ <xsd:element name='doc'>
+ <xsd:complexType>
+ <xsd:choice>
+ <xsd:element name='elem' type='attRef'/>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
</xsd:schema>";
var ds = new DataSet();
ds.Tables.Add(new DataTable("elem"));
public void UnusedComplexTypesIgnored()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' id='hoge'>
- <xs:element name='Root'>
- <xs:complexType>
- <xs:sequence>
- <xs:element name='Child' type='xs:string' />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:complexType name='unusedType'>
- <xs:sequence>
- <xs:element name='Orphan' type='xs:string' />
- </xs:sequence>
- </xs:complexType>
+ <xs:element name='Root'>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name='Child' type='xs:string' />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name='unusedType'>
+ <xs:sequence>
+ <xs:element name='Orphan' type='xs:string' />
+ </xs:sequence>
+ </xs:complexType>
</xs:schema>";
AssertExtensions.Throws<ArgumentException>(null, () =>
public void IsDataSetAndTypeIgnored()
{
string xsbase = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
- <xs:element name='Root' type='unusedType' msdata:IsDataSet='{0}'>
- </xs:element>
- <xs:complexType name='unusedType'>
- <xs:sequence>
- <xs:element name='Child' type='xs:string' />
- </xs:sequence>
- </xs:complexType>
+ <xs:element name='Root' type='unusedType' msdata:IsDataSet='{0}'>
+ </xs:element>
+ <xs:complexType name='unusedType'>
+ <xs:sequence>
+ <xs:element name='Child' type='xs:string' />
+ </xs:sequence>
+ </xs:complexType>
</xs:schema>";
AssertExtensions.Throws<ArgumentException>(null, () =>
public void NestedReferenceNotAllowed()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
- <xs:element name='Root' type='unusedType' msdata:IsDataSet='true'>
- </xs:element>
- <xs:complexType name='unusedType'>
- <xs:sequence>
- <xs:element name='Child' type='xs:string' />
- </xs:sequence>
- </xs:complexType>
- <xs:element name='Foo'>
- <xs:complexType>
- <xs:sequence>
- <xs:element ref='Root' />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
+ <xs:element name='Root' type='unusedType' msdata:IsDataSet='true'>
+ </xs:element>
+ <xs:complexType name='unusedType'>
+ <xs:sequence>
+ <xs:element name='Child' type='xs:string' />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name='Foo'>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref='Root' />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
</xs:schema>";
AssertExtensions.Throws<ArgumentException>(null, () =>
public void LocaleOnRootWithoutIsDataSet()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
- <xs:element name='Root' msdata:Locale='ja-JP'>
- <xs:complexType>
- <xs:sequence>
- <xs:element name='Child' type='xs:string' />
- </xs:sequence>
- <xs:attribute name='Attr' type='xs:integer' />
- </xs:complexType>
- </xs:element>
+ <xs:element name='Root' msdata:Locale='ja-JP'>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name='Child' type='xs:string' />
+ </xs:sequence>
+ <xs:attribute name='Attr' type='xs:integer' />
+ </xs:complexType>
+ </xs:element>
</xs:schema>";
var ds = new DataSet();
public void PrefixedTargetNS()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:x='urn:foo' targetNamespace='urn:foo' elementFormDefault='qualified'>
- <xs:element name='DS' msdata:IsDataSet='true'>
- <xs:complexType>
- <xs:choice>
- <xs:element ref='x:R1' />
- <xs:element ref='x:R2' />
- </xs:choice>
- </xs:complexType>
- <xs:key name='key'>
- <xs:selector xpath='./any/string_is_OK/x:R1'/>
- <xs:field xpath='x:Child2'/>
- </xs:key>
- <xs:keyref name='kref' refer='x:key'>
- <xs:selector xpath='.//x:R2'/>
- <xs:field xpath='x:Child2'/>
- </xs:keyref>
- </xs:element>
- <xs:element name='R3' type='x:RootType' />
- <xs:complexType name='extracted'>
- <xs:choice>
- <xs:element ref='x:R1' />
- <xs:element ref='x:R2' />
- </xs:choice>
- </xs:complexType>
- <xs:element name='R1' type='x:RootType'>
- <xs:unique name='Rkey'>
- <xs:selector xpath='.//x:Child1'/>
- <xs:field xpath='.'/>
- </xs:unique>
- <xs:keyref name='Rkref' refer='x:Rkey'>
- <xs:selector xpath='.//x:Child2'/>
- <xs:field xpath='.'/>
- </xs:keyref>
- </xs:element>
- <xs:element name='R2' type='x:RootType'>
- </xs:element>
- <xs:complexType name='RootType'>
- <xs:choice>
- <xs:element name='Child1' type='xs:string'>
- </xs:element>
- <xs:element name='Child2' type='xs:string' />
- </xs:choice>
- <xs:attribute name='Attr' type='xs:integer' />
- </xs:complexType>
+ <xs:element name='DS' msdata:IsDataSet='true'>
+ <xs:complexType>
+ <xs:choice>
+ <xs:element ref='x:R1' />
+ <xs:element ref='x:R2' />
+ </xs:choice>
+ </xs:complexType>
+ <xs:key name='key'>
+ <xs:selector xpath='./any/string_is_OK/x:R1'/>
+ <xs:field xpath='x:Child2'/>
+ </xs:key>
+ <xs:keyref name='kref' refer='x:key'>
+ <xs:selector xpath='.//x:R2'/>
+ <xs:field xpath='x:Child2'/>
+ </xs:keyref>
+ </xs:element>
+ <xs:element name='R3' type='x:RootType' />
+ <xs:complexType name='extracted'>
+ <xs:choice>
+ <xs:element ref='x:R1' />
+ <xs:element ref='x:R2' />
+ </xs:choice>
+ </xs:complexType>
+ <xs:element name='R1' type='x:RootType'>
+ <xs:unique name='Rkey'>
+ <xs:selector xpath='.//x:Child1'/>
+ <xs:field xpath='.'/>
+ </xs:unique>
+ <xs:keyref name='Rkref' refer='x:Rkey'>
+ <xs:selector xpath='.//x:Child2'/>
+ <xs:field xpath='.'/>
+ </xs:keyref>
+ </xs:element>
+ <xs:element name='R2' type='x:RootType'>
+ </xs:element>
+ <xs:complexType name='RootType'>
+ <xs:choice>
+ <xs:element name='Child1' type='xs:string'>
+ </xs:element>
+ <xs:element name='Child2' type='xs:string' />
+ </xs:choice>
+ <xs:attribute name='Attr' type='xs:integer' />
+ </xs:complexType>
</xs:schema>";
// No prefixes on tables and columns
var ds = new DataSet();
ds.Tables[0].ReadXmlSchema(new StringReader(
@"<!-- Modified w3ctests attQ014.xsd -->
<xsd:schema xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" targetNamespace=""http://xsdtesting"" xmlns:x=""http://xsdtesting"">
- <xsd:element name=""root"">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name=""e"">
- <xsd:complexType>
- <xsd:simpleContent>
- <xsd:extension base=""xsd:decimal"">
- <xsd:attribute name=""a"" type=""xsd:string""/>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
+ <xsd:element name=""root"">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name=""e"">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base=""xsd:decimal"">
+ <xsd:attribute name=""a"" type=""xsd:string""/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
</xsd:schema>"));
DataTable dt = ds.Tables[0];
DataSetAssertion.AssertDataTable("root", dt, "e", 2, 0, 0, 0, 0, 0);
ds.Tables[0].ReadXmlSchema(new StringReader(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<xs:schema targetNamespace=""http://neurosaudio.com/Tracks.xsd"" xmlns=""http://neurosaudio.com/Tracks.xsd"" xmlns:mstns=""http://neurosaudio.com/Tracks.xsd"" xmlns:xs=""http://www.w3.org/2001/XMLSchema"" xmlns:msdata=""urn:schemas-microsoft-com:xml-msdata"" elementFormDefault=""qualified"" id=""Tracks"">
- <xs:element name=""Tracks"">
- <xs:complexType>
- <xs:sequence>
- <xs:element name=""Track"" minOccurs=""0"" maxOccurs=""unbounded"">
- <xs:complexType>
- <xs:sequence>
- <xs:element name=""Title"" type=""xs:string"" />
- <xs:element name=""Artist"" type=""xs:string"" minOccurs=""0"" />
- <xs:element name=""Album"" type=""xs:string"" minOccurs=""0"" />
- <xs:element name=""Performer"" type=""xs:string"" minOccurs=""0"" />
- <xs:element name=""Sequence"" type=""xs:unsignedInt"" minOccurs=""0"" />
- <xs:element name=""Genre"" type=""xs:string"" minOccurs=""0"" />
- <xs:element name=""Comment"" type=""xs:string"" minOccurs=""0"" />
- <xs:element name=""Year"" type=""xs:string"" minOccurs=""0"" />
- <xs:element name=""Duration"" type=""xs:unsignedInt"" minOccurs=""0"" />
- <xs:element name=""Path"" type=""xs:string"" />
- <xs:element name=""DevicePath"" type=""xs:string"" minOccurs=""0"" />
- <xs:element name=""FileSize"" type=""xs:unsignedInt"" minOccurs=""0"" />
- <xs:element name=""Source"" type=""xs:string"" minOccurs=""0"" />
- <xs:element name=""FlashStatus"" type=""xs:unsignedInt"" />
- <xs:element name=""HDStatus"" type=""xs:unsignedInt"" />
- </xs:sequence>
- <xs:attribute name=""ID"" type=""xs:unsignedInt"" msdata:AutoIncrement=""true"" msdata:AutoIncrementSeed=""1"" />
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- <xs:key name=""TrackPK"" msdata:PrimaryKey=""true"">
- <xs:selector xpath="".//mstns:Track"" />
- <xs:field xpath=""@ID"" />
- </xs:key>
- </xs:element>
+ <xs:element name=""Tracks"">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name=""Track"" minOccurs=""0"" maxOccurs=""unbounded"">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name=""Title"" type=""xs:string"" />
+ <xs:element name=""Artist"" type=""xs:string"" minOccurs=""0"" />
+ <xs:element name=""Album"" type=""xs:string"" minOccurs=""0"" />
+ <xs:element name=""Performer"" type=""xs:string"" minOccurs=""0"" />
+ <xs:element name=""Sequence"" type=""xs:unsignedInt"" minOccurs=""0"" />
+ <xs:element name=""Genre"" type=""xs:string"" minOccurs=""0"" />
+ <xs:element name=""Comment"" type=""xs:string"" minOccurs=""0"" />
+ <xs:element name=""Year"" type=""xs:string"" minOccurs=""0"" />
+ <xs:element name=""Duration"" type=""xs:unsignedInt"" minOccurs=""0"" />
+ <xs:element name=""Path"" type=""xs:string"" />
+ <xs:element name=""DevicePath"" type=""xs:string"" minOccurs=""0"" />
+ <xs:element name=""FileSize"" type=""xs:unsignedInt"" minOccurs=""0"" />
+ <xs:element name=""Source"" type=""xs:string"" minOccurs=""0"" />
+ <xs:element name=""FlashStatus"" type=""xs:unsignedInt"" />
+ <xs:element name=""HDStatus"" type=""xs:unsignedInt"" />
+ </xs:sequence>
+ <xs:attribute name=""ID"" type=""xs:unsignedInt"" msdata:AutoIncrement=""true"" msdata:AutoIncrementSeed=""1"" />
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:key name=""TrackPK"" msdata:PrimaryKey=""true"">
+ <xs:selector xpath="".//mstns:Track"" />
+ <xs:field xpath=""@ID"" />
+ </xs:key>
+ </xs:element>
</xs:schema>"));
}
{
// Never premise English.
//Assert.Equal ("Schema of current DataTable '" + table.TableName +
- // "' in DataTableReader has changed, DataTableReader is invalid.", e.Message, "#1");
+ // "' in DataTableReader has changed, DataTableReader is invalid.", e.Message, "#1");
}
rdr = table.CreateDataReader();
{
// Never premise English.
//Assert.Equal ("Schema of current DataTable '" + table.TableName +
- // "' in DataTableReader has changed, DataTableReader is invalid.", e.Message, "#1");
+ // "' in DataTableReader has changed, DataTableReader is invalid.", e.Message, "#1");
}
}
{
// Never premise English.
//Assert.Equal ("Unable to cast object of type 'System.String'" +
- // " to type 'System.Char[]'.", e.Message, "#1");
+ // " to type 'System.Char[]'.", e.Message, "#1");
}
char[] char_arr = null;
long len = 0;
Assert.Equal(1, Rows.Length);
/*
- try {
- Mom.Select ("Child.Name = 'Jack'");
+ try {
+ Mom.Select ("Child.Name = 'Jack'");
Assert.False(true);
- } catch (Exception e) {
- Assert.Equal (typeof (SyntaxErrorException), e.GetType ());
- Assert.Equal ("Cannot interpret token 'Child' at position 1.", e.Message);
- }
- */
+ } catch (Exception e) {
+ Assert.Equal (typeof (SyntaxErrorException), e.GetType ());
+ Assert.Equal ("Cannot interpret token 'Child' at position 1.", e.Message);
+ }
+ */
Rows = Child.Select("Parent.name = 'Laura'");
Assert.Equal(3, Rows.Length);
DataTableReader dtr = _dt.CreateDataReader();
DataRowAction[] dra = new DataRowAction[] {
DataRowAction.Nothing,// REAL action
- DataRowAction.Nothing,// dummy
- DataRowAction.Nothing,// dummy
- DataRowAction.Nothing,// dummy
- DataRowAction.Nothing};// dummy
+ DataRowAction.Nothing,// dummy
+ DataRowAction.Nothing,// dummy
+ DataRowAction.Nothing,// dummy
+ DataRowAction.Nothing};// dummy
rowActionInit(dra);
dtLoad.Load(dtr, LoadOption.Upsert);
rowActionEnd();
public void ReadXmlSchemeWithScheme()
{
const string xml = @"<CustomElement>
- <xs:schema id='NewDataSet' xmlns='' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
- <xs:element name='NewDataSet' msdata:IsDataSet='true' msdata:MainDataTable='row' msdata:Locale=''>
- <xs:complexType>
- <xs:choice minOccurs='0' maxOccurs='unbounded'>
- <xs:element name='row' msdata:Locale=''>
- <xs:complexType>
- <xs:sequence>
- <xs:element name='Text' type='xs:string' minOccurs='0' />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:choice>
- </xs:complexType>
- </xs:element>
- </xs:schema>
- </CustomElement>";
+ <xs:schema id='NewDataSet' xmlns='' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
+ <xs:element name='NewDataSet' msdata:IsDataSet='true' msdata:MainDataTable='row' msdata:Locale=''>
+ <xs:complexType>
+ <xs:choice minOccurs='0' maxOccurs='unbounded'>
+ <xs:element name='row' msdata:Locale=''>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name='Text' type='xs:string' minOccurs='0' />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </CustomElement>";
using (var s = new StringReader(xml))
{
DataTable dt = new DataTable();
public void ReadXmlSchemeWithBadScheme()
{
const string xml = @"<CustomElement>
- <xs:schema id='NewDataSet' xmlns='' xmlns:xs='http://www.w3.org/2001/BAD' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
- </xs:schema>
- </CustomElement>";
+ <xs:schema id='NewDataSet' xmlns='' xmlns:xs='http://www.w3.org/2001/BAD' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
+ </xs:schema>
+ </CustomElement>";
AssertExtensions.Throws<ArgumentException>(null, () =>
{
using (var s = new StringReader(xml))
[Fact]
public void MinimumCapacity()
{
- // i get default=50, according to MSDN the value should be 25
- // // Checking MinimumCapacity default = 25
- // Assert.Equal(25, dtParent.MinimumCapacity);
- // EndCase(null);
+ // i get default=50, according to MSDN the value should be 25
+ // // Checking MinimumCapacity default = 25
+ // Assert.Equal(25, dtParent.MinimumCapacity);
+ // EndCase(null);
DataTable dt = new DataTable();
// Checking MinimumCapacity get/set int.MaxValue
dt.MinimumCapacity = 0;
Assert.Equal(0, dt.MinimumCapacity);
- // // Checking MinimumCapacity get/set int.MinValue
- // dtParent.MinimumCapacity = int.MinValue;
- // Assert.Equal(int.MinValue, dtParent.MinimumCapacity);
- // EndCase(null);
+ // // Checking MinimumCapacity get/set int.MinValue
+ // dtParent.MinimumCapacity = int.MinValue;
+ // Assert.Equal(int.MinValue, dtParent.MinimumCapacity);
+ // EndCase(null);
}
[Fact]
CompareUnSorted(drSelect, al.ToArray());
#if LATER
- //-------------------------------------------------------------
- al.Clear();
- foreach (DataRow dr in dt.Rows)
- if (dr["ChildDouble"].ToString().Length > 10)
- al.Add(dr);
- // Select_S - Len(Convert(ChildDouble,'System.String')) > 10
- drSelect = dt.Select ("Len(Convert(ChildDouble,'System.String')) > 10");
- Assert.Equal (al.ToArray(), drSelect);
+ //-------------------------------------------------------------
+ al.Clear();
+ foreach (DataRow dr in dt.Rows)
+ if (dr["ChildDouble"].ToString().Length > 10)
+ al.Add(dr);
+ // Select_S - Len(Convert(ChildDouble,'System.String')) > 10
+ drSelect = dt.Select ("Len(Convert(ChildDouble,'System.String')) > 10");
+ Assert.Equal (al.ToArray(), drSelect);
#endif
//-------------------------------------------------------------
al.Clear();
Assert.Equal(al.ToArray(), drSelect);
//-------------------------------------------------------------
/*
- al.Clear();
- foreach (DataRow dr in ds.Tables[0].Rows)
- if (dr.IsNull("ParentBool") || (bool)dr["ParentBool"])
- al.Add(dr);
- // Select_S - IsNull(ParentBool,true)
- drSelect = ds.Tables[0].Select("IsNull(ParentBool,true) ");
- Assert.Equal (al.ToArray(), drSelect);
- */
+ al.Clear();
+ foreach (DataRow dr in ds.Tables[0].Rows)
+ if (dr.IsNull("ParentBool") || (bool)dr["ParentBool"])
+ al.Add(dr);
+ // Select_S - IsNull(ParentBool,true)
+ drSelect = ds.Tables[0].Select("IsNull(ParentBool,true) ");
+ Assert.Equal (al.ToArray(), drSelect);
+ */
//-------------------------------------------------------------
al.Clear();
// Select_S - Relation not exists, Exception
ArrayList al = new ArrayList();
DataRowVersion drVer = DataRowVersion.Current;
- //From MSDN - The row the default version for the current DataRowState.
- // For a DataRowState value of Added, Modified or Current,
- // the default version is Current.
- // For a DataRowState of Deleted, the version is Original.
- // For a DataRowState value of Detached, the version is Proposed.
+ //From MSDN - The row the default version for the current DataRowState.
+ // For a DataRowState value of Added, Modified or Current,
+ // the default version is Current.
+ // For a DataRowState of Deleted, the version is Original.
+ // For a DataRowState value of Detached, the version is Proposed.
if (((State & DataRowState.Added) > 0)
| ((State & DataRowState.Modified) > 0)
table.PrimaryKey = new DataColumn[] { col };
table.AcceptChanges();
- // ms.net behavior.
+ // ms.net behavior.
table.BeginInit();
DataColumn col1 = new DataColumn("col1", typeof(int));
table.Columns.AddRange(new DataColumn[] { col1 });
// ms.net throws a nullreference exception.
// If any data is merged, exception is anyways raised.
/*
- table1.PrimaryKey = new DataColumn[] {table1.Columns[0]};
- table3 = table1.Clone ();
- try {
- table3.Merge(table2);
+ table1.PrimaryKey = new DataColumn[] {table1.Columns[0]};
+ table3 = table1.Clone ();
+ try {
+ table3.Merge(table2);
Assert.False(true);
- } catch (DataException e) {}
- */
+ } catch (DataException e) {}
+ */
table3.Merge(table2, false, MissingSchemaAction.Ignore);
table1.PrimaryKey = null;
using (FileStream stream = new FileStream(_tempFile, FileMode.Open))
{
- //This should not read anything as table name is not set
+ //This should not read anything as table name is not set
mode = table.ReadXml(stream);
}
// RowFilter is not examined.
m.DataViewSettingCollectionString = "<DataViewSettingCollectionString>blah<table2-1 RowFilter='a=b' ApplyDefaultSort='true' /></DataViewSettingCollectionString>";
// MS.NET ignores ApplyDefaultSort.
- // Assert.Equal (@"<DataViewSettingCollectionString><table2-1 Sort="""" RowFilter=""a=b"" RowStateFilter=""Deleted""/></DataViewSettingCollectionString>", m.DataViewSettingCollectionString);
+ // Assert.Equal (@"<DataViewSettingCollectionString><table2-1 Sort="""" RowFilter=""a=b"" RowStateFilter=""Deleted""/></DataViewSettingCollectionString>", m.DataViewSettingCollectionString);
}
[Fact]
public void RowStateFilter()
{
/*
- Added A new row. 4
- CurrentRows Current rows including unchanged, new, and modified rows. 22
- Deleted A deleted row. 8
- ModifiedCurrent A current version, which is a modified version of original data (see ModifiedOriginal). 16
- ModifiedOriginal The original version (although it has since been modified and is available as ModifiedCurrent). 32
- None None. 0
- OriginalRows Original rows including unchanged and deleted rows. 42
- Unchanged An unchanged row. 2
- */
+ Added A new row. 4
+ CurrentRows Current rows including unchanged, new, and modified rows. 22
+ Deleted A deleted row. 8
+ ModifiedCurrent A current version, which is a modified version of original data (see ModifiedOriginal). 16
+ ModifiedOriginal The original version (although it has since been modified and is available as ModifiedCurrent). 32
+ None None. 0
+ OriginalRows Original rows including unchanged and deleted rows. 42
+ Unchanged An unchanged row. 2
+ */
//DataRowView[] drvResult = null;
ArrayList al = new ArrayList();
// Deleted
Assert.True(CompareSortedRowsByParentId(dv, drResult));
/*
- //---------- OriginalRows --------
- dv.RowStateFilter = DataViewRowState.OriginalRows ;
- drResult = GetResultRows(dt,DataRowState.Unchanged | DataRowState.Deleted );
- // OriginalRows
- Assert.Equal(true , CompareSortedRowsByParentId(dv,drResult));
- */
+ //---------- OriginalRows --------
+ dv.RowStateFilter = DataViewRowState.OriginalRows ;
+ drResult = GetResultRows(dt,DataRowState.Unchanged | DataRowState.Deleted );
+ // OriginalRows
+ Assert.Equal(true , CompareSortedRowsByParentId(dv,drResult));
+ */
}
private DataRow[] GetResultRows(DataTable dt, DataRowState State)
ArrayList al = new ArrayList();
DataRowVersion drVer = DataRowVersion.Current;
- //From MSDN - The row the default version for the current DataRowState.
- // For a DataRowState value of Added, Modified or Current,
- // the default version is Current.
- // For a DataRowState of Deleted, the version is Original.
- // For a DataRowState value of Detached, the version is Proposed.
+ //From MSDN - The row the default version for the current DataRowState.
+ // For a DataRowState value of Added, Modified or Current,
+ // the default version is Current.
+ // For a DataRowState of Deleted, the version is Original.
+ // For a DataRowState value of Detached, the version is Proposed.
if (((State & DataRowState.Added) > 0)
| ((State & DataRowState.Modified) > 0)
dv = dt.DefaultView;
- // public DataViewManager DataViewManager {get;} - The DataViewManager that created this view.
- // If this is the default DataView for a DataTable, the DataViewManager property returns the default DataViewManager for the DataSet.
- // Otherwise, if the DataView was created without a DataViewManager, this property is a null reference (Nothing in Visual Basic).
+ // public DataViewManager DataViewManager {get;} - The DataViewManager that created this view.
+ // If this is the default DataView for a DataTable, the DataViewManager property returns the default DataViewManager for the DataSet.
+ // Otherwise, if the DataView was created without a DataViewManager, this property is a null reference (Nothing in Visual Basic).
dvm = dv.DataViewManager;
Assert.Same(ds.DefaultViewManager, dvm);
{
// Never premise English.
//Assert.Equal ("'columnNames' argument cannot be null." + Environment.NewLine +
- // "Parameter name: columnNames", e.Message, "#1");
+ // "Parameter name: columnNames", e.Message, "#1");
}
DataTable newTable1 = view.ToTable(false, new string[] { });
Assert.Equal(10, newTable1.Rows.Count);
Assert.Equal(typeof(UniqueConstraint), Table.Constraints[0].GetType());
}
- // Tests ctor (string, DataColumn [], DataColumn [])
+ // Tests ctor (string, DataColumn [], DataColumn [])
[Fact]
public void Ctor4()
{
#if false // FIXME: Here this test crashes under MS.NET.
// OK - So AddRange() is the only way!
table2.Constraints.AddRange (constraints);
- // After AddRange(), Check the properties of ForeignKeyConstraint object
+ // After AddRange(), Check the properties of ForeignKeyConstraint object
Assert.True(fkc.RelatedColumns [0].ColumnName.Equals ("col1"));
Assert.True(fkc.RelatedColumns [1].ColumnName.Equals ("col2"));
Assert.True(fkc.RelatedColumns [2].ColumnName.Equals ("col3"));
DataSet ds1 = new DataSet();
ds1.Tables.Add(DataProvider.CreateParentDataTable());
ds1.Tables.Add(DataProvider.CreateChildDataTable());
- // ds1.Tables.Add(DataProvider.CreateChildDataTable());
+ // ds1.Tables.Add(DataProvider.CreateChildDataTable());
ds1.Tables[0].PrimaryKey = new DataColumn[] { ds1.Tables[0].Columns[0] };
return ds1;
DataRow[] arr = ds1.Tables[1].Select("ChildId is null");
/*foreach (DataRow dr in arr)
- {
- Assert.Null(dr["ChildId"]);
- }*/
+ {
+ Assert.Null(dr["ChildId"]);
+ }*/
Assert.Equal(4, arr.Length);
public class SqlDateTimeTest
{
private long[] _myTicks = {
- 631501920000000000L, // 25 Feb 2002 - 00:00:00
- 631502475130080000L, // 25 Feb 2002 - 15:25:13,8
- 631502115130080000L, // 25 Feb 2002 - 05:25:13,8
- 631502115000000000L, // 25 Feb 2002 - 05:25:00
- 631502115130000000L, // 25 Feb 2002 - 05:25:13
- 631502079130000000L, // 25 Feb 2002 - 04:25:13
- 629197085770000000L // 06 Nov 1994 - 08:49:37
- };
+ 631501920000000000L, // 25 Feb 2002 - 00:00:00
+ 631502475130080000L, // 25 Feb 2002 - 15:25:13,8
+ 631502115130080000L, // 25 Feb 2002 - 05:25:13,8
+ 631502115000000000L, // 25 Feb 2002 - 05:25:00
+ 631502115130000000L, // 25 Feb 2002 - 05:25:13
+ 631502079130000000L, // 25 Feb 2002 - 04:25:13
+ 629197085770000000L // 06 Nov 1994 - 08:49:37
+ };
private SqlDateTime _test1;
private SqlDateTime _test2;
// Divide() => Notworking
/*
- Assert.Equal ((SqlDecimal)(-1077.441066m), SqlDecimal.Divide (Test1, Test4));
- Assert.Equal (1.54687501546m, SqlDecimal.Divide (Test2, Test1).Value);
+ Assert.Equal ((SqlDecimal)(-1077.441066m), SqlDecimal.Divide (Test1, Test4));
+ Assert.Equal (1.54687501546m, SqlDecimal.Divide (Test2, Test1).Value);
- try {
- SqlDecimal test = SqlDecimal.Divide(Test1, new SqlDecimal(0)).Value;
+ try {
+ SqlDecimal test = SqlDecimal.Divide(Test1, new SqlDecimal(0)).Value;
Assert.False(true);
- } catch (DivideByZeroException e) {
- Assert.Equal (typeof (DivideByZeroException), e.GetType ());
- }
- */
+ } catch (DivideByZeroException e) {
+ Assert.Equal (typeof (DivideByZeroException), e.GetType ());
+ }
+ */
Assert.Equal(6464m, SqlDecimal.Floor(_test1));
}
/* Don't do such environment-dependent test. It will never succeed under Portable.NET and MS.NET
- [Fact]
- public void GetHashCodeTest()
- {
- // FIXME: Better way to test HashCode
- Assert.Equal (-1281249885, Test1.GetHashCode ());
- }
- */
+ [Fact]
+ public void GetHashCodeTest()
+ {
+ // FIXME: Better way to test HashCode
+ Assert.Equal (-1281249885, Test1.GetHashCode ());
+ }
+ */
[Fact]
public void GetTypeTest()
// 6464.6464 --> 64646464 ??? with windows
// MS.NET seems to return the first 32 bit integer (i.e.
// Data [0]) but we don't have to follow such stupidity.
- // Assert.Equal ((int)64646464, Test1.ToSqlInt32 ().Value);
- // Assert.Equal ((int)1212, new SqlDecimal(12.12m).ToSqlInt32 ().Value);
+ // Assert.Equal ((int)64646464, Test1.ToSqlInt32 ().Value);
+ // Assert.Equal ((int)1212, new SqlDecimal(12.12m).ToSqlInt32 ().Value);
try
{
Assert.True(false, "should match only one raw");
break;
}
- prevID = ql.StudentID;
+ prevID = ql.StudentID;
}
}
}
else if (value is string)
{
- cch = ((String)value).Length - offset;
+ cch = ((string)value).Length - offset;
if ((0 != (ParameterDirection.Output & _internalDirection)) && (0x3fffffff <= _internalSize))
{
}
else if (value is string)
{
- ccb = (((String)value).Length - offset) * 2 + 2;
+ ccb = (((string)value).Length - offset) * 2 + 2;
}
else if (value is char[])
{
}
else if (ODBC32.SQL_C.WCHAR == _bindtype._sql_c)
{
- if ((value is string) && (ccb < ((String)value).Length) && (_bindtype == _originalbindtype))
+ if ((value is string) && (ccb < ((string)value).Length) && (_bindtype == _originalbindtype))
{
// silently truncate ... MDAC 84408 ... do not truncate upgraded values ... MDAC 84706
- ccb = ((String)value).Length;
+ ccb = ((string)value).Length;
}
ccb = (ccb * 2) + 2; // allow for null termination
}
_bindtype = TypeMap._VarChar;
if ((null != value) && !Convert.IsDBNull(value))
{
- value = ((Decimal)value).ToString(CultureInfo.CurrentCulture);
+ value = ((decimal)value).ToString(CultureInfo.CurrentCulture);
size = ((string)value).Length;
offset = 0;
}
_bindtype = TypeMap._VarChar;
if ((null != value) && !Convert.IsDBNull(value))
{
- value = ((Int64)value).ToString(CultureInfo.CurrentCulture);
+ value = ((long)value).ToString(CultureInfo.CurrentCulture);
size = ((string)value).Length;
offset = 0;
}
{
if (value is decimal)
{
- return ((System.Data.SqlTypes.SqlDecimal)(Decimal)value).Precision;
+ return ((System.Data.SqlTypes.SqlDecimal)(decimal)value).Precision;
}
return 0;
}
namespace System.Data.OleDb
{
- sealed internal class ColumnBinding
+ internal sealed class ColumnBinding
{
// shared with other ColumnBindings
private readonly OleDbDataReader _dataReader; // HCHAPTER
RowBinding.WriteInt64(ValueOffset, 0); // safe because AlignDataSize forces 8 byte blocks
}
- internal Object Value()
+ internal object Value()
{
object value = _value;
if (null == value)
value = Value_I8(); // Int64
break;
case NativeDBType.UI8:
- value = (Decimal)Value_UI8(); // UInt64->Decimal
+ value = (decimal)Value_UI8(); // UInt64->Decimal
break;
case NativeDBType.FILETIME:
value = Value_FILETIME(); // DateTime
SetValueDBNull();
break;
case NativeDBType.I2:
- Value_I2((Int16)value);
+ Value_I2((short)value);
break;
case NativeDBType.I4:
- Value_I4((Int32)value);
+ Value_I4((int)value);
break;
case NativeDBType.R4:
- Value_R4((Single)value);
+ Value_R4((float)value);
break;
case NativeDBType.R8:
- Value_R8((Double)value);
+ Value_R8((double)value);
break;
case NativeDBType.CY:
- Value_CY((Decimal)value);
+ Value_CY((decimal)value);
break;
case NativeDBType.DATE:
Value_DATE((DateTime)value);
break;
case NativeDBType.BSTR:
- Value_BSTR((String)value);
+ Value_BSTR((string)value);
break;
case NativeDBType.IDISPATCH:
Value_IDISPATCH(value);
break;
case NativeDBType.ERROR:
- Value_ERROR((Int32)value);
+ Value_ERROR((int)value);
break;
case NativeDBType.BOOL:
- Value_BOOL((Boolean)value);
+ Value_BOOL((bool)value);
break;
case NativeDBType.VARIANT:
Value_VARIANT(value);
Value_IUNKNOWN(value);
break;
case NativeDBType.DECIMAL:
- Value_DECIMAL((Decimal)value);
+ Value_DECIMAL((decimal)value);
break;
case NativeDBType.I1:
- if (value is Int16)
+ if (value is short)
{
- Value_I1(Convert.ToSByte((Int16)value, CultureInfo.InvariantCulture));
+ Value_I1(Convert.ToSByte((short)value, CultureInfo.InvariantCulture));
}
else
{
- Value_I1((SByte)value);
+ Value_I1((sbyte)value);
}
break;
case NativeDBType.UI1:
- Value_UI1((Byte)value);
+ Value_UI1((byte)value);
break;
case NativeDBType.UI2:
- if (value is Int32)
+ if (value is int)
{
- Value_UI2(Convert.ToUInt16((Int32)value, CultureInfo.InvariantCulture));
+ Value_UI2(Convert.ToUInt16((int)value, CultureInfo.InvariantCulture));
}
else
{
- Value_UI2((UInt16)value);
+ Value_UI2((ushort)value);
}
break;
case NativeDBType.UI4:
- if (value is Int64)
+ if (value is long)
{
- Value_UI4(Convert.ToUInt32((Int64)value, CultureInfo.InvariantCulture));
+ Value_UI4(Convert.ToUInt32((long)value, CultureInfo.InvariantCulture));
}
else
{
- Value_UI4((UInt32)value);
+ Value_UI4((uint)value);
}
break;
case NativeDBType.I8:
- Value_I8((Int64)value);
+ Value_I8((long)value);
break;
case NativeDBType.UI8:
- if (value is Decimal)
+ if (value is decimal)
{
- Value_UI8(Convert.ToUInt64((Decimal)value, CultureInfo.InvariantCulture));
+ Value_UI8(Convert.ToUInt64((decimal)value, CultureInfo.InvariantCulture));
}
else
{
- Value_UI8((UInt64)value);
+ Value_UI8((ulong)value);
}
break;
case NativeDBType.FILETIME:
Value_GUID((Guid)value);
break;
case NativeDBType.BYTES:
- Value_BYTES((Byte[])value);
+ Value_BYTES((byte[])value);
break;
case NativeDBType.WSTR:
if (value is string)
{
- Value_WSTR((String)value);
+ Value_WSTR((string)value);
}
else
{
}
break;
case NativeDBType.NUMERIC:
- Value_NUMERIC((Decimal)value);
+ Value_NUMERIC((decimal)value);
break;
case NativeDBType.DBDATE:
Value_DBDATE((DateTime)value);
Value_VARIANT(value);
break;
case (NativeDBType.BYREF | NativeDBType.BYTES):
- Value_ByRefBYTES((Byte[])value);
+ Value_ByRefBYTES((byte[])value);
break;
case (NativeDBType.BYREF | NativeDBType.WSTR):
if (value is string)
{
- Value_ByRefWSTR((String)value);
+ Value_ByRefWSTR((string)value);
}
else
{
}
}
- internal Boolean Value_BOOL()
+ internal bool Value_BOOL()
{
Debug.Assert((NativeDBType.BOOL == DbType), "Value_BOOL");
Debug.Assert((DBStatus.S_OK == StatusValue()), "Value_BOOL");
- Int16 value = RowBinding.ReadInt16(ValueOffset);
+ short value = RowBinding.ReadInt16(ValueOffset);
return (0 != value);
}
- private void Value_BOOL(Boolean value)
+ private void Value_BOOL(bool value)
{
Debug.Assert((NativeDBType.BOOL == DbType), "Value_BOOL");
LengthValue(0);
RowBinding.WriteInt16(ValueOffset, (short)(value ? ODB.VARIANT_TRUE : ODB.VARIANT_FALSE));
}
- private String Value_BSTR()
+ private string Value_BSTR()
{
Debug.Assert((NativeDBType.BSTR == DbType), "Value_BSTR");
Debug.Assert((DBStatus.S_OK == StatusValue()), "Value_BSTR");
}
return value;
}
- private void Value_BSTR(String value)
+ private void Value_BSTR(string value)
{
Debug.Assert((null != value), "Value_BSTR null");
Debug.Assert((NativeDBType.BSTR == DbType), "Value_BSTR");
RowBinding.SetBstrValue(ValueOffset, value);
}
- private Byte[] Value_ByRefBYTES()
+ private byte[] Value_ByRefBYTES()
{
Debug.Assert(((NativeDBType.BYREF | NativeDBType.BYTES) == DbType), "Value_ByRefBYTES");
Debug.Assert((DBStatus.S_OK == StatusValue()), "Value_ByRefBYTES");
}
return ((null != value) ? value : Array.Empty<byte>());
}
- private void Value_ByRefBYTES(Byte[] value)
+ private void Value_ByRefBYTES(byte[] value)
{
Debug.Assert(null != value, "Value_ByRefBYTES null");
Debug.Assert((NativeDBType.BYREF | NativeDBType.BYTES) == DbType, "Value_ByRefBYTES");
RowBinding.SetByRefValue(ValueOffset, ptr);
}
- private String Value_ByRefWSTR()
+ private string Value_ByRefWSTR()
{
Debug.Assert((NativeDBType.BYREF | NativeDBType.WSTR) == DbType, "Value_ByRefWSTR");
Debug.Assert((DBStatus.S_OK == StatusValue()) || (DBStatus.S_TRUNCATED == StatusValue()), "Value_ByRefWSTR");
}
return value;
}
- private void Value_ByRefWSTR(String value)
+ private void Value_ByRefWSTR(string value)
{
Debug.Assert(null != value, "Value_ByRefWSTR null");
Debug.Assert((NativeDBType.BYREF | NativeDBType.WSTR) == DbType, "Value_ByRefWSTR");
RowBinding.SetByRefValue(ValueOffset, ptr);
}
- private Byte[] Value_BYTES()
+ private byte[] Value_BYTES()
{
Debug.Assert(NativeDBType.BYTES == DbType, "Value_BYTES");
Debug.Assert((DBStatus.S_OK == StatusValue()) || (DBStatus.S_TRUNCATED == StatusValue()), "Value_BYTES");
RowBinding.ReadBytes(ValueOffset, value, 0, byteCount);
return value;
}
- private void Value_BYTES(Byte[] value)
+ private void Value_BYTES(byte[] value)
{
Debug.Assert(null != value, "Value_BYTES null");
// we silently truncate when the user has specified a given Size
}
}
- private Decimal Value_CY()
+ private decimal Value_CY()
{
Debug.Assert(NativeDBType.CY == DbType, "Value_CY");
Debug.Assert(DBStatus.S_OK == StatusValue(), "Value_CY");
- return Decimal.FromOACurrency(RowBinding.ReadInt64(ValueOffset));
+ return decimal.FromOACurrency(RowBinding.ReadInt64(ValueOffset));
}
- private void Value_CY(Decimal value)
+ private void Value_CY(decimal value)
{
Debug.Assert(NativeDBType.CY == DbType, "Value_CY");
LengthValue(0);
StatusValue(DBStatus.S_OK);
- RowBinding.WriteInt64(ValueOffset, Decimal.ToOACurrency(value));
+ RowBinding.WriteInt64(ValueOffset, decimal.ToOACurrency(value));
}
private DateTime Value_DATE()
RowBinding.WriteDateTime(ValueOffset, value);
}
- private Decimal Value_DECIMAL()
+ private decimal Value_DECIMAL()
{
Debug.Assert(NativeDBType.DECIMAL == DbType, "Value_DECIMAL");
Debug.Assert(DBStatus.S_OK == StatusValue(), "Value_DECIMAL");
int[] buffer = new int[4];
RowBinding.ReadInt32Array(ValueOffset, buffer, 0, 4);
- return new Decimal(
+ return new decimal(
buffer[2], // low
buffer[3], // mid
buffer[1], // high
(0 != (buffer[0] & unchecked((int)0x80000000))), // sign
unchecked((byte)((buffer[0] & unchecked((int)0x00FF0000)) >> 16))); // scale
}
- private void Value_DECIMAL(Decimal value)
+ private void Value_DECIMAL(decimal value)
{
Debug.Assert(NativeDBType.DECIMAL == DbType, "Value_DECIMAL");
LengthValue(0);
StatusValue(DBStatus.S_OK);
- int[] tmp = Decimal.GetBits(value);
+ int[] tmp = decimal.GetBits(value);
int[] buffer = new int[4] {
tmp[3], tmp[2], tmp[0], tmp[1]
};
RowBinding.WriteInt32Array(ValueOffset, buffer, 0, 4);
}
- private Int32 Value_ERROR()
+ private int Value_ERROR()
{
Debug.Assert(NativeDBType.ERROR == DbType, "Value_ERROR");
Debug.Assert(DBStatus.S_OK == StatusValue(), "Value_ERROR");
return RowBinding.ReadInt32(ValueOffset);
}
- private void Value_ERROR(Int32 value)
+ private void Value_ERROR(int value)
{
Debug.Assert(NativeDBType.ERROR == DbType, "Value_ERROR");
LengthValue(0);
{
Debug.Assert(NativeDBType.FILETIME == DbType, "Value_FILETIME");
Debug.Assert(DBStatus.S_OK == StatusValue(), "Value_FILETIME");
- Int64 tmp = RowBinding.ReadInt64(ValueOffset);
+ long tmp = RowBinding.ReadInt64(ValueOffset);
return DateTime.FromFileTime(tmp);
}
private void Value_FILETIME(DateTime value)
Debug.Assert(NativeDBType.FILETIME == DbType, "Value_FILETIME");
LengthValue(0);
StatusValue(DBStatus.S_OK);
- Int64 tmp = value.ToFileTime();
+ long tmp = value.ToFileTime();
RowBinding.WriteInt64(ValueOffset, tmp);
}
return DataReader().ResetChapter(IndexForAccessor, IndexWithinAccessor, RowBinding, ValueOffset);
}
- private SByte Value_I1()
+ private sbyte Value_I1()
{
Debug.Assert(NativeDBType.I1 == DbType, "Value_I1");
Debug.Assert(DBStatus.S_OK == StatusValue(), "Value_I1");
byte value = RowBinding.ReadByte(ValueOffset);
- return unchecked((SByte)value);
+ return unchecked((sbyte)value);
}
- private void Value_I1(SByte value)
+ private void Value_I1(sbyte value)
{
Debug.Assert(NativeDBType.I1 == DbType, "Value_I1");
LengthValue(0);
StatusValue(DBStatus.S_OK);
- RowBinding.WriteByte(ValueOffset, unchecked((Byte)value));
+ RowBinding.WriteByte(ValueOffset, unchecked((byte)value));
}
- internal Int16 Value_I2()
+ internal short Value_I2()
{
Debug.Assert(NativeDBType.I2 == DbType, "Value_I2");
Debug.Assert(DBStatus.S_OK == StatusValue(), "Value_I2");
return RowBinding.ReadInt16(ValueOffset);
}
- private void Value_I2(Int16 value)
+ private void Value_I2(short value)
{
Debug.Assert(NativeDBType.I2 == DbType, "Value_I2");
LengthValue(0);
RowBinding.WriteInt16(ValueOffset, value);
}
- private Int32 Value_I4()
+ private int Value_I4()
{
Debug.Assert(NativeDBType.I4 == DbType, "Value_I4");
Debug.Assert(DBStatus.S_OK == StatusValue(), "Value_I4");
return RowBinding.ReadInt32(ValueOffset);
}
- private void Value_I4(Int32 value)
+ private void Value_I4(int value)
{
Debug.Assert(NativeDBType.I4 == DbType, "Value_I4");
LengthValue(0);
RowBinding.WriteInt32(ValueOffset, value);
}
- private Int64 Value_I8()
+ private long Value_I8()
{
Debug.Assert(NativeDBType.I8 == DbType, "Value_I8");
Debug.Assert(DBStatus.S_OK == StatusValue(), "Value_I8");
return RowBinding.ReadInt64(ValueOffset);
}
- private void Value_I8(Int64 value)
+ private void Value_I8(long value)
{
Debug.Assert(NativeDBType.I8 == DbType, "Value_I8");
LengthValue(0);
RowBinding.WriteIntPtr(ValueOffset, ptr);
}
- private Decimal Value_NUMERIC()
+ private decimal Value_NUMERIC()
{
Debug.Assert(NativeDBType.NUMERIC == DbType, "Value_NUMERIC");
Debug.Assert(DBStatus.S_OK == StatusValue(), "Value_NUMERIC");
return RowBinding.ReadNumeric(ValueOffset);
}
- private void Value_NUMERIC(Decimal value)
+ private void Value_NUMERIC(decimal value)
{
Debug.Assert(NativeDBType.NUMERIC == DbType, "Value_NUMERIC");
RowBinding.WriteNumeric(ValueOffset, value, ColumnBindingPrecision);
}
- private Single Value_R4()
+ private float Value_R4()
{
Debug.Assert(NativeDBType.R4 == DbType, "Value_R4");
Debug.Assert(DBStatus.S_OK == StatusValue(), "Value_R4");
return RowBinding.ReadSingle(ValueOffset);
}
- private void Value_R4(Single value)
+ private void Value_R4(float value)
{
Debug.Assert(NativeDBType.R4 == DbType, "Value_R4");
LengthValue(0);
RowBinding.WriteSingle(ValueOffset, value);
}
- private Double Value_R8()
+ private double Value_R8()
{
Debug.Assert(NativeDBType.R8 == DbType, "Value_R8");
Debug.Assert(DBStatus.S_OK == StatusValue(), "Value_R8");
return RowBinding.ReadDouble(ValueOffset);
}
- private void Value_R8(Double value)
+ private void Value_R8(double value)
{
Debug.Assert(NativeDBType.R8 == DbType, "Value_I4");
LengthValue(0);
RowBinding.WriteDouble(ValueOffset, value);
}
- private Byte Value_UI1()
+ private byte Value_UI1()
{
Debug.Assert(NativeDBType.UI1 == DbType, "Value_UI1");
Debug.Assert(DBStatus.S_OK == StatusValue(), "Value_UI1");
return RowBinding.ReadByte(ValueOffset);
}
- private void Value_UI1(Byte value)
+ private void Value_UI1(byte value)
{
Debug.Assert(NativeDBType.UI1 == DbType, "Value_UI1");
LengthValue(0);
RowBinding.WriteByte(ValueOffset, value);
}
- internal UInt16 Value_UI2()
+ internal ushort Value_UI2()
{
Debug.Assert(NativeDBType.UI2 == DbType, "Value_UI2");
Debug.Assert(DBStatus.S_OK == StatusValue(), "Value_UI2");
- return unchecked((UInt16)RowBinding.ReadInt16(ValueOffset));
+ return unchecked((ushort)RowBinding.ReadInt16(ValueOffset));
}
- private void Value_UI2(UInt16 value)
+ private void Value_UI2(ushort value)
{
Debug.Assert(NativeDBType.UI2 == DbType, "Value_UI2");
LengthValue(0);
StatusValue(DBStatus.S_OK);
- RowBinding.WriteInt16(ValueOffset, unchecked((Int16)value));
+ RowBinding.WriteInt16(ValueOffset, unchecked((short)value));
}
- internal UInt32 Value_UI4()
+ internal uint Value_UI4()
{
Debug.Assert(NativeDBType.UI4 == DbType, "Value_UI4");
Debug.Assert(DBStatus.S_OK == StatusValue(), "Value_UI4");
- return unchecked((UInt32)RowBinding.ReadInt32(ValueOffset));
+ return unchecked((uint)RowBinding.ReadInt32(ValueOffset));
}
- private void Value_UI4(UInt32 value)
+ private void Value_UI4(uint value)
{
Debug.Assert(NativeDBType.UI4 == DbType, "Value_UI4");
LengthValue(0);
StatusValue(DBStatus.S_OK);
- RowBinding.WriteInt32(ValueOffset, unchecked((Int32)value));
+ RowBinding.WriteInt32(ValueOffset, unchecked((int)value));
}
- internal UInt64 Value_UI8()
+ internal ulong Value_UI8()
{
Debug.Assert(NativeDBType.UI8 == DbType, "Value_UI8");
Debug.Assert(DBStatus.S_OK == StatusValue(), "Value_UI8");
- return unchecked((UInt64)RowBinding.ReadInt64(ValueOffset));
+ return unchecked((ulong)RowBinding.ReadInt64(ValueOffset));
}
- private void Value_UI8(UInt64 value)
+ private void Value_UI8(ulong value)
{
Debug.Assert(NativeDBType.UI8 == DbType, "Value_UI8");
LengthValue(0);
StatusValue(DBStatus.S_OK);
- RowBinding.WriteInt64(ValueOffset, unchecked((Int64)value));
+ RowBinding.WriteInt64(ValueOffset, unchecked((long)value));
}
- private String Value_WSTR()
+ private string Value_WSTR()
{
Debug.Assert(NativeDBType.WSTR == DbType, "Value_WSTR");
Debug.Assert((DBStatus.S_OK == StatusValue()) || (DBStatus.S_TRUNCATED == StatusValue()), "Value_WSTR");
int byteCount = Math.Min(LengthValue(), ColumnBindingMaxLen - 2);
return RowBinding.PtrToStringUni(ValueOffset, byteCount / 2);
}
- private void Value_WSTR(String value)
+ private void Value_WSTR(string value)
{
Debug.Assert(null != value, "Value_BYTES null");
Debug.Assert(NativeDBType.WSTR == DbType, "Value_WSTR");
RowBinding.SetVariantValue(ValueOffset, value);
}
- internal Boolean ValueBoolean()
+ internal bool ValueBoolean()
{
- Boolean value;
+ bool value;
switch (StatusValue())
{
case DBStatus.S_OK:
value = Value_BOOL();
break;
case NativeDBType.VARIANT:
- value = (Boolean)ValueVariant();
+ value = (bool)ValueVariant();
break;
default:
throw ODB.ConversionRequired();
}
break;
default:
- throw CheckTypeValueStatusValue(typeof(Boolean));
+ throw CheckTypeValueStatusValue(typeof(bool));
}
return value;
}
return value;
}
- internal Byte ValueByte()
+ internal byte ValueByte()
{
- Byte value;
+ byte value;
switch (StatusValue())
{
case DBStatus.S_OK:
value = Value_UI1();
break;
case NativeDBType.VARIANT:
- value = (Byte)ValueVariant();
+ value = (byte)ValueVariant();
break;
default:
throw ODB.ConversionRequired();
}
break;
default:
- throw CheckTypeValueStatusValue(typeof(Byte));
+ throw CheckTypeValueStatusValue(typeof(byte));
}
return value;
}
}
break;
default:
- throw CheckTypeValueStatusValue(typeof(String));
+ throw CheckTypeValueStatusValue(typeof(string));
}
_value = value;
}
}
break;
default:
- throw CheckTypeValueStatusValue(typeof(Int16));
+ throw CheckTypeValueStatusValue(typeof(short));
}
return value;
}
- internal Decimal ValueDecimal()
+ internal decimal ValueDecimal()
{
- Decimal value;
+ decimal value;
switch (StatusValue())
{
case DBStatus.S_OK:
value = Value_NUMERIC();
break;
case NativeDBType.UI8:
- value = (Decimal)Value_UI8();
+ value = (decimal)Value_UI8();
break;
case NativeDBType.VARIANT:
- value = (Decimal)ValueVariant();
+ value = (decimal)ValueVariant();
break;
default:
throw ODB.ConversionRequired();
}
break;
default:
- throw CheckTypeValueStatusValue(typeof(Int16));
+ throw CheckTypeValueStatusValue(typeof(short));
}
return value;
}
}
break;
default:
- throw CheckTypeValueStatusValue(typeof(Int16));
+ throw CheckTypeValueStatusValue(typeof(short));
}
return value;
}
- internal Int16 ValueInt16()
+ internal short ValueInt16()
{
- Int16 value;
+ short value;
switch (StatusValue())
{
case DBStatus.S_OK:
value = Value_I2();
break;
case NativeDBType.I1:
- value = (Int16)Value_I1();
+ value = (short)Value_I1();
break;
case NativeDBType.VARIANT:
object variant = ValueVariant();
- if (variant is SByte)
+ if (variant is sbyte)
{
- value = (Int16)(SByte)variant;
+ value = (short)(sbyte)variant;
}
else
{
- value = (Int16)variant;
+ value = (short)variant;
}
break;
default:
}
break;
default:
- throw CheckTypeValueStatusValue(typeof(Int16));
+ throw CheckTypeValueStatusValue(typeof(short));
}
return value;
}
- internal Int32 ValueInt32()
+ internal int ValueInt32()
{
- Int32 value;
+ int value;
switch (StatusValue())
{
case DBStatus.S_OK:
value = Value_I4();
break;
case NativeDBType.UI2:
- value = (Int32)Value_UI2();
+ value = (int)Value_UI2();
break;
case NativeDBType.VARIANT:
object variant = ValueVariant();
- if (variant is UInt16)
+ if (variant is ushort)
{
- value = (Int32)(UInt16)variant;
+ value = (int)(ushort)variant;
}
else
{
- value = (Int32)variant;
+ value = (int)variant;
}
break;
default:
}
break;
default:
- throw CheckTypeValueStatusValue(typeof(Int32));
+ throw CheckTypeValueStatusValue(typeof(int));
}
return value;
}
- internal Int64 ValueInt64()
+ internal long ValueInt64()
{
- Int64 value;
+ long value;
switch (StatusValue())
{
case DBStatus.S_OK:
value = Value_I8();
break;
case NativeDBType.UI4:
- value = (Int64)Value_UI4();
+ value = (long)Value_UI4();
break;
case NativeDBType.VARIANT:
object variant = ValueVariant();
- if (variant is UInt32)
+ if (variant is uint)
{
- value = (Int64)(UInt32)variant;
+ value = (long)(uint)variant;
}
else
{
- value = (Int64)variant;
+ value = (long)variant;
}
break;
default:
}
break;
default:
- throw CheckTypeValueStatusValue(typeof(Int64));
+ throw CheckTypeValueStatusValue(typeof(long));
}
return value;
}
- internal Single ValueSingle()
+ internal float ValueSingle()
{
- Single value;
+ float value;
switch (StatusValue())
{
case DBStatus.S_OK:
value = Value_R4();
break;
case NativeDBType.VARIANT:
- value = (Single)ValueVariant();
+ value = (float)ValueVariant();
break;
default:
throw ODB.ConversionRequired();
}
break;
default:
- throw CheckTypeValueStatusValue(typeof(Single));
+ throw CheckTypeValueStatusValue(typeof(float));
}
return value;
}
- internal Double ValueDouble()
+ internal double ValueDouble()
{
- Double value;
+ double value;
switch (StatusValue())
{
case DBStatus.S_OK:
value = Value_R8();
break;
case NativeDBType.VARIANT:
- value = (Double)ValueVariant();
+ value = (double)ValueVariant();
break;
default:
throw ODB.ConversionRequired();
}
break;
default:
- throw CheckTypeValueStatusValue(typeof(Double));
+ throw CheckTypeValueStatusValue(typeof(double));
}
return value;
}
internal string ValueString()
{
- string value = (String)_value;
+ string value = (string)_value;
if (null == value)
{
switch (StatusValue())
value = Value_BSTR(); // String
break;
case NativeDBType.VARIANT:
- value = (String)ValueVariant(); // Object
+ value = (string)ValueVariant(); // Object
break;
case NativeDBType.WSTR:
value = Value_WSTR(); // String
}
break;
default:
- throw CheckTypeValueStatusValue(typeof(String));
+ throw CheckTypeValueStatusValue(typeof(string));
}
_value = value;
}
namespace System.Data.OleDb
{
- sealed internal class Bindings
+ internal sealed class Bindings
{
private readonly tagDBPARAMBINDINFO[] _bindInfo;
private readonly tagDBBINDING[] _dbbindings;
if (useOdbcRules)
{
if ((0 < keyValue.Length) &&
- (('{' == keyValue[0]) || (0 <= keyValue.IndexOf(';')) || (0 == String.Compare(DbConnectionStringKeywords.Driver, keyName, StringComparison.OrdinalIgnoreCase))) &&
+ (('{' == keyValue[0]) || (0 <= keyValue.IndexOf(';')) || (0 == string.Compare(DbConnectionStringKeywords.Driver, keyName, StringComparison.OrdinalIgnoreCase))) &&
!ConnectionStringQuoteOdbcValueRegex.IsMatch(keyValue))
{
// always quote Driver value (required for ODBC Version 2.65 and earlier)
{
try
{
- return System.Int32.Parse(stringValue, System.Globalization.NumberStyles.Integer, CultureInfo.InvariantCulture);
+ return int.Parse(stringValue, System.Globalization.NumberStyles.Integer, CultureInfo.InvariantCulture);
}
catch (FormatException e)
{
static private string GetKeyName(StringBuilder buffer)
{
int count = buffer.Length;
- while ((0 < count) && Char.IsWhiteSpace(buffer[count - 1]))
+ while ((0 < count) && char.IsWhiteSpace(buffer[count - 1]))
{
count--; // trailing whitespace
}
int index = 0;
if (trimWhitespace)
{
- while ((index < count) && Char.IsWhiteSpace(buffer[index]))
+ while ((index < count) && char.IsWhiteSpace(buffer[index]))
{
index++; // leading whitespace
}
- while ((0 < count) && Char.IsWhiteSpace(buffer[count - 1]))
+ while ((0 < count) && char.IsWhiteSpace(buffer[count - 1]))
{
count--; // trailing whitespace
}
switch (parserState)
{
case ParserState.NothingYet: // [\\s;]*
- if ((';' == currentChar) || Char.IsWhiteSpace(currentChar))
+ if ((';' == currentChar) || char.IsWhiteSpace(currentChar))
{
continue;
}
if ('\0' == currentChar)
{ parserState = ParserState.NullTermination; continue; }
- if (Char.IsControl(currentChar))
+ if (char.IsControl(currentChar))
{ throw ADP.ConnectionStringSyntax(startposition); }
startposition = currentPosition;
if ('=' != currentChar)
case ParserState.Key: // (?<key>([^=\\s\\p{Cc}]|\\s+[^=\\s\\p{Cc}]|\\s+==|==)+)
if ('=' == currentChar)
{ parserState = ParserState.KeyEqual; continue; }
- if (Char.IsWhiteSpace(currentChar))
+ if (char.IsWhiteSpace(currentChar))
{ break; }
- if (Char.IsControl(currentChar))
+ if (char.IsControl(currentChar))
{ throw ADP.ConnectionStringSyntax(startposition); }
break;
goto case ParserState.KeyEnd;
case ParserState.KeyEnd:
- if (Char.IsWhiteSpace(currentChar))
+ if (char.IsWhiteSpace(currentChar))
{ continue; }
if (useOdbcRules)
{
{ goto ParserExit; }
if ('\0' == currentChar)
{ goto ParserExit; }
- if (Char.IsControl(currentChar))
+ if (char.IsControl(currentChar))
{ throw ADP.ConnectionStringSyntax(startposition); }
parserState = ParserState.UnquotedValue;
break;
case ParserState.UnquotedValue: // "((?![\"'\\s])" + "([^;\\s\\p{Cc}]|\\s+[^;\\s\\p{Cc}])*" + "(?<![\"']))"
- if (Char.IsWhiteSpace(currentChar))
+ if (char.IsWhiteSpace(currentChar))
{ break; }
- if (Char.IsControl(currentChar) || ';' == currentChar)
+ if (char.IsControl(currentChar) || ';' == currentChar)
{ goto ParserExit; }
break;
goto case ParserState.QuotedValueEnd;
case ParserState.QuotedValueEnd:
- if (Char.IsWhiteSpace(currentChar))
+ if (char.IsWhiteSpace(currentChar))
{ continue; }
if (';' == currentChar)
{ goto ParserExit; }
case ParserState.NullTermination: // [\\s;\u0000]*
if ('\0' == currentChar)
{ continue; }
- if (Char.IsWhiteSpace(currentChar))
+ if (char.IsWhiteSpace(currentChar))
{ continue; }
throw ADP.ConnectionStringSyntax(currentPosition);
{
#if DEBUG
bool compValue = ConnectionStringValidKeyRegex.IsMatch(keyname);
- Debug.Assert(((0 < keyname.Length) && (';' != keyname[0]) && !Char.IsWhiteSpace(keyname[0]) && (-1 == keyname.IndexOf('\u0000'))) == compValue, "IsValueValid mismatch with regex");
+ Debug.Assert(((0 < keyname.Length) && (';' != keyname[0]) && !char.IsWhiteSpace(keyname[0]) && (-1 == keyname.IndexOf('\u0000'))) == compValue, "IsValueValid mismatch with regex");
#endif
- return ((0 < keyname.Length) && (';' != keyname[0]) && !Char.IsWhiteSpace(keyname[0]) && (-1 == keyname.IndexOf('\u0000')));
+ return ((0 < keyname.Length) && (';' != keyname[0]) && !char.IsWhiteSpace(keyname[0]) && (-1 == keyname.IndexOf('\u0000')));
}
return false;
}
get { return false; }
}
- Object System.Collections.ICollection.SyncRoot
+ object System.Collections.ICollection.SyncRoot
{
get { return _items; }
}
}
}
- Object System.Collections.IEnumerator.Current
+ object System.Collections.IEnumerator.Current
{
get
{
else if (StringComparer.OrdinalIgnoreCase.Equals(tmp, "false") || StringComparer.OrdinalIgnoreCase.Equals(tmp, "no"))
return false;
}
- return Boolean.Parse(svalue);
+ return bool.Parse(svalue);
}
try
{
}
catch (InvalidCastException e)
{
- throw ADP.ConvertFailed(value.GetType(), typeof(Boolean), e);
+ throw ADP.ConvertFailed(value.GetType(), typeof(bool), e);
}
}
}
catch (InvalidCastException e)
{
- throw ADP.ConvertFailed(value.GetType(), typeof(Int32), e);
+ throw ADP.ConvertFailed(value.GetType(), typeof(int), e);
}
}
}
catch (InvalidCastException e)
{
- throw ADP.ConvertFailed(value.GetType(), typeof(String), e);
+ throw ADP.ConvertFailed(value.GetType(), typeof(string), e);
}
}
}
private byte ValuePrecisionCore(object value)
{ // V1.2.3300
- if (value is Decimal)
+ if (value is decimal)
{
- return ((System.Data.SqlTypes.SqlDecimal)(Decimal)value).Precision;
+ return ((System.Data.SqlTypes.SqlDecimal)(decimal)value).Precision;
}
return 0;
}
private byte ValueScaleCore(object value)
{ // V1.2.3300
- if (value is Decimal)
+ if (value is decimal)
{
- return (byte)((Decimal.GetBits((Decimal)value)[3] & 0x00ff0000) >> 0x10);
+ return (byte)((decimal.GetBits((decimal)value)[3] & 0x00ff0000) >> 0x10);
}
return 0;
}
namespace System.Data.OleDb
{
- sealed internal class DBPropSet : SafeHandle
+ internal sealed class DBPropSet : SafeHandle
{
- private readonly Int32 propertySetCount;
+ private readonly int propertySetCount;
// stores the exception with last error.HRESULT from IDBProperties.GetProperties
private Exception lastErrorFromProvider;
{
// note: OleDbHResult is actually a simple wrapper over HRESULT with OLEDB-specific codes
UnsafeNativeMethods.IErrorInfo errorInfo = null;
- string message = String.Empty;
+ string message = string.Empty;
OleDbHResult errorInfoHr = UnsafeNativeMethods.GetErrorInfo(0, out errorInfo); // 0 - IErrorInfo exists, 1 - no IErrorInfo
if ((errorInfoHr == OleDbHResult.S_OK) && (errorInfo != null))
void JoinTransaction(
[In, MarshalAs(UnmanagedType.Interface)] object punkTransactionCoord,
- [In] Int32 isoLevel,
- [In] Int32 isoFlags,
+ [In] int isoLevel,
+ [In] int isoFlags,
[In] IntPtr pOtherOptions);
}
{
OleDbHResult hr;
- String commandText = ExpandCommandText();
+ string commandText = ExpandCommandText();
hr = _icommandText.SetCommandText(ref ODB.DBGUID_DEFAULT, commandText);
string quotePrefix, quoteSuffix;
connection.GetLiteralQuotes(ADP.DeriveParameters, out quotePrefix, out quoteSuffix);
- Object[] parsed = MultipartIdentifier.ParseMultipartIdentifier(command.CommandText, quotePrefix, quoteSuffix, '.', 4, true, SR.OLEDB_OLEDBCommandText, false);
+ object[] parsed = MultipartIdentifier.ParseMultipartIdentifier(command.CommandText, quotePrefix, quoteSuffix, '.', 4, true, SR.OLEDB_OLEDBCommandText, false);
if (null == parsed[3])
{
throw ADP.NoStoredProcedureExists(command.CommandText);
}
- Object[] restrictions = new object[4];
+ object[] restrictions = new object[4];
object value;
// Parse returns an enforced 4 part array
if ((null != numericPrecision) && !dataRow.IsNull(numericPrecision, DataRowVersion.Default))
{
// @devnote: unguarded cast from Int16 to Byte
- parameter.PrecisionInternal = (Byte)Convert.ToInt16(dataRow[numericPrecision], CultureInfo.InvariantCulture);
+ parameter.PrecisionInternal = (byte)Convert.ToInt16(dataRow[numericPrecision], CultureInfo.InvariantCulture);
}
if ((null != numericScale) && !dataRow.IsNull(numericScale, DataRowVersion.Default))
{
// @devnote: unguarded cast from Int16 to Byte
- parameter.ScaleInternal = (Byte)Convert.ToInt16(dataRow[numericScale], CultureInfo.InvariantCulture);
+ parameter.ScaleInternal = (byte)Convert.ToInt16(dataRow[numericScale], CultureInfo.InvariantCulture);
}
break;
case OleDbType.VarBinary:
}
if ((0 == plist.Length) && connection.SupportSchemaRowset(OleDbSchemaGuid.Procedures))
{
- restrictions = new Object[4] { null, null, command.CommandText, null };
+ restrictions = new object[4] { null, null, command.CommandText, null };
table = connection.GetSchemaRowset(OleDbSchemaGuid.Procedures, restrictions);
if (0 == table.Rows.Count)
{
}
else if (connection.SupportSchemaRowset(OleDbSchemaGuid.Procedures))
{
- Object[] restrictions = new Object[4] { null, null, command.CommandText, null };
+ object[] restrictions = new object[4] { null, null, command.CommandText, null };
DataTable table = connection.GetSchemaRowset(OleDbSchemaGuid.Procedures, restrictions);
if (0 == table.Rows.Count)
{
}
}
- String unquotedIdentifier;
+ string unquotedIdentifier;
// ignoring the return value because it is acceptable for the quotedString to not be quoted in this
// context.
ADP.RemoveStringQuotes(quotePrefix, quoteSuffix, quotedIdentifier, out unquotedIdentifier);
Browsable(true),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
]
- public String Provider
+ public string Provider
{
get
{
if (IsOpen)
{
object value = GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, ODB.DBPROP_CONNECTIONSTATUS);
- if (value is Int32)
+ if (value is int)
{
int connectionStatus = (int)value;
switch (connectionStatus)
int quotedIdentifierCase;
object value = GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, ODB.DBPROP_QUOTEDIDENTIFIERCASE);
- if (value is Int32)
+ if (value is int)
{// not OleDbPropertyStatus
quotedIdentifierCase = (int)value;
}
namespace System.Data.OleDb
{
- sealed internal class OleDbConnectionFactory : DbConnectionFactory
+ internal sealed class OleDbConnectionFactory : DbConnectionFactory
{
private OleDbConnectionFactory() : base() { }
// At this time, the OleDb Managed Provider doesn't have any connection pool
NameValueCollection settings = (NameValueCollection)ConfigurationManager.GetSection("system.data.oledb");
Stream XMLStream = null;
- String providerFileName = oleDbOuterConnection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, ODB.DBPROP_PROVIDERFILENAME) as string;
+ string providerFileName = oleDbOuterConnection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, ODB.DBPROP_PROVIDERFILENAME) as string;
if (settings != null)
{
{
using SysTx = Transactions;
- sealed internal class OleDbConnectionInternal : DbConnectionInternal, IDisposable
+ internal sealed class OleDbConnectionInternal : DbConnectionInternal, IDisposable
{
static private volatile OleDbServicesWrapper idataInitialize;
static private object dataInitializeLock = new object();
DataTable table = new DataTable("DbInfoLiterals");
table.Locale = CultureInfo.InvariantCulture;
- DataColumn literalName = new DataColumn("LiteralName", typeof(String));
- DataColumn literalValue = new DataColumn("LiteralValue", typeof(String));
- DataColumn invalidChars = new DataColumn("InvalidChars", typeof(String));
- DataColumn invalidStart = new DataColumn("InvalidStartingChars", typeof(String));
- DataColumn literal = new DataColumn("Literal", typeof(Int32));
- DataColumn maxlen = new DataColumn("Maxlen", typeof(Int32));
+ DataColumn literalName = new DataColumn("LiteralName", typeof(string));
+ DataColumn literalValue = new DataColumn("LiteralValue", typeof(string));
+ DataColumn invalidChars = new DataColumn("InvalidChars", typeof(string));
+ DataColumn invalidStart = new DataColumn("InvalidStartingChars", typeof(string));
+ DataColumn literal = new DataColumn("Literal", typeof(int));
+ DataColumn maxlen = new DataColumn("Maxlen", typeof(int));
table.Columns.Add(literalName);
table.Columns.Add(literalValue);
{
DataTable table = new DataTable(ODB.DbInfoKeywords);
table.Locale = CultureInfo.InvariantCulture;
- DataColumn keyword = new DataColumn(ODB.Keyword, typeof(String));
+ DataColumn keyword = new DataColumn(ODB.Keyword, typeof(string));
table.Columns.Add(keyword);
if (!AddInfoKeywordsToTable(table, keyword))
table.Locale = CultureInfo.InvariantCulture;
DataColumn schemaGuid = new DataColumn(ODB.Schema, typeof(Guid));
- DataColumn restrictionSupport = new DataColumn(ODB.RestrictionSupport, typeof(Int32));
+ DataColumn restrictionSupport = new DataColumn(ODB.RestrictionSupport, typeof(int));
table.Columns.Add(schemaGuid);
table.Columns.Add(restrictionSupport);
internal OleDbConnectionString(string connectionString, bool validate) : base(connectionString)
{
string prompt = this[KEY.Prompt];
- PossiblePrompt = ((!ADP.IsEmpty(prompt) && (0 != String.Compare(prompt, VALUES.NoPrompt, StringComparison.OrdinalIgnoreCase)))
+ PossiblePrompt = ((!ADP.IsEmpty(prompt) && (0 != string.Compare(prompt, VALUES.NoPrompt, StringComparison.OrdinalIgnoreCase)))
|| !ADP.IsEmpty(this[KEY.WindowHandle]));
if (!IsEmpty)
if (!_hasSqlSupport)
{
object value = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, ODB.DBPROP_SQLSUPPORT);
- if (value is Int32)
+ if (value is int)
{ // not OleDbPropertyStatus
sqlSupport = (int)value;
}
if (!_hasSupportMultipleResults)
{
object value = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, ODB.DBPROP_MULTIPLERESULTS);
- if (value is Int32)
+ if (value is int)
{// not OleDbPropertyStatus
supportMultipleResults = (ODB.DBPROPVAL_MR_NOTSUPPORTED != (int)value);
}
if (!UDL._PoolSizeInit)
{
object value = ADP.LocalMachineRegistryValue(UDL.Location, UDL.Pooling);
- if (value is Int32)
+ if (value is int)
{
poolsize = (int)value;
poolsize = ((0 < poolsize) ? poolsize : 0);
}
else
{
- byte[] bytes = new Byte[hdrlength];
+ byte[] bytes = new byte[hdrlength];
int count = fstream.Read(bytes, 0, bytes.Length);
if (count < hdrlength)
{
}
else
{ // please verify header before allocating memory block for connection string
- bytes = new Byte[length - hdrlength];
+ bytes = new byte[length - hdrlength];
count = fstream.Read(bytes, 0, bytes.Length);
connectionString = System.Text.Encoding.Unicode.GetString(bytes, 0, count);
}
bool hasOleDBServices = (base.ContainsKey(KEY.Ole_DB_Services) && !ADP.IsEmpty((string)base[KEY.Ole_DB_Services]));
if (!hasOleDBServices)
{ // don't touch registry if they have OLE DB Services
- string classid = (string)ADP.ClassesRootRegistryValue(progid + "\\CLSID", String.Empty);
+ string classid = (string)ADP.ClassesRootRegistryValue(progid + "\\CLSID", string.Empty);
if ((null != classid) && (0 < classid.Length))
{
// CLSID detection of 'Microsoft OLE DB Provider for ODBC Drivers'
{
info._defaultValue = "";
}
- else if (typeof(Int32) == info._type)
+ else if (typeof(int) == info._type)
{
info._defaultValue = 0;
}
- else if (typeof(Boolean) == info._type)
+ else if (typeof(bool) == info._type)
{
info._defaultValue = false;
}
string svalue = (value as string);
if (null != svalue)
{
- Int32 services;
- if (Int32.TryParse(svalue, out services))
+ int services;
+ if (int.TryParse(svalue, out services))
{
return services;
}
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
- if ((typeof(string) == destinationType) && (null != value) && (typeof(Int32) == value.GetType()))
+ if ((typeof(string) == destinationType) && (null != value) && (typeof(int) == value.GetType()))
{
return Enum.Format(typeof(OleDbServiceValues), ((OleDbServiceValues)(int)value), "G");
}
}
}
- sealed internal class OleDbConnectionStringBuilderConverter : ExpandableObjectConverter
+ internal sealed class OleDbConnectionStringBuilderConverter : ExpandableObjectConverter
{
// converter classes should have public ctor
public OleDbConnectionStringBuilderConverter()
return FillFromADODB((object)dataSet, ADODBRecordSet, srcTable, true);
}
- private int FillFromADODB(Object data, object adodb, string srcTable, bool multipleResults)
+ private int FillFromADODB(object data, object adodb, string srcTable, bool multipleResults)
{
Debug.Assert(null != data, "FillFromADODB: null data object");
Debug.Assert(null != adodb, "FillFromADODB: null ADODB");
UnsafeNativeMethods.IErrorInfo errorInfo = null;
UnsafeNativeMethods.GetErrorInfo(0, out errorInfo);
- string message = String.Empty;
+ string message = string.Empty;
if (null != errorInfo)
{
OleDbHResult hresult = ODB.GetErrorDescription(errorInfo, hr, out message);
// return base.Fill(dataTable, dataReader);
//}
- private int FillFromRecordset(Object data, UnsafeNativeMethods.ADORecordsetConstruction recordset, string srcTable, out bool incrementResultCount)
+ private int FillFromRecordset(object data, UnsafeNativeMethods.ADORecordsetConstruction recordset, string srcTable, out bool incrementResultCount)
{
incrementResultCount = false;
return 0;
}
- private int FillFromRecord(Object data, UnsafeNativeMethods.ADORecordConstruction record, string srcTable)
+ private int FillFromRecord(object data, UnsafeNativeMethods.ADORecordConstruction record, string srcTable)
{
object result = null;
try
{
UnsafeNativeMethods.IErrorInfo errorInfo = null;
UnsafeNativeMethods.GetErrorInfo(0, out errorInfo);
- string message = String.Empty;
+ string message = string.Empty;
if (null != errorInfo)
{
OleDbHResult hresult = ODB.GetErrorDescription(errorInfo, hr, out message);
}
}
- public override Int32 FieldCount
+ public override int FieldCount
{
get
{
}
}
- public override Boolean IsClosed
+ public override bool IsClosed
{
get
{ // if we have a rowset or multipleresults, we may have more to read
}
}*/
- public override object this[Int32 index]
+ public override object this[int index]
{
get
{
}
}
- public override object this[String name]
+ public override object this[string name]
{
get
{
schemaTable.Locale = CultureInfo.InvariantCulture;
schemaTable.MinimumCapacity = metadata.Length;
- DataColumn name = new DataColumn("ColumnName", typeof(System.String));
- DataColumn ordinal = new DataColumn("ColumnOrdinal", typeof(System.Int32));
- DataColumn size = new DataColumn("ColumnSize", typeof(System.Int32));
- DataColumn precision = new DataColumn("NumericPrecision", typeof(System.Int16));
- DataColumn scale = new DataColumn("NumericScale", typeof(System.Int16));
+ DataColumn name = new DataColumn("ColumnName", typeof(string));
+ DataColumn ordinal = new DataColumn("ColumnOrdinal", typeof(int));
+ DataColumn size = new DataColumn("ColumnSize", typeof(int));
+ DataColumn precision = new DataColumn("NumericPrecision", typeof(short));
+ DataColumn scale = new DataColumn("NumericScale", typeof(short));
DataColumn dataType = new DataColumn("DataType", typeof(System.Type));
- DataColumn providerType = new DataColumn("ProviderType", typeof(System.Int32));
+ DataColumn providerType = new DataColumn("ProviderType", typeof(int));
- DataColumn isLong = new DataColumn("IsLong", typeof(System.Boolean));
- DataColumn allowDBNull = new DataColumn("AllowDBNull", typeof(System.Boolean));
- DataColumn isReadOnly = new DataColumn("IsReadOnly", typeof(System.Boolean));
- DataColumn isRowVersion = new DataColumn("IsRowVersion", typeof(System.Boolean));
+ DataColumn isLong = new DataColumn("IsLong", typeof(bool));
+ DataColumn allowDBNull = new DataColumn("AllowDBNull", typeof(bool));
+ DataColumn isReadOnly = new DataColumn("IsReadOnly", typeof(bool));
+ DataColumn isRowVersion = new DataColumn("IsRowVersion", typeof(bool));
- DataColumn isUnique = new DataColumn("IsUnique", typeof(System.Boolean));
- DataColumn isKey = new DataColumn("IsKey", typeof(System.Boolean));
- DataColumn isAutoIncrement = new DataColumn("IsAutoIncrement", typeof(System.Boolean));
- DataColumn isHidden = new DataColumn("IsHidden", typeof(System.Boolean));
+ DataColumn isUnique = new DataColumn("IsUnique", typeof(bool));
+ DataColumn isKey = new DataColumn("IsKey", typeof(bool));
+ DataColumn isAutoIncrement = new DataColumn("IsAutoIncrement", typeof(bool));
+ DataColumn isHidden = new DataColumn("IsHidden", typeof(bool));
- DataColumn baseSchemaName = new DataColumn("BaseSchemaName", typeof(System.String));
- DataColumn baseCatalogName = new DataColumn("BaseCatalogName", typeof(System.String));
- DataColumn baseTableName = new DataColumn("BaseTableName", typeof(System.String));
- DataColumn baseColumnName = new DataColumn("BaseColumnName", typeof(System.String));
+ DataColumn baseSchemaName = new DataColumn("BaseSchemaName", typeof(string));
+ DataColumn baseCatalogName = new DataColumn("BaseCatalogName", typeof(string));
+ DataColumn baseTableName = new DataColumn("BaseTableName", typeof(string));
+ DataColumn baseColumnName = new DataColumn("BaseColumnName", typeof(string));
ordinal.DefaultValue = 0;
isLong.DefaultValue = false;
info.size = (int)dbColumnInfo.ulColumnSize;
#else
long maxsize = (long)dbColumnInfo.ulColumnSize;
- info.size = (((maxsize < 0) || (Int32.MaxValue < maxsize)) ? Int32.MaxValue : (int)maxsize);
+ info.size = (((maxsize < 0) || (int.MaxValue < maxsize)) ? int.MaxValue : (int)maxsize);
#endif
info.flags = dbColumnInfo.dwFlags;
info.precision = dbColumnInfo.bPrecision;
DisposeNativeRowset();
}
- public override Boolean GetBoolean(int ordinal)
+ public override bool GetBoolean(int ordinal)
{
ColumnBinding binding = GetColumnBinding(ordinal);
return binding.ValueBoolean();
}
- public override Byte GetByte(int ordinal)
+ public override byte GetByte(int ordinal)
{
ColumnBinding binding = GetColumnBinding(ordinal);
return binding.ValueByte();
}
- private ColumnBinding DoSequentialCheck(int ordinal, Int64 dataIndex, string method)
+ private ColumnBinding DoSequentialCheck(int ordinal, long dataIndex, string method)
{
ColumnBinding binding = GetColumnBinding(ordinal);
- if (dataIndex > Int32.MaxValue)
+ if (dataIndex > int.MaxValue)
{
throw ADP.InvalidSourceBufferIndex(0, dataIndex, "dataIndex");
}
return binding;
}
- public override Int64 GetBytes(int ordinal, Int64 dataIndex, byte[] buffer, Int32 bufferIndex, Int32 length)
+ public override long GetBytes(int ordinal, long dataIndex, byte[] buffer, int bufferIndex, int length)
{
ColumnBinding binding = DoSequentialCheck(ordinal, dataIndex, ADP.GetBytes);
byte[] value = binding.ValueByteArray();
return byteCount;
}
- public override Int64 GetChars(int ordinal, Int64 dataIndex, char[] buffer, Int32 bufferIndex, Int32 length)
+ public override long GetChars(int ordinal, long dataIndex, char[] buffer, int bufferIndex, int length)
{
ColumnBinding binding = DoSequentialCheck(ordinal, dataIndex, ADP.GetChars);
string value = binding.ValueString();
}
[EditorBrowsable(EditorBrowsableState.Never)]
- public override Char GetChar(int ordinal)
+ public override char GetChar(int ordinal)
{
throw ADP.NotSupported();
}
return reader;
}
- public override String GetDataTypeName(int index)
+ public override string GetDataTypeName(int index)
{
if (null != _metadata)
{
return binding.ValueDateTime();
}
- public override Decimal GetDecimal(int ordinal)
+ public override decimal GetDecimal(int ordinal)
{
ColumnBinding binding = GetColumnBinding(ordinal);
return binding.ValueDecimal();
}
- public override Double GetDouble(int ordinal)
+ public override double GetDouble(int ordinal)
{
ColumnBinding binding = GetColumnBinding(ordinal);
return binding.ValueDouble();
throw ADP.DataReaderNoData();
}
- public override Single GetFloat(int ordinal)
+ public override float GetFloat(int ordinal)
{
ColumnBinding binding = GetColumnBinding(ordinal);
return binding.ValueSingle();
return binding.ValueGuid();
}
- public override Int16 GetInt16(int ordinal)
+ public override short GetInt16(int ordinal)
{
ColumnBinding binding = GetColumnBinding(ordinal);
return binding.ValueInt16();
}
- public override Int32 GetInt32(int ordinal)
+ public override int GetInt32(int ordinal)
{
ColumnBinding binding = GetColumnBinding(ordinal);
return binding.ValueInt32();
}
- public override Int64 GetInt64(int ordinal)
+ public override long GetInt64(int ordinal)
{
ColumnBinding binding = GetColumnBinding(ordinal);
return binding.ValueInt64();
}
- public override String GetName(int index)
+ public override string GetName(int index)
{
if (null != _metadata)
{
throw ADP.DataReaderNoData();
}
- public override Int32 GetOrdinal(String name)
+ public override int GetOrdinal(string name)
{
if (null == _fieldNameLookup)
{
return _fieldNameLookup.GetOrdinal(name);
}
- public override String GetString(int ordinal)
+ public override string GetString(int ordinal)
{
ColumnBinding binding = GetColumnBinding(ordinal);
return binding.ValueString();
return value;
}
- public override Int32 GetValues(object[] values)
+ public override int GetValues(object[] values)
{
if (null == values)
{
return (condition == (condition & _commandBehavior));
}
- public override Boolean IsDBNull(int ordinal)
+ public override bool IsDBNull(int ordinal)
{
ColumnBinding binding = GetColumnBinding(ordinal);
return binding.IsValueNull();
_rowHandleFetchCount = new IntPtr(1);
object maxRows = GetPropertyValue(ODB.DBPROP_MAXROWS);
- if (maxRows is Int32)
+ if (maxRows is int)
{
_rowHandleFetchCount = new IntPtr((int)maxRows);
if ((ADP.PtrZero == _rowHandleFetchCount) || (20 <= (int)_rowHandleFetchCount))
_rowHandleFetchCount = new IntPtr(20);
}
}
- else if (maxRows is Int64)
+ else if (maxRows is long)
{
_rowHandleFetchCount = new IntPtr((long)maxRows);
if ((ADP.PtrZero == _rowHandleFetchCount) || (20 <= (long)_rowHandleFetchCount))
_nextAccessorForRetrieval++;
}
- private Int32 IndexOf(Hashtable hash, string name)
+ private int IndexOf(Hashtable hash, string name)
{
// via case sensitive search, first match with lowest ordinal matches
object index = hash[name];
// look for primary keys in the table
if (_connection.SupportSchemaRowset(OleDbSchemaGuid.Primary_Keys))
{
- Object[] restrictions = new Object[] { baseCatalogName, baseSchemaName, baseTableName };
+ object[] restrictions = new object[] { baseCatalogName, baseSchemaName, baseTableName };
keyCount = AppendSchemaPrimaryKey(baseColumnNames, restrictions);
}
if (0 != keyCount)
// look for a single unique contraint that can be upgraded
if (_connection.SupportSchemaRowset(OleDbSchemaGuid.Indexes))
{
- Object[] restrictions = new Object[] { baseCatalogName, baseSchemaName, null, null, baseTableName };
+ object[] restrictions = new object[] { baseCatalogName, baseSchemaName, null, null, baseTableName };
AppendSchemaUniqueIndexAsKey(baseColumnNames, restrictions);
}
}
List<MetaData> metainfo = new List<MetaData>();
object hiddenColumns = null;
- using (OleDbDataReader dataReader = new OleDbDataReader(_connection, _command, Int32.MinValue, 0))
+ using (OleDbDataReader dataReader = new OleDbDataReader(_connection, _command, int.MinValue, 0))
{
dataReader.InitializeIRowset(rowset, ChapterHandle.DB_NULL_HCHAPTER, IntPtr.Zero);
dataReader.BuildSchemaTableInfo(rowset, true, false);
}
int visibleCount = metainfo.Count;
- if (hiddenColumns is Int32)
+ if (hiddenColumns is int)
{
visibleCount -= (int)hiddenColumns;
}
}
}
- sealed internal class MetaData : IComparable
+ internal sealed class MetaData : IComparable
{
internal Bindings bindings;
internal ColumnBinding columnBinding;
}
}
- sealed internal class ErrorCodeConverter : Int32Converter
+ internal sealed class ErrorCodeConverter : Int32Converter
{
// converter classes should have public ctor
public ErrorCodeConverter()
{
throw ADP.ArgumentNull("destinationType");
}
- if ((destinationType == typeof(string)) && (value != null) && (value is Int32))
+ if ((destinationType == typeof(string)) && (value != null) && (value is int))
{
return ODB.ELookup((OleDbHResult)value);
}
// 3) the provider does not support the necessary schema rowset
DataColumn populationMechanism = metaDataCollectionsTable.Columns[_populationMechanism];
- if ((null == populationMechanism) || (typeof(System.String) != populationMechanism.DataType))
+ if ((null == populationMechanism) || (typeof(string) != populationMechanism.DataType))
{
throw ADP.InvalidXmlMissingColumn(DbMetaDataCollectionNames.MetaDataCollections, _populationMechanism);
}
DataColumn collectionName = metaDataCollectionsTable.Columns[_collectionName];
- if ((null == collectionName) || (typeof(System.String) != collectionName.DataType))
+ if ((null == collectionName) || (typeof(string) != collectionName.DataType))
{
throw ADP.InvalidXmlMissingColumn(DbMetaDataCollectionNames.MetaDataCollections, _collectionName);
}
if (restrictionsTable != null)
{
restrictionCollectionName = restrictionsTable.Columns[_collectionName];
- if ((null == restrictionCollectionName) || (typeof(System.String) != restrictionCollectionName.DataType))
+ if ((null == restrictionCollectionName) || (typeof(string) != restrictionCollectionName.DataType))
{
throw ADP.InvalidXmlMissingColumn(DbMetaDataCollectionNames.Restrictions, _collectionName);
}
}
- private String BuildRegularExpression(string invalidChars, string invalidStartingChars)
+ private string BuildRegularExpression(string invalidChars, string invalidStartingChars)
{
StringBuilder regularExpression = new StringBuilder("[^");
ADP.EscapeSpecialCharacters(invalidStartingChars, regularExpression);
newRow[isSearchableWithLike] = DBNull.Value;
if (DBNull.Value != sourceRow[searchable])
{
- Int64 searchableValue = (Int64)(sourceRow[searchable]);
+ long searchableValue = (long)(sourceRow[searchable]);
switch (searchableValue)
{
case ODB.DB_UNSEARCHABLE:
return reservedWordsTable;
}
- protected override DataTable PrepareCollection(String collectionName, String[] restrictions, DbConnection connection)
+ protected override DataTable PrepareCollection(string collectionName, string[] restrictions, DbConnection connection)
{
OleDbConnection oleDbConnection = (OleDbConnection)connection;
OleDbConnectionInternal oleDbInternalConnection = (OleDbConnectionInternal)(oleDbConnection.InnerConnection);
mungedRestrictions[j] = restrictions[j];
}
- UInt16 indexTypeValue;
+ ushort indexTypeValue;
if ((restrictions[indexRestrictionTypeSlot] == "DBPROPVAL_IT_BTREE") ||
(restrictions[indexRestrictionTypeSlot] == "1"))
mungedRestrictions[j] = restrictions[j];
}
- Int16 procedureTypeValue;
+ short procedureTypeValue;
if ((restrictions[procedureRestrictionTypeSlot] == "DB_PT_UNKNOWN") ||
(restrictions[procedureRestrictionTypeSlot] == "1"))
[EditorBrowsable(EditorBrowsableState.Advanced)]
public OleDbParameter(string parameterName,
OleDbType dbType, int size,
- ParameterDirection direction, Boolean isNullable,
- Byte precision, Byte scale,
+ ParameterDirection direction, bool isNullable,
+ byte precision, byte scale,
string srcColumn, DataRowVersion srcVersion,
object value) : this()
{ // V1.0 everything
public OleDbParameter(string parameterName,
OleDbType dbType, int size,
ParameterDirection direction,
- Byte precision, Byte scale,
+ byte precision, byte scale,
string sourceColumn, DataRowVersion sourceVersion, bool sourceColumnNullMapping,
object value) : this()
{ // V2.0 everything - round trip all browsable properties + precision/scale
}
}
- [DefaultValue((Byte)0)]
- public new Byte Precision
+ [DefaultValue((byte)0)]
+ public new byte Precision
{
get
{
return (0 != _precision);
}
- [DefaultValue((Byte)0)]
- public new Byte Scale
+ [DefaultValue((byte)0)]
+ public new byte Scale
{
get
{
{
if (NativeDBType.STR == dbtype.dbType)
{
- size = Int32.MaxValue;
+ size = int.MaxValue;
}
else if (NativeDBType.WSTR == dbtype.dbType)
{
- size = Int32.MaxValue / 2;
+ size = int.MaxValue / 2;
}
else
{
- size = Int32.MaxValue;
+ size = int.MaxValue;
}
}
wtype |= NativeDBType.BYREF;
}
else if ((NativeDBType.CY == destinationType.dbType) && (typeof(string) == currentType))
{
- value = Decimal.Parse((string)value, NumberStyles.Currency, (IFormatProvider)null);
+ value = decimal.Parse((string)value, NumberStyles.Currency, (IFormatProvider)null);
}
else
{
}
// implemented as nested class to take advantage of the private/protected ShouldSerializeXXX methods
- sealed internal class OleDbParameterConverter : System.ComponentModel.ExpandableObjectConverter
+ internal sealed class OleDbParameterConverter : System.ComponentModel.ExpandableObjectConverter
{
// converter classes should have public ctor
public OleDbParameterConverter()
namespace System.Data.OleDb
{
- sealed internal class OleDbPropertySetGuid
+ internal sealed class OleDbPropertySetGuid
{
private OleDbPropertySetGuid()
{
namespace System.Data.OleDb
{
- sealed internal class OleDbReferenceCollection : DbReferenceCollection
+ internal sealed class OleDbReferenceCollection : DbReferenceCollection
{
internal const int Closing = 0;
internal const int Canceling = -1;
internal IntPtr pwszDataSourceType;
internal IntPtr pwszName;
internal IntPtr ulParamSize;
- internal Int32 dwFlags;
- internal Byte bPrecision;
- internal Byte bScale;
+ internal int dwFlags;
+ internal byte bPrecision;
+ internal byte bScale;
#if DEBUG
public override string ToString()
internal IntPtr pObject;
internal IntPtr pBindExt;
- internal Int32 dwPart;
- internal Int32 dwMemOwner;
- internal Int32 eParamIO;
+ internal int dwPart;
+ internal int dwMemOwner;
+ internal int eParamIO;
internal IntPtr cbMaxLen;
- internal Int32 dwFlags;
- internal Int16 wType;
+ internal int dwFlags;
+ internal short wType;
internal byte bPrecision;
internal byte bScale;
internal IntPtr pData;
internal tagDBIDX columnid;
internal IntPtr cbDataLen;
- internal Int32 dwStatus;
+ internal int dwStatus;
internal IntPtr cbMaxLen;
internal IntPtr dwReserved;
- internal Int16 wType;
- internal Byte bPrecision;
- internal Byte bScale;
+ internal short wType;
+ internal byte bPrecision;
+ internal byte bScale;
}
#if false
internal struct tagDBIDX
{
internal Guid uGuid;
- internal Int32 eKind;
+ internal int eKind;
internal IntPtr ulPropid;
}
internal sealed class tagDBID
{
internal Guid uGuid;
- internal Int32 eKind;
+ internal int eKind;
internal IntPtr ulPropid;
}
#else
[StructLayout(LayoutKind.Sequential, Pack = 8)]
#endif
- sealed internal class tagDBLITERALINFO
+ internal sealed class tagDBLITERALINFO
{
[MarshalAs(UnmanagedType.LPWStr)]
- internal String pwszLiteralValue = null;
+ internal string pwszLiteralValue = null;
[MarshalAs(UnmanagedType.LPWStr)]
- internal String pwszInvalidChars = null;
+ internal string pwszInvalidChars = null;
[MarshalAs(UnmanagedType.LPWStr)]
- internal String pwszInvalidStartingChars = null;
+ internal string pwszInvalidStartingChars = null;
- internal Int32 it;
+ internal int it;
- internal Int32 fSupported;
+ internal int fSupported;
- internal Int32 cchMaxLen;
+ internal int cchMaxLen;
internal tagDBLITERALINFO()
{
#else
[StructLayout(LayoutKind.Sequential, Pack = 8)]
#endif
- sealed internal class tagDBPROPSET
+ internal sealed class tagDBPROPSET
{
internal IntPtr rgProperties;
- internal Int32 cProperties;
+ internal int cProperties;
internal Guid guidPropertySet;
internal tagDBPROPSET()
#else
[StructLayout(LayoutKind.Sequential, Pack = 8)]
#endif
- sealed internal class tagDBPROP
+ internal sealed class tagDBPROP
{
- internal Int32 dwPropertyID;
- internal Int32 dwOptions;
+ internal int dwPropertyID;
+ internal int dwOptions;
internal OleDbPropertyStatus dwStatus;
internal tagDBIDX columnid;
#else
[StructLayout(LayoutKind.Sequential, Pack = 8)]
#endif
- sealed internal class tagDBPARAMS
+ internal sealed class tagDBPARAMS
{
internal IntPtr pData;
- internal Int32 cParamSets;
+ internal int cParamSets;
internal IntPtr hAccessor;
internal tagDBPARAMS()
#else
[StructLayout(LayoutKind.Sequential, Pack = 8)]
#endif
- sealed internal class tagDBCOLUMNINFO
+ internal sealed class tagDBCOLUMNINFO
{
[MarshalAs(UnmanagedType.LPWStr)]
- internal String pwszName = null;
+ internal string pwszName = null;
//[MarshalAs(UnmanagedType.Interface)]
internal IntPtr pTypeInfo = (IntPtr)0;
internal IntPtr iOrdinal = (IntPtr)0;
- internal Int32 dwFlags = 0;
+ internal int dwFlags = 0;
internal IntPtr ulColumnSize = (IntPtr)0;
- internal Int16 wType = 0;
+ internal short wType = 0;
- internal Byte bPrecision = 0;
+ internal byte bPrecision = 0;
- internal Byte bScale = 0;
+ internal byte bScale = 0;
internal tagDBIDX columnid;
#else
[StructLayout(LayoutKind.Sequential, Pack = 8)]
#endif
- sealed internal class tagDBPROPINFOSET
+ internal sealed class tagDBPROPINFOSET
{
internal IntPtr rgPropertyInfos;
- internal Int32 cPropertyInfos;
+ internal int cPropertyInfos;
internal Guid guidPropertySet;
internal tagDBPROPINFOSET()
#else
[StructLayout(LayoutKind.Sequential, Pack = 8)]
#endif
- sealed internal class tagDBPROPINFO
+ internal sealed class tagDBPROPINFO
{
[MarshalAs(UnmanagedType.LPWStr)] internal string pwszDescription;
- internal Int32 dwPropertyID;
- internal Int32 dwFlags;
+ internal int dwPropertyID;
+ internal int dwFlags;
- internal Int16 vtType;
+ internal short vtType;
[MarshalAs(UnmanagedType.Struct)] internal object vValue;
internal struct tagDBPROPIDSET
{
internal IntPtr rgPropertyIDs;
- internal Int32 cPropertyIDs;
+ internal int cPropertyIDs;
internal Guid guidPropertySet;
}
}
{
// SafeHandle wrapper around 'DataLinks' object which pools the native OLE DB providers.
// expect 1 per app-domain
- sealed internal class OleDbServicesWrapper : WrappedIUnknown
+ internal sealed class OleDbServicesWrapper : WrappedIUnknown
{
// we expect to store IDataInitialize instance pointer in base.handle
// SafeHandle wrapper around 'Data Source' object which represents the connection
// expect 1 per OleDbConnectionInternal
- sealed internal class DataSourceWrapper : WrappedIUnknown
+ internal sealed class DataSourceWrapper : WrappedIUnknown
{
// we expect to store IDBInitialize instance pointer in base.handle
// SafeHandle wrapper around 'Session' object which represents the session on the connection
// expect 1 per OleDbConnectionInternal
- sealed internal class SessionWrapper : WrappedIUnknown
+ internal sealed class SessionWrapper : WrappedIUnknown
{
// base.handle will either reference the IUnknown interface or IDBCreateCommand interface
// if OleDbConnectionString.DangerousIDBCreateCommandCreateCommand exists
S_ROWSETCOLUMN = 29, // 2.6
}
- sealed internal class NativeDBType
+ internal sealed class NativeDBType
{ // from 4214.0
// Variant compatible
internal const short EMPTY = 0; //
private const string S_WLONGVARCHAR = "DBTYPE_WLONGVARCHAR"; // DBTYPE_WSTR
private const string S_XML = "DBTYPE_XML";
- static private readonly NativeDBType D_Binary = new NativeDBType(0xff, -1, true, false, OleDbType.Binary, NativeDBType.BYTES, S_BINARY, typeof(System.Byte[]), NativeDBType.BYTES, DbType.Binary); // 0
- static private readonly NativeDBType D_Boolean = new NativeDBType(0xff, 2, true, false, OleDbType.Boolean, NativeDBType.BOOL, S_BOOL, typeof(System.Boolean), NativeDBType.BOOL, DbType.Boolean); // 1 - integer2 (variant_bool)
- static private readonly NativeDBType D_BSTR = new NativeDBType(0xff, ADP.PtrSize, false, false, OleDbType.BSTR, NativeDBType.BSTR, S_BSTR, typeof(System.String), NativeDBType.BSTR, DbType.String); // 2 - integer4 (pointer)
- static private readonly NativeDBType D_Char = new NativeDBType(0xff, -1, true, false, OleDbType.Char, NativeDBType.STR, S_CHAR, typeof(System.String), NativeDBType.WSTR/*STR*/, DbType.AnsiStringFixedLength); // 3 - (ansi pointer)
- static private readonly NativeDBType D_Currency = new NativeDBType(19, 8, true, false, OleDbType.Currency, NativeDBType.CY, S_CY, typeof(System.Decimal), NativeDBType.CY, DbType.Currency); // 4 - integer8
+ static private readonly NativeDBType D_Binary = new NativeDBType(0xff, -1, true, false, OleDbType.Binary, NativeDBType.BYTES, S_BINARY, typeof(byte[]), NativeDBType.BYTES, DbType.Binary); // 0
+ static private readonly NativeDBType D_Boolean = new NativeDBType(0xff, 2, true, false, OleDbType.Boolean, NativeDBType.BOOL, S_BOOL, typeof(bool), NativeDBType.BOOL, DbType.Boolean); // 1 - integer2 (variant_bool)
+ static private readonly NativeDBType D_BSTR = new NativeDBType(0xff, ADP.PtrSize, false, false, OleDbType.BSTR, NativeDBType.BSTR, S_BSTR, typeof(string), NativeDBType.BSTR, DbType.String); // 2 - integer4 (pointer)
+ static private readonly NativeDBType D_Char = new NativeDBType(0xff, -1, true, false, OleDbType.Char, NativeDBType.STR, S_CHAR, typeof(string), NativeDBType.WSTR/*STR*/, DbType.AnsiStringFixedLength); // 3 - (ansi pointer)
+ static private readonly NativeDBType D_Currency = new NativeDBType(19, 8, true, false, OleDbType.Currency, NativeDBType.CY, S_CY, typeof(decimal), NativeDBType.CY, DbType.Currency); // 4 - integer8
static private readonly NativeDBType D_Date = new NativeDBType(0xff, 8, true, false, OleDbType.Date, NativeDBType.DATE, S_DATE, typeof(System.DateTime), NativeDBType.DATE, DbType.DateTime); // 5 - double
static private readonly NativeDBType D_DBDate = new NativeDBType(0xff, 6, true, false, OleDbType.DBDate, NativeDBType.DBDATE, S_DBDATE, typeof(System.DateTime), NativeDBType.DBDATE, DbType.Date); // 6 - (tagDBDate)
static private readonly NativeDBType D_DBTime = new NativeDBType(0xff, 6, true, false, OleDbType.DBTime, NativeDBType.DBTIME, S_DBTIME, typeof(System.TimeSpan), NativeDBType.DBTIME, DbType.Time); // 7 - (tagDBTime)
static private readonly NativeDBType D_DBTimeStamp = new NativeDBType(0xff, 16, true, false, OleDbType.DBTimeStamp, NativeDBType.DBTIMESTAMP, S_DBTIMESTAMP, typeof(System.DateTime), NativeDBType.DBTIMESTAMP, DbType.DateTime); // 8 - (tagDBTIMESTAMP)
- static private readonly NativeDBType D_Decimal = new NativeDBType(28, 16, true, false, OleDbType.Decimal, NativeDBType.DECIMAL, S_DECIMAL, typeof(System.Decimal), NativeDBType.DECIMAL, DbType.Decimal); // 9 - (tagDec)
- static private readonly NativeDBType D_Error = new NativeDBType(0xff, 4, true, false, OleDbType.Error, NativeDBType.ERROR, S_ERROR, typeof(System.Int32), NativeDBType.ERROR, DbType.Int32); // 10 - integer4
+ static private readonly NativeDBType D_Decimal = new NativeDBType(28, 16, true, false, OleDbType.Decimal, NativeDBType.DECIMAL, S_DECIMAL, typeof(decimal), NativeDBType.DECIMAL, DbType.Decimal); // 9 - (tagDec)
+ static private readonly NativeDBType D_Error = new NativeDBType(0xff, 4, true, false, OleDbType.Error, NativeDBType.ERROR, S_ERROR, typeof(int), NativeDBType.ERROR, DbType.Int32); // 10 - integer4
static private readonly NativeDBType D_Filetime = new NativeDBType(0xff, 8, true, false, OleDbType.Filetime, NativeDBType.FILETIME, S_FILETIME, typeof(System.DateTime), NativeDBType.FILETIME, DbType.DateTime); // 11 - integer8
static private readonly NativeDBType D_Guid = new NativeDBType(0xff, 16, true, false, OleDbType.Guid, NativeDBType.GUID, S_GUID, typeof(System.Guid), NativeDBType.GUID, DbType.Guid); // 12 - ubyte[16]
- static private readonly NativeDBType D_TinyInt = new NativeDBType(3, 1, true, false, OleDbType.TinyInt, NativeDBType.I1, S_I1, typeof(System.Int16), NativeDBType.I1, DbType.SByte); // 13 - integer1
- static private readonly NativeDBType D_SmallInt = new NativeDBType(5, 2, true, false, OleDbType.SmallInt, NativeDBType.I2, S_I2, typeof(System.Int16), NativeDBType.I2, DbType.Int16); // 14 - integer2
- static private readonly NativeDBType D_Integer = new NativeDBType(10, 4, true, false, OleDbType.Integer, NativeDBType.I4, S_I4, typeof(System.Int32), NativeDBType.I4, DbType.Int32); // 15 - integer4
- static private readonly NativeDBType D_BigInt = new NativeDBType(19, 8, true, false, OleDbType.BigInt, NativeDBType.I8, S_I8, typeof(System.Int64), NativeDBType.I8, DbType.Int64); // 16 - integer8
- static private readonly NativeDBType D_IDispatch = new NativeDBType(0xff, ADP.PtrSize, true, false, OleDbType.IDispatch, NativeDBType.IDISPATCH, S_IDISPATCH, typeof(System.Object), NativeDBType.IDISPATCH, DbType.Object); // 17 - integer4 (pointer)
- static private readonly NativeDBType D_IUnknown = new NativeDBType(0xff, ADP.PtrSize, true, false, OleDbType.IUnknown, NativeDBType.IUNKNOWN, S_IUNKNOWN, typeof(System.Object), NativeDBType.IUNKNOWN, DbType.Object); // 18 - integer4 (pointer)
- static private readonly NativeDBType D_LongVarBinary = new NativeDBType(0xff, -1, false, true, OleDbType.LongVarBinary, NativeDBType.BYTES, S_LONGVARBINARY, typeof(System.Byte[]), NativeDBType.BYTES, DbType.Binary); // 19
- static private readonly NativeDBType D_LongVarChar = new NativeDBType(0xff, -1, false, true, OleDbType.LongVarChar, NativeDBType.STR, S_LONGVARCHAR, typeof(System.String), NativeDBType.WSTR/*STR*/, DbType.AnsiString); // 20 - (ansi pointer)
- static private readonly NativeDBType D_Numeric = new NativeDBType(28, 19, true, false, OleDbType.Numeric, NativeDBType.NUMERIC, S_NUMERIC, typeof(System.Decimal), NativeDBType.NUMERIC, DbType.Decimal); // 21 - (tagDB_Numeric)
+ static private readonly NativeDBType D_TinyInt = new NativeDBType(3, 1, true, false, OleDbType.TinyInt, NativeDBType.I1, S_I1, typeof(short), NativeDBType.I1, DbType.SByte); // 13 - integer1
+ static private readonly NativeDBType D_SmallInt = new NativeDBType(5, 2, true, false, OleDbType.SmallInt, NativeDBType.I2, S_I2, typeof(short), NativeDBType.I2, DbType.Int16); // 14 - integer2
+ static private readonly NativeDBType D_Integer = new NativeDBType(10, 4, true, false, OleDbType.Integer, NativeDBType.I4, S_I4, typeof(int), NativeDBType.I4, DbType.Int32); // 15 - integer4
+ static private readonly NativeDBType D_BigInt = new NativeDBType(19, 8, true, false, OleDbType.BigInt, NativeDBType.I8, S_I8, typeof(long), NativeDBType.I8, DbType.Int64); // 16 - integer8
+ static private readonly NativeDBType D_IDispatch = new NativeDBType(0xff, ADP.PtrSize, true, false, OleDbType.IDispatch, NativeDBType.IDISPATCH, S_IDISPATCH, typeof(object), NativeDBType.IDISPATCH, DbType.Object); // 17 - integer4 (pointer)
+ static private readonly NativeDBType D_IUnknown = new NativeDBType(0xff, ADP.PtrSize, true, false, OleDbType.IUnknown, NativeDBType.IUNKNOWN, S_IUNKNOWN, typeof(object), NativeDBType.IUNKNOWN, DbType.Object); // 18 - integer4 (pointer)
+ static private readonly NativeDBType D_LongVarBinary = new NativeDBType(0xff, -1, false, true, OleDbType.LongVarBinary, NativeDBType.BYTES, S_LONGVARBINARY, typeof(byte[]), NativeDBType.BYTES, DbType.Binary); // 19
+ static private readonly NativeDBType D_LongVarChar = new NativeDBType(0xff, -1, false, true, OleDbType.LongVarChar, NativeDBType.STR, S_LONGVARCHAR, typeof(string), NativeDBType.WSTR/*STR*/, DbType.AnsiString); // 20 - (ansi pointer)
+ static private readonly NativeDBType D_Numeric = new NativeDBType(28, 19, true, false, OleDbType.Numeric, NativeDBType.NUMERIC, S_NUMERIC, typeof(decimal), NativeDBType.NUMERIC, DbType.Decimal); // 21 - (tagDB_Numeric)
static unsafe private readonly NativeDBType D_PropVariant = new NativeDBType(0xff, sizeof(PROPVARIANT),
- true, false, OleDbType.PropVariant, NativeDBType.PROPVARIANT, S_PROPVARIANT, typeof(System.Object), NativeDBType.VARIANT, DbType.Object); // 22
- static private readonly NativeDBType D_Single = new NativeDBType(7, 4, true, false, OleDbType.Single, NativeDBType.R4, S_R4, typeof(System.Single), NativeDBType.R4, DbType.Single); // 23 - single
- static private readonly NativeDBType D_Double = new NativeDBType(15, 8, true, false, OleDbType.Double, NativeDBType.R8, S_R8, typeof(System.Double), NativeDBType.R8, DbType.Double); // 24 - double
- static private readonly NativeDBType D_UnsignedTinyInt = new NativeDBType(3, 1, true, false, OleDbType.UnsignedTinyInt, NativeDBType.UI1, S_UI1, typeof(System.Byte), NativeDBType.UI1, DbType.Byte); // 25 - byte7
- static private readonly NativeDBType D_UnsignedSmallInt = new NativeDBType(5, 2, true, false, OleDbType.UnsignedSmallInt, NativeDBType.UI2, S_UI2, typeof(System.Int32), NativeDBType.UI2, DbType.UInt16); // 26 - unsigned integer2
- static private readonly NativeDBType D_UnsignedInt = new NativeDBType(10, 4, true, false, OleDbType.UnsignedInt, NativeDBType.UI4, S_UI4, typeof(System.Int64), NativeDBType.UI4, DbType.UInt32); // 27 - unsigned integer4
- static private readonly NativeDBType D_UnsignedBigInt = new NativeDBType(20, 8, true, false, OleDbType.UnsignedBigInt, NativeDBType.UI8, S_UI8, typeof(System.Decimal), NativeDBType.UI8, DbType.UInt64); // 28 - unsigned integer8
- static private readonly NativeDBType D_VarBinary = new NativeDBType(0xff, -1, false, false, OleDbType.VarBinary, NativeDBType.BYTES, S_VARBINARY, typeof(System.Byte[]), NativeDBType.BYTES, DbType.Binary); // 29
- static private readonly NativeDBType D_VarChar = new NativeDBType(0xff, -1, false, false, OleDbType.VarChar, NativeDBType.STR, S_VARCHAR, typeof(System.String), NativeDBType.WSTR/*STR*/, DbType.AnsiString); // 30 - (ansi pointer)
- static private readonly NativeDBType D_Variant = new NativeDBType(0xff, ODB.SizeOf_Variant, true, false, OleDbType.Variant, NativeDBType.VARIANT, S_VARIANT, typeof(System.Object), NativeDBType.VARIANT, DbType.Object); // 31 - ubyte[16] (variant)
- static private readonly NativeDBType D_VarNumeric = new NativeDBType(255, 16, true, false, OleDbType.VarNumeric, NativeDBType.VARNUMERIC, S_VARNUMERIC, typeof(System.Decimal), NativeDBType.DECIMAL, DbType.VarNumeric); // 32 - (unicode pointer)
- static private readonly NativeDBType D_WChar = new NativeDBType(0xff, -1, true, false, OleDbType.WChar, NativeDBType.WSTR, S_WCHAR, typeof(System.String), NativeDBType.WSTR, DbType.StringFixedLength); // 33 - (unicode pointer)
- static private readonly NativeDBType D_VarWChar = new NativeDBType(0xff, -1, false, false, OleDbType.VarWChar, NativeDBType.WSTR, S_WVARCHAR, typeof(System.String), NativeDBType.WSTR, DbType.String); // 34 - (unicode pointer)
- static private readonly NativeDBType D_LongVarWChar = new NativeDBType(0xff, -1, false, true, OleDbType.LongVarWChar, NativeDBType.WSTR, S_WLONGVARCHAR, typeof(System.String), NativeDBType.WSTR, DbType.String); // 35 - (unicode pointer)
+ true, false, OleDbType.PropVariant, NativeDBType.PROPVARIANT, S_PROPVARIANT, typeof(object), NativeDBType.VARIANT, DbType.Object); // 22
+ static private readonly NativeDBType D_Single = new NativeDBType(7, 4, true, false, OleDbType.Single, NativeDBType.R4, S_R4, typeof(float), NativeDBType.R4, DbType.Single); // 23 - single
+ static private readonly NativeDBType D_Double = new NativeDBType(15, 8, true, false, OleDbType.Double, NativeDBType.R8, S_R8, typeof(double), NativeDBType.R8, DbType.Double); // 24 - double
+ static private readonly NativeDBType D_UnsignedTinyInt = new NativeDBType(3, 1, true, false, OleDbType.UnsignedTinyInt, NativeDBType.UI1, S_UI1, typeof(byte), NativeDBType.UI1, DbType.Byte); // 25 - byte7
+ static private readonly NativeDBType D_UnsignedSmallInt = new NativeDBType(5, 2, true, false, OleDbType.UnsignedSmallInt, NativeDBType.UI2, S_UI2, typeof(int), NativeDBType.UI2, DbType.UInt16); // 26 - unsigned integer2
+ static private readonly NativeDBType D_UnsignedInt = new NativeDBType(10, 4, true, false, OleDbType.UnsignedInt, NativeDBType.UI4, S_UI4, typeof(long), NativeDBType.UI4, DbType.UInt32); // 27 - unsigned integer4
+ static private readonly NativeDBType D_UnsignedBigInt = new NativeDBType(20, 8, true, false, OleDbType.UnsignedBigInt, NativeDBType.UI8, S_UI8, typeof(decimal), NativeDBType.UI8, DbType.UInt64); // 28 - unsigned integer8
+ static private readonly NativeDBType D_VarBinary = new NativeDBType(0xff, -1, false, false, OleDbType.VarBinary, NativeDBType.BYTES, S_VARBINARY, typeof(byte[]), NativeDBType.BYTES, DbType.Binary); // 29
+ static private readonly NativeDBType D_VarChar = new NativeDBType(0xff, -1, false, false, OleDbType.VarChar, NativeDBType.STR, S_VARCHAR, typeof(string), NativeDBType.WSTR/*STR*/, DbType.AnsiString); // 30 - (ansi pointer)
+ static private readonly NativeDBType D_Variant = new NativeDBType(0xff, ODB.SizeOf_Variant, true, false, OleDbType.Variant, NativeDBType.VARIANT, S_VARIANT, typeof(object), NativeDBType.VARIANT, DbType.Object); // 31 - ubyte[16] (variant)
+ static private readonly NativeDBType D_VarNumeric = new NativeDBType(255, 16, true, false, OleDbType.VarNumeric, NativeDBType.VARNUMERIC, S_VARNUMERIC, typeof(decimal), NativeDBType.DECIMAL, DbType.VarNumeric); // 32 - (unicode pointer)
+ static private readonly NativeDBType D_WChar = new NativeDBType(0xff, -1, true, false, OleDbType.WChar, NativeDBType.WSTR, S_WCHAR, typeof(string), NativeDBType.WSTR, DbType.StringFixedLength); // 33 - (unicode pointer)
+ static private readonly NativeDBType D_VarWChar = new NativeDBType(0xff, -1, false, false, OleDbType.VarWChar, NativeDBType.WSTR, S_WVARCHAR, typeof(string), NativeDBType.WSTR, DbType.String); // 34 - (unicode pointer)
+ static private readonly NativeDBType D_LongVarWChar = new NativeDBType(0xff, -1, false, true, OleDbType.LongVarWChar, NativeDBType.WSTR, S_WLONGVARCHAR, typeof(string), NativeDBType.WSTR, DbType.String); // 35 - (unicode pointer)
static private readonly NativeDBType D_Chapter = new NativeDBType(0xff, ADP.PtrSize, false, false, OleDbType.Empty, NativeDBType.HCHAPTER, S_UDT, typeof(IDataReader), NativeDBType.HCHAPTER, DbType.Object); // 36 - (hierarchical chaper)
static private readonly NativeDBType D_Empty = new NativeDBType(0xff, 0, false, false, OleDbType.Empty, NativeDBType.EMPTY, "", null, NativeDBType.EMPTY, DbType.Object); // 37 - invalid param default
- static private readonly NativeDBType D_Xml = new NativeDBType(0xff, -1, false, false, OleDbType.VarWChar, NativeDBType.XML, S_XML, typeof(System.String), NativeDBType.WSTR, DbType.String); // 38 - (unicode pointer)
- static private readonly NativeDBType D_Udt = new NativeDBType(0xff, -1, false, false, OleDbType.VarBinary, NativeDBType.UDT, S_BINARY, typeof(System.Byte[]), NativeDBType.BYTES, DbType.Binary); // 39 - (unicode pointer)
+ static private readonly NativeDBType D_Xml = new NativeDBType(0xff, -1, false, false, OleDbType.VarWChar, NativeDBType.XML, S_XML, typeof(string), NativeDBType.WSTR, DbType.String); // 38 - (unicode pointer)
+ static private readonly NativeDBType D_Udt = new NativeDBType(0xff, -1, false, false, OleDbType.VarBinary, NativeDBType.UDT, S_BINARY, typeof(byte[]), NativeDBType.BYTES, DbType.Binary); // 39 - (unicode pointer)
static internal readonly NativeDBType Default = D_VarWChar;
- static internal readonly Byte MaximumDecimalPrecision = D_Decimal.maxpre;
+ static internal readonly byte MaximumDecimalPrecision = D_Decimal.maxpre;
private const int FixedDbPart = /*DBPART_VALUE*/0x1 | /*DBPART_STATUS*/0x4;
private const int VarblDbPart = /*DBPART_VALUE*/0x1 | /*DBPART_LENGTH*/0x2 | /*DBPART_STATUS*/0x4;
internal readonly int dbPart; // the DBPart w or w/out length
internal readonly bool isfixed; // IsFixedLength
internal readonly bool islong; // IsLongLength
- internal readonly Byte maxpre; // maxium precision for numeric types // $CONSIDER - are we going to use this?
+ internal readonly byte maxpre; // maxium precision for numeric types // $CONSIDER - are we going to use this?
internal readonly int fixlen; // fixed length size in bytes (-1 for variable)
- internal readonly String dataSourceType; // ICommandWithParameters.SetParameterInfo standard type name
+ internal readonly string dataSourceType; // ICommandWithParameters.SetParameterInfo standard type name
internal readonly StringMemHandle dbString; // ptr to native allocated memory for dataSourceType string
- private NativeDBType(Byte maxpre, int fixlen, bool isfixed, bool islong, OleDbType enumOleDbType, short dbType, string dbstring, Type dataType, short wType, DbType enumDbType)
+ private NativeDBType(byte maxpre, int fixlen, bool isfixed, bool islong, OleDbType enumOleDbType, short dbType, string dbstring, Type dataType, short wType, DbType enumDbType)
{
this.enumOleDbType = enumOleDbType;
this.dbType = dbType;
throw ADP.UnknownDataTypeCode(value.GetType(), ic.GetTypeCode());
}
}
- else if (value is System.Byte[])
+ else if (value is byte[])
{
return NativeDBType.D_VarBinary;
}
{
StringBuilder builder = new StringBuilder();
builder.Append(hr.ToString());
- if ((0 < builder.Length) && Char.IsDigit(builder[0]))
+ if ((0 < builder.Length) && char.IsDigit(builder[0]))
{
builder.Length = 0;
}
namespace System.Data.OleDb
{
- sealed internal class OleDbPropertyInfo
+ internal sealed class OleDbPropertyInfo
{
public Guid _propertySet;
- public Int32 _propertyID;
+ public int _propertyID;
public string _description;
public string _lowercase;
public Type _type;
case VarEnum.VT_NULL:
return typeof(System.DBNull);
case VarEnum.VT_I2:
- return typeof(System.Int16);
+ return typeof(short);
case VarEnum.VT_I4:
- return typeof(System.Int32);
+ return typeof(int);
case VarEnum.VT_R4:
- return typeof(System.Single);
+ return typeof(float);
case VarEnum.VT_R8:
- return typeof(System.Double);
+ return typeof(double);
case VarEnum.VT_CY:
- return typeof(System.Decimal);
+ return typeof(decimal);
case VarEnum.VT_DATE:
return typeof(System.DateTime);
case VarEnum.VT_BSTR:
- return typeof(System.String);
+ return typeof(string);
case VarEnum.VT_DISPATCH:
- return typeof(System.Object);
+ return typeof(object);
case VarEnum.VT_ERROR:
- return typeof(System.Int32);
+ return typeof(int);
case VarEnum.VT_BOOL:
- return typeof(System.Boolean);
+ return typeof(bool);
case VarEnum.VT_VARIANT:
- return typeof(System.Object);
+ return typeof(object);
case VarEnum.VT_UNKNOWN:
- return typeof(System.Object);
+ return typeof(object);
case VarEnum.VT_DECIMAL:
- return typeof(System.Decimal);
+ return typeof(decimal);
case VarEnum.VT_I1:
- return typeof(System.SByte);
+ return typeof(sbyte);
case VarEnum.VT_UI1:
- return typeof(System.Byte);
+ return typeof(byte);
case VarEnum.VT_UI2:
- return typeof(System.UInt16);
+ return typeof(ushort);
case VarEnum.VT_UI4:
- return typeof(System.UInt32);
+ return typeof(uint);
case VarEnum.VT_I8:
- return typeof(System.Int64);
+ return typeof(long);
case VarEnum.VT_UI8:
- return typeof(System.UInt64);
+ return typeof(ulong);
case VarEnum.VT_INT:
- return typeof(System.Int32);
+ return typeof(int);
case VarEnum.VT_UINT:
- return typeof(System.UInt32);
+ return typeof(uint);
default:
- return typeof(System.Object);
+ return typeof(object);
}
}
}
namespace System.Data.OleDb
{
- sealed internal class RowBinding : System.Data.ProviderBase.DbBuffer
+ internal sealed class RowBinding : System.Data.ProviderBase.DbBuffer
{
private readonly int _bindingCount;
private readonly int _headerLength;
/// LARGE_INTEGER
/// </summary>
[FieldOffset(0)]
- internal Int64 hVal;
+ internal long hVal;
/// <summary>
/// ULARGE_INTEGER
/// </summary>
[FieldOffset(0)]
- internal UInt64 uhVal;
+ internal ulong uhVal;
/// <summary>
/// FLOAT
internal class NativeOledbWrapper
{
- internal unsafe static OleDbHResult IChapteredRowsetReleaseChapter(System.IntPtr ptr, System.IntPtr chapter)
+ internal static unsafe OleDbHResult IChapteredRowsetReleaseChapter(System.IntPtr ptr, System.IntPtr chapter)
{
OleDbHResult hr = OleDbHResult.E_UNEXPECTED;
IntPtr hchapter = chapter;
return hr;
}
- internal unsafe static OleDbHResult ITransactionAbort(System.IntPtr ptr)
+ internal static unsafe OleDbHResult ITransactionAbort(System.IntPtr ptr)
{
OleDbHResult hr = OleDbHResult.E_UNEXPECTED;
ITransactionLocal transactionLocal = null;
return hr;
}
- internal unsafe static OleDbHResult ITransactionCommit(System.IntPtr ptr)
+ internal static unsafe OleDbHResult ITransactionCommit(System.IntPtr ptr)
{
OleDbHResult hr = OleDbHResult.E_UNEXPECTED;
ITransactionLocal transactionLocal = null;
return hr;
}
- internal static bool MemoryCompare(System.IntPtr buf1, System.IntPtr buf2, System.Int32 count)
+ internal static bool MemoryCompare(System.IntPtr buf1, System.IntPtr buf2, int count)
{
Debug.Assert(buf1 != buf2, "buf1 and buf2 are the same");
Debug.Assert(buf1.ToInt64() < buf2.ToInt64() || buf2.ToInt64() + count <= buf1.ToInt64(), "overlapping region buf1");
}
}
- internal static void MemoryCopy(System.IntPtr dst, System.IntPtr src, System.Int32 count)
+ internal static void MemoryCopy(System.IntPtr dst, System.IntPtr src, int count)
{
Debug.Assert(dst != src, "dst and src are the same");
Debug.Assert(dst.ToInt64() < src.ToInt64() || src.ToInt64() + count <= dst.ToInt64(), "overlapping region dst");
static internal extern IntPtr LocalFree(IntPtr handle);
[DllImport(Interop.Libraries.OleAut32, CharSet = CharSet.Unicode)]
- internal static extern IntPtr SysAllocStringLen(String src, int len); // BSTR
+ internal static extern IntPtr SysAllocStringLen(string src, int len); // BSTR
[DllImport(Interop.Libraries.OleAut32)]
internal static extern void SysFreeString(IntPtr bstr);
// only using this to clear existing error info with null
[DllImport(Interop.Libraries.OleAut32, CharSet = CharSet.Unicode, PreserveSig = false)]
// TLS values are preserved between threads, need to check that we use this API to clear the error state only.
- static private extern void SetErrorInfo(Int32 dwReserved, IntPtr pIErrorInfo);
+ static private extern void SetErrorInfo(int dwReserved, IntPtr pIErrorInfo);
[DllImport(Interop.Libraries.Kernel32, SetLastError = true)]
static internal extern int ReleaseSemaphore(IntPtr handle, int releaseCount, IntPtr previousCount);
[DllImport(Interop.Libraries.OleAut32, PreserveSig = false)]
static internal extern void VariantClear(IntPtr pObject);
- sealed internal class Wrapper
+ internal sealed class Wrapper
{
private Wrapper() { }
return FileVersionInfo.GetVersionInfo(filename);
}
- static internal Stream GetXmlStreamFromValues(String[] values, String errorString)
+ static internal Stream GetXmlStreamFromValues(string[] values, string errorString)
{
if (values.Length != 1)
{
// metadata files are opened from <.NetRuntimeFolder>\CONFIG\<metadatafilename.xml>
// this operation is safe in SxS because the file is opened in read-only mode and each NDP runtime accesses its own copy of the metadata
// under the runtime folder.
- static internal Stream GetXmlStream(String value, String errorString)
+ static internal Stream GetXmlStream(string value, string errorString)
{
Stream XmlStream;
const string config = "config\\";
tempstring.Append(rootPath);
tempstring.Append(config);
tempstring.Append(value);
- String fullPath = tempstring.ToString();
+ string fullPath = tempstring.ToString();
// don't allow relative paths
if (ADP.GetFullPath(fullPath) != fullPath)
else
{
string[] parts = version.Split('.');
- major = Int32.Parse(parts[0], NumberStyles.None, CultureInfo.InvariantCulture);
- minor = Int32.Parse(parts[1], NumberStyles.None, CultureInfo.InvariantCulture);
- build = Int32.Parse(parts[2], NumberStyles.None, CultureInfo.InvariantCulture);
- Int32.Parse(parts[3], NumberStyles.None, CultureInfo.InvariantCulture);
+ major = int.Parse(parts[0], NumberStyles.None, CultureInfo.InvariantCulture);
+ minor = int.Parse(parts[1], NumberStyles.None, CultureInfo.InvariantCulture);
+ build = int.Parse(parts[2], NumberStyles.None, CultureInfo.InvariantCulture);
+ int.Parse(parts[3], NumberStyles.None, CultureInfo.InvariantCulture);
}
}
catch (Exception e)
// the return value is true if the string was quoted and false if it was not
// this allows the caller to determine if it is an error or not for the quotedString to not be quoted
- static internal Boolean RemoveStringQuotes(string quotePrefix, string quoteSuffix, string quotedString, out string unquotedString)
+ static internal bool RemoveStringQuotes(string quotePrefix, string quoteSuffix, string quotedString, out string unquotedString)
{
int prefixLength;
if (quotePrefix == null)
return true;
}
- static internal IntPtr IntPtrOffset(IntPtr pbase, Int32 offset)
+ static internal IntPtr IntPtrOffset(IntPtr pbase, int offset)
{
if (4 == ADP.PtrSize)
{
else
{
long lval = (long)value;
- lval = Math.Min((long)Int32.MaxValue, lval);
- lval = Math.Max((long)Int32.MinValue, lval);
+ lval = Math.Min((long)int.MaxValue, lval);
+ lval = Math.Max((long)int.MinValue, lval);
return (int)lval;
}
}
}
}
- internal String PtrToStringUni(int offset, int length)
+ internal string PtrToStringUni(int offset, int length)
{
offset += BaseOffset;
Validate(offset, 2 * length);
return destination;
}
- internal Char ReadChar(int offset)
+ internal char ReadChar(int offset)
{
short value = ReadInt16(offset);
return unchecked((char)value);
return destination;
}
- internal Double ReadDouble(int offset)
+ internal double ReadDouble(int offset)
{
- Int64 value = ReadInt64(offset);
+ long value = ReadInt64(offset);
return BitConverter.Int64BitsToDouble(value);
}
- internal Int16 ReadInt16(int offset)
+ internal short ReadInt16(int offset)
{
offset += BaseOffset;
ValidateCheck(offset, 2);
}
}
- internal Int32 ReadInt32(int offset)
+ internal int ReadInt32(int offset)
{
offset += BaseOffset;
ValidateCheck(offset, 4);
}
}
- internal Int64 ReadInt64(int offset)
+ internal long ReadInt64(int offset)
{
offset += BaseOffset;
ValidateCheck(offset, 8);
return value;
}
- internal unsafe Single ReadSingle(int offset)
+ internal unsafe float ReadSingle(int offset)
{
- Int32 value = ReadInt32(offset);
- return *(Single*)&value;
+ int value = ReadInt32(offset);
+ return *(float*)&value;
}
protected override bool ReleaseHandle()
}
}
- internal void WriteDouble(int offset, Double value)
+ internal void WriteDouble(int offset, double value)
{
WriteInt64(offset, BitConverter.DoubleToInt64Bits(value));
}
}
}
- internal unsafe void WriteSingle(int offset, Single value)
+ internal unsafe void WriteSingle(int offset, float value)
{
- WriteInt32(offset, *(Int32*)&value);
+ WriteInt32(offset, *(int*)&value);
}
internal Guid ReadGuid(int offset)
WriteInt32(offset + 12, ticks);
}
- internal Decimal ReadNumeric(int offset)
+ internal decimal ReadNumeric(int offset)
{
byte[] bits = new byte[20];
ReadBytes(offset, bits, 1, 19);
{
throw ADP.NumericToDecimalOverflow();
}
- return new Decimal(buffer);
+ return new decimal(buffer);
}
- internal void WriteNumeric(int offset, Decimal value, byte precision)
+ internal void WriteNumeric(int offset, decimal value, byte precision)
{
- int[] tmp = Decimal.GetBits(value);
+ int[] tmp = decimal.GetBits(value);
byte[] buffer = new byte[20];
buffer[1] = precision;
Buffer.BlockCopy(tmp, 14, buffer, 2, 2); // copy sign and scale
- buffer[3] = (Byte)((0 == buffer[3]) ? 1 : 0); // flip sign for native
+ buffer[3] = (byte)((0 == buffer[3]) ? 1 : 0); // flip sign for native
Buffer.BlockCopy(tmp, 0, buffer, 4, 12);
buffer[16] = 0;
buffer[17] = 0;
}
}
- sealed internal class DbConnectionClosedBusy : DbConnectionBusy
+ internal sealed class DbConnectionClosedBusy : DbConnectionBusy
{
// Closed Connection, Currently Busy - changing connection string
internal static readonly DbConnectionInternal SingletonInstance = new DbConnectionClosedBusy(); // singleton object
}
}
- sealed internal class DbConnectionOpenBusy : DbConnectionBusy
+ internal sealed class DbConnectionOpenBusy : DbConnectionBusy
{
// Open Connection, Currently Busy - closing connection
internal static readonly DbConnectionInternal SingletonInstance = new DbConnectionOpenBusy(); // singleton object
}
}
- sealed internal class DbConnectionClosedConnecting : DbConnectionBusy
+ internal sealed class DbConnectionClosedConnecting : DbConnectionBusy
{
// Closed Connection, Currently Connecting
}
}
- sealed internal class DbConnectionClosedNeverOpened : DbConnectionClosed
+ internal sealed class DbConnectionClosedNeverOpened : DbConnectionClosed
{
// Closed Connection, Has Never Been Opened
}
}
- sealed internal class DbConnectionClosedPreviouslyOpened : DbConnectionClosed
+ internal sealed class DbConnectionClosedPreviouslyOpened : DbConnectionClosed
{
// Closed Connection, Has Previously Been Opened
// native resources and GC may not happen soon enough.
// don't dispose if still holding reference in _enlistedTransaction
if (null != previousTransactionClone &&
- !Object.ReferenceEquals(previousTransactionClone, _enlistedTransaction))
+ !object.ReferenceEquals(previousTransactionClone, _enlistedTransaction))
{
previousTransactionClone.Dispose();
}
- if (null != valueClone && !Object.ReferenceEquals(valueClone, _enlistedTransaction))
+ if (null != valueClone && !object.ReferenceEquals(valueClone, _enlistedTransaction))
{
valueClone.Dispose();
}
{
using SysTx = Transactions;
- sealed internal class DbConnectionPool
+ internal sealed class DbConnectionPool
{
private enum State
{
get { return (null != _identity && DbConnectionPoolIdentity.NoIdentity != _identity); }
}
- private void CleanupCallback(Object state)
+ private void CleanupCallback(object state)
{
// Called when the cleanup-timer ticks over.
}
}
- private void ErrorCallback(Object state)
+ private void ErrorCallback(object state)
{
_errorOccurred = false;
_waitHandles.ErrorEvent.Reset();
PerformanceCounterType.NumberOfItems32);
};
- sealed internal class Counter
+ internal sealed class Counter
{
private PerformanceCounter _instance;
// to PERFMON. They recommend that we translate them as shown below, to
// prevent problems.
- result = String.Format((IFormatProvider)null, "{0}[{1}]", instanceName, pid);
+ result = string.Format((IFormatProvider)null, "{0}[{1}]", instanceName, pid);
result = result.Replace('(', '[').Replace(')', ']').Replace('#', '_').Replace('/', '_').Replace('\\', '_');
// counter instance name cannot be greater than 127
}
}
- sealed internal class DbConnectionPoolCountersNoCounters : DbConnectionPoolCounters
+ internal sealed class DbConnectionPoolCountersNoCounters : DbConnectionPoolCounters
{
public static readonly DbConnectionPoolCountersNoCounters SingletonInstance = new DbConnectionPoolCountersNoCounters();
// and once no pools remain, change state from Active->Idle->Disabled
// Once Disabled, factory can remove its reference to the pool entry
- sealed internal class DbConnectionPoolGroup
+ internal sealed class DbConnectionPoolGroup
{
private readonly DbConnectionOptions _connectionOptions;
private readonly DbConnectionPoolKey _poolKey;
namespace System.Data.ProviderBase
{
- sealed internal class DbConnectionPoolIdentity
+ internal sealed class DbConnectionPoolIdentity
{
private const int E_NotImpersonationToken = unchecked((int)0x8007051D);
private const int Win32_CheckTokenMembership = 1;
private const int Win32_CreateWellKnownSid = 5;
- static public readonly DbConnectionPoolIdentity NoIdentity = new DbConnectionPoolIdentity(String.Empty, false, true);
+ static public readonly DbConnectionPoolIdentity NoIdentity = new DbConnectionPoolIdentity(string.Empty, false, true);
private readonly string _sidString;
private readonly bool _isRestricted;
}
}
- private DataTable ExecuteCommand(DataRow requestedCollectionRow, String[] restrictions, DbConnection connection)
+ private DataTable ExecuteCommand(DataRow requestedCollectionRow, string[] restrictions, DbConnection connection)
{
DataTable metaDataCollectionsTable = _metaDataCollectionsDataSet.Tables[DbMetaDataCollectionNames.MetaDataCollections];
DataColumn populationStringColumn = metaDataCollectionsTable.Columns[_populationString];
DataTable schemaTable = null;
Debug.Assert(requestedCollectionRow != null);
- String sqlCommand = requestedCollectionRow[populationStringColumn, DataRowVersion.Current] as string;
+ string sqlCommand = requestedCollectionRow[populationStringColumn, DataRowVersion.Current] as string;
int numberOfRestrictions = (int)requestedCollectionRow[numberOfRestrictionsColumn, DataRowVersion.Current];
- String collectionName = requestedCollectionRow[collectionNameColumn, DataRowVersion.Current] as string;
+ string collectionName = requestedCollectionRow[collectionNameColumn, DataRowVersion.Current] as string;
if ((restrictions != null) && (restrictions.Length > numberOfRestrictions))
{
DataColumn collectionNameColumn = metaDataCollectionsTable.Columns[DbMetaDataColumnNames.CollectionName];
- if ((null == collectionNameColumn) || (typeof(System.String) != collectionNameColumn.DataType))
+ if ((null == collectionNameColumn) || (typeof(string) != collectionNameColumn.DataType))
{
throw ADP.InvalidXmlMissingColumn(DbMetaDataCollectionNames.MetaDataCollections, DbMetaDataColumnNames.CollectionName);
}
DataRow requestedCollectionRow = null;
- String exactCollectionName = null;
+ string exactCollectionName = null;
// find the requested collection
versionFailure = false;
_metaDataCollectionsDataSet.ReadXml(XmlStream);
}
- protected virtual DataTable PrepareCollection(String collectionName, String[] restrictions, DbConnection connection)
+ protected virtual DataTable PrepareCollection(string collectionName, string[] restrictions, DbConnection connection)
{
throw ADP.NotSupported();
}
bool result = true;
DataColumnCollection tableColumns = requestedCollectionRow.Table.Columns;
DataColumn versionColumn;
- Object version;
+ object version;
// check the minimum version first
versionColumn = tableColumns[_minimumVersion];
[DllImport(Interop.Libraries.OleAut32, CharSet = CharSet.Unicode, PreserveSig = true)]
static internal extern System.Data.OleDb.OleDbHResult GetErrorInfo(
- [In] Int32 dwReserved,
+ [In] int dwReserved,
[Out, MarshalAs(UnmanagedType.Interface)] out IErrorInfo ppIErrorInfo);
[Guid("00000567-0000-0010-8000-00AA006D2EA4"), InterfaceType(ComInterfaceType.InterfaceIsDual), ComImport, SuppressUnmanagedCodeSecurity]
[Obsolete("not used", true)] void GetBindings(/*deleted parameters signature*/);
/*[local]
- HRESULT ReleaseAccessor(
- [in] HACCESSOR hAccessor,
- [in, out, unique] DBREFCOUNT * pcRefCount
- );*/
+ HRESULT ReleaseAccessor(
+ [in] HACCESSOR hAccessor,
+ [in, out, unique] DBREFCOUNT * pcRefCount
+ );*/
[PreserveSig]
System.Data.OleDb.OleDbHResult ReleaseAccessor(
[In] IntPtr hAccessor,
internal interface IColumnsInfo
{
/*[local]
- HRESULT GetColumnInfo(
- [in, out] DBORDINAL * pcColumns,
- [out, size_is(,(ULONG)*pcColumns)] DBCOLUMNINFO ** prgInfo,
- [out] OLECHAR ** ppStringsBuffer
+ HRESULT GetColumnInfo(
+ [in, out] DBORDINAL * pcColumns,
+ [out, size_is(,(ULONG)*pcColumns)] DBCOLUMNINFO ** prgInfo,
+ [out] OLECHAR ** ppStringsBuffer
);*/
[PreserveSig]
System.Data.OleDb.OleDbHResult GetColumnInfo(
internal interface ICommandProperties
{
/*[local]
- HRESULT GetProperties(
- [in] const ULONG cPropertyIDSets,
- [in, size_is(cPropertyIDSets)] const DBPROPIDSET rgPropertyIDSets[],
- [in, out] ULONG * pcPropertySets,
- [out, size_is(,*pcPropertySets)] DBPROPSET ** prgPropertySets
- );*/
+ HRESULT GetProperties(
+ [in] const ULONG cPropertyIDSets,
+ [in, size_is(cPropertyIDSets)] const DBPROPIDSET rgPropertyIDSets[],
+ [in, out] ULONG * pcPropertySets,
+ [out, size_is(,*pcPropertySets)] DBPROPSET ** prgPropertySets
+ );*/
[PreserveSig]
System.Data.OleDb.OleDbHResult GetProperties(
[In] int cPropertyIDSets,
internal interface IDBInfo
{
/*[local]
- HRESULT GetKeywords(
- [out] LPOLESTR * ppwszKeywords
- );*/
+ HRESULT GetKeywords(
+ [out] LPOLESTR * ppwszKeywords
+ );*/
[PreserveSig]
System.Data.OleDb.OleDbHResult GetKeywords(
[Out, MarshalAs(UnmanagedType.LPWStr)] out string ppwszKeywords);
[Out, MarshalAs(UnmanagedType.Interface)] out IRowset ppRowset);
/*[local]
- HRESULT GetSchemas(
- [in, out] ULONG * pcSchemas,
- [out, size_is(,*pcSchemas)] GUID ** prgSchemas,
- [out, size_is(,*pcSchemas)] ULONG ** prgRestrictionSupport
- );*/
+ HRESULT GetSchemas(
+ [in, out] ULONG * pcSchemas,
+ [out, size_is(,*pcSchemas)] GUID ** prgSchemas,
+ [out, size_is(,*pcSchemas)] ULONG ** prgRestrictionSupport
+ );*/
[PreserveSig]
System.Data.OleDb.OleDbHResult GetSchemas(
[Out] out int pcSchemas,
[PreserveSig]
System.Data.OleDb.OleDbHResult GetCustomErrorObject( // may return E_NOINTERFACE when asking for IID_ISQLErrorInfo
- [In] Int32 ulRecordNum,
+ [In] int ulRecordNum,
[In] ref Guid riid,
[Out, MarshalAs(UnmanagedType.Interface)] out ISQLErrorInfo ppObject);
[return: MarshalAs(UnmanagedType.Interface)]
IErrorInfo GetErrorInfo(
- [In] Int32 ulRecordNum,
- [In] Int32 lcid);
+ [In] int ulRecordNum,
+ [In] int lcid);
[Obsolete("not used", true)] void GetErrorParameters(/*deleted parameter signature*/);
- Int32 GetRecordCount();
+ int GetRecordCount();
}
#if false
MIDL_INTERFACE("0c733a67-2a1c-11ce-ade5-00aa0044773d")
internal interface ISQLErrorInfo
{
[return: MarshalAs(UnmanagedType.I4)]
- Int32 GetSQLInfo(
- [Out, MarshalAs(UnmanagedType.BStr)] out String pbstrSQLState);
+ int GetSQLInfo(
+ [Out, MarshalAs(UnmanagedType.BStr)] out string pbstrSQLState);
}
[Guid("0C733A5F-2A1C-11CE-ADE5-00AA0044773D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComImport, SuppressUnmanagedCodeSecurity]
{
// set up writer
XmlWriterSettings WriterSettings = new XmlWriterSettings();
- WriterSettings.CloseOutput = false; // don't close the memory stream
+ WriterSettings.CloseOutput = false; // don't close the memory stream
WriterSettings.ConformanceLevel = ConformanceLevel.Fragment;
WriterSettings.Encoding = System.Text.Encoding.Unicode;
WriterSettings.OmitXmlDeclaration = true;
namespace System.Data.ProviderBase
{
- sealed internal partial class DbConnectionPool
+ internal sealed partial class DbConnectionPool
{
partial void CheckPoolBlockingPeriod(Exception e)
{
namespace System.Data.ProviderBase
{
- sealed internal partial class DbConnectionPool
+ internal sealed partial class DbConnectionPool
{
private enum State
{
namespace System.Data.ProviderBase
{
- sealed internal partial class DbConnectionPoolIdentity
+ internal sealed partial class DbConnectionPoolIdentity
{
public static readonly DbConnectionPoolIdentity NoIdentity = new DbConnectionPoolIdentity(string.Empty, false, true);
case TypeCode.Single: smd = new SqlMetaData(name, SqlDbType.Real); break;
case TypeCode.String:
{
- long maxLen = ((String)value).Length;
+ long maxLen = ((string)value).Length;
if (maxLen < 1) maxLen = 1;
if (x_lServerMaxUnicode < maxLen)
case TypeCode.Object:
if (dataType == typeof(byte[]))
{
- long maxLen = ((System.Byte[])value).Length;
+ long maxLen = ((byte[])value).Length;
if (maxLen < 1) maxLen = 1;
if (x_lServerMaxBinary < maxLen)
}
else if (dataType == typeof(char[]))
{
- long maxLen = ((System.Char[])value).Length;
+ long maxLen = ((char[])value).Length;
if (maxLen < 1) maxLen = 1;
if (x_lServerMaxUnicode < maxLen)
namespace System.Data.SqlClient
{
- // this structure is used for transporting packet handle references between the TdsParserStateObject
- // base class and Managed or Native implementations.
- // It prevents the native IntPtr type from being boxed and prevents the need to cast from object which loses compile time type safety
- // It carries type information so that assertions about the type of handle can be made in the implemented abstract methods
- // it is a ref struct so that it can only be used to transport the handles and not store them
+ // this structure is used for transporting packet handle references between the TdsParserStateObject
+ // base class and Managed or Native implementations.
+ // It prevents the native IntPtr type from being boxed and prevents the need to cast from object which loses compile time type safety
+ // It carries type information so that assertions about the type of handle can be made in the implemented abstract methods
+ // it is a ref struct so that it can only be used to transport the handles and not store them
- // N.B. If you change this type you must also change the version for the other platform
+ // N.B. If you change this type you must also change the version for the other platform
- internal readonly ref struct PacketHandle
+ internal readonly ref struct PacketHandle
{
public const int NativePointerType = 1;
public const int NativePacketType = 2;
ManagedPacket = managedPacket;
}
- public static PacketHandle FromManagedPacket(SNI.SNIPacket managedPacket) => new PacketHandle(managedPacket, ManagedPacketType);
- }
+ public static PacketHandle FromManagedPacket(SNI.SNIPacket managedPacket) => new PacketHandle(managedPacket, ManagedPacketType);
+ }
}
if (disposeAfterWriteAsync)
{
- Release();
+ Release();
}
// Completed
namespace System.Data.SqlClient
{
- // this structure is used for transporting packet handle references between the TdsParserStateObject
- // base class and Managed or Native implementations.
- // It carries type information so that assertions about the type of handle can be made in the
- // implemented abstract methods
- // it is a ref struct so that it can only be used to transport the handles and not store them
+ // this structure is used for transporting packet handle references between the TdsParserStateObject
+ // base class and Managed or Native implementations.
+ // It carries type information so that assertions about the type of handle can be made in the
+ // implemented abstract methods
+ // it is a ref struct so that it can only be used to transport the handles and not store them
- // N.B. If you change this type you must also change the version for the other platform
+ // N.B. If you change this type you must also change the version for the other platform
- internal readonly ref struct SessionHandle
+ internal readonly ref struct SessionHandle
{
public const int NativeHandleType = 1;
public const int ManagedHandleType = 2;
public bool IsNull => ManagedHandle is null;
- public static SessionHandle FromManagedSession(SNI.SNIHandle managedSessionHandle) => new SessionHandle(managedSessionHandle, ManagedHandleType);
- }
+ public static SessionHandle FromManagedSession(SNI.SNIHandle managedSessionHandle) => new SessionHandle(managedSessionHandle, ManagedHandleType);
+ }
}
namespace System.Data.SqlClient
{
// Caches the bytes returned from partial length prefixed datatypes, like XML
- sealed internal class SqlCachedBuffer : System.Data.SqlTypes.INullable
+ internal sealed class SqlCachedBuffer : System.Data.SqlTypes.INullable
{
public static readonly SqlCachedBuffer Null = new SqlCachedBuffer();
private const int _maxChunkSize = 2048; // Arbitrary value for chunk size. Revisit this later for better perf
namespace System.Data.SqlClient
{
- sealed internal class SqlConnectionFactory : DbConnectionFactory
+ internal sealed class SqlConnectionFactory : DbConnectionFactory
{
private SqlConnectionFactory() : base() { }
namespace System.Data.SqlClient
{
- sealed internal class SqlConnectionPoolGroupProviderInfo : DbConnectionPoolGroupProviderInfo
+ internal sealed class SqlConnectionPoolGroupProviderInfo : DbConnectionPoolGroupProviderInfo
{
private string _alias;
private string _failoverPartner;
public override bool Equals(object obj)
{
SqlConnectionPoolKey key = obj as SqlConnectionPoolKey;
- return (key != null && _credential == key._credential && ConnectionString == key.ConnectionString && Object.ReferenceEquals(_accessToken, key._accessToken));
+ return (key != null && _credential == key._credential && ConnectionString == key.ConnectionString && object.ReferenceEquals(_accessToken, key._accessToken));
}
public override int GetHashCode()
{
if (_parser.State == TdsParserState.Broken || _parser.State == TdsParserState.Closed)
{
- // Happened for DEVDIV2:180509 (SqlDataReader.ConsumeMetaData Hangs In 100% CPU Loop Forever When TdsParser._state == TdsParserState.Broken)
+ // Happened for DEVDIV2:180509 (SqlDataReader.ConsumeMetaData Hangs In 100% CPU Loop Forever When TdsParser._state == TdsParserState.Broken)
// during request for DTC address.
// NOTE: We doom connection for TdsParserState.Closed since it indicates that it is in some abnormal and unstable state, probably as a result of
// closing from another thread. In general, TdsParserState.Closed does not necessitate dooming the connection.
namespace System.Data.SqlClient
{
- sealed internal partial class SqlDelegatedTransaction : IPromotableSinglePhaseNotification
+ internal sealed partial class SqlDelegatedTransaction : IPromotableSinglePhaseNotification
{
// Get the server-side Global Transaction Id from the PromotedDTCToken
// Skip first 4 bytes since they contain the version
namespace System.Data.SqlClient
{
- sealed internal partial class SqlDelegatedTransaction : IPromotableSinglePhaseNotification
+ internal sealed partial class SqlDelegatedTransaction : IPromotableSinglePhaseNotification
{
// Get the server-side Global Transaction Id from the PromotedDTCToken
// Skip first 4 bytes since they contain the version
namespace System.Data.SqlClient
{
- sealed internal partial class SqlDelegatedTransaction : IPromotableSinglePhaseNotification
+ internal sealed partial class SqlDelegatedTransaction : IPromotableSinglePhaseNotification
{
private static int _objectTypeCount;
private readonly int _objectID = Interlocked.Increment(ref _objectTypeCount);
throw new PlatformNotSupportedException(SR.SqlFileStream_NotSupported);
}
- public SqlFileStream(string path, byte[] transactionContext, FileAccess access, FileOptions options, Int64 allocationSize)
+ public SqlFileStream(string path, byte[] transactionContext, FileAccess access, FileOptions options, long allocationSize)
{
throw new PlatformNotSupportedException(SR.SqlFileStream_NotSupported);
}
}
}
- sealed internal class SqlInternalConnectionTds : SqlInternalConnection, IDisposable
+ internal sealed class SqlInternalConnectionTds : SqlInternalConnection, IDisposable
{
// CONNECTION AND STATE VARIABLES
private readonly SqlConnectionPoolGroupProviderInfo _poolGroupProviderInfo; // will only be null when called for ChangePassword, or creating SSE User Instance
}
}
- internal protected override bool IsNonPoolableTransactionRoot
+ protected internal override bool IsNonPoolableTransactionRoot
{
get
{
Context = 5, // only valid in proc.
};
- sealed internal class SqlInternalTransaction
+ internal sealed class SqlInternalTransaction
{
internal const long NullTransactionId = 0;
{
if (value is decimal)
{
- return ((System.Data.SqlTypes.SqlDecimal)(Decimal)value).Precision;
+ return ((System.Data.SqlTypes.SqlDecimal)(decimal)value).Precision;
}
return 0;
}
namespace System.Data.SqlClient
{
- sealed internal class SqlReferenceCollection : DbReferenceCollection
+ internal sealed class SqlReferenceCollection : DbReferenceCollection
{
internal const int DataReaderTag = 1;
internal const int CommandTag = 2;
namespace System.Data.SqlClient
{
- sealed internal class SqlSequentialStream : System.IO.Stream
+ internal sealed class SqlSequentialStream : System.IO.Stream
{
private SqlDataReader _reader; // The SqlDataReader that we are reading data from
private int _columnIndex; // The index of out column in the table
namespace System.Data.SqlClient
{
- sealed internal class SqlSequentialTextReader : System.IO.TextReader
+ internal sealed class SqlSequentialTextReader : System.IO.TextReader
{
private SqlDataReader _reader; // The SqlDataReader that we are reading data from
private int _columnIndex; // The index of out column in the table
}
}
- sealed internal class SqlUnicodeEncoding : UnicodeEncoding
+ internal sealed class SqlUnicodeEncoding : UnicodeEncoding
{
private static SqlUnicodeEncoding s_singletonEncoding = new SqlUnicodeEncoding();
namespace System.Data.SqlClient
{
- sealed internal class SqlStream : Stream
+ internal sealed class SqlStream : Stream
{
private SqlDataReader _reader; // reader we will stream off
private int _columnOrdinal;
// case. This causes double buffering and is a perf hit, but this is not the high perf way for accessing this type of data.
// In the case of sequential access, we do not have to do any buffering since the XmlTextReader we return can become
// invalid as soon as we move off the current column.
- sealed internal class SqlCachedStream : Stream
+ internal sealed class SqlCachedStream : Stream
{
private int _currentPosition; // Position within the current array byte
private int _currentArrayIndex; // Index into the _cachedBytes List
}
}
- sealed internal class SqlStreamingXml
+ internal sealed class SqlStreamingXml
{
private int _columnOrdinal;
private SqlDataReader _reader;
internal const string SqlNotificationStoredProcedureDefault = "SqlQueryNotificationStoredProcedure";
}
- sealed internal class SQLMessage
+ internal sealed class SQLMessage
{
private SQLMessage() { /* prevent utility class from being instantiated*/ }
public const short SNI_WSAECONNRESET = 10054; // An existing connection was forcibly closed by the remote host.
// SNI internal errors (shouldn't overlap with Win32 / socket errors)
- public const uint SNI_QUEUE_FULL = 1048576; // Packet queue is full
+ public const uint SNI_QUEUE_FULL = 1048576; // Packet queue is full
// SNI flags
public const uint SNI_SSL_VALIDATE_CERTIFICATE = 1; // This enables validation of server certificate
{
internal sealed partial class TdsParser
{
- internal static void FillGuidBytes(Guid guid, Span<byte> buffer)
+ internal static void FillGuidBytes(Guid guid, Span<byte> buffer)
{
byte[] bytes = guid.ToByteArray();
bytes.AsSpan().CopyTo(buffer);
}
- internal static void FillDoubleBytes(double value, Span<byte> buffer)
- {
- byte[] bytes = BitConverter.GetBytes(value);
- bytes.AsSpan().CopyTo(buffer);
- }
+ internal static void FillDoubleBytes(double value, Span<byte> buffer)
+ {
+ byte[] bytes = BitConverter.GetBytes(value);
+ bytes.AsSpan().CopyTo(buffer);
+ }
- internal static void FillFloatBytes(float value, Span<byte> buffer)
- {
- byte[] bytes = BitConverter.GetBytes(value);
- bytes.AsSpan().CopyTo(buffer);
- }
+ internal static void FillFloatBytes(float value, Span<byte> buffer)
+ {
+ byte[] bytes = BitConverter.GetBytes(value);
+ bytes.AsSpan().CopyTo(buffer);
+ }
internal static Guid ConstructGuid(ReadOnlySpan<byte> bytes)
{
namespace System.Data.SqlClient
{
- sealed internal partial class TdsParser
+ internal sealed partial class TdsParser
{
internal void PostReadAsyncForMars()
{
}
} // tdsparser
-}//namespace
\ No newline at end of file
+}//namespace
if (0 != collation.sortId)
{
codePage = TdsEnums.CODE_PAGE_FROM_SORT_ID[collation.sortId];
- Debug.Assert(0 != codePage, "GetCodePage accessed codepage array and produced 0!, sortID =" + ((Byte)(collation.sortId)).ToString((IFormatProvider)null));
+ Debug.Assert(0 != codePage, "GetCodePage accessed codepage array and produced 0!, sortID =" + ((byte)(collation.sortId)).ToString((IFormatProvider)null));
}
else
{
return true;
}
}
- else if ((currentType == typeof(string)) && (((String)value).Length > 0))
+ else if ((currentType == typeof(string)) && (((string)value).Length > 0))
{
if ((value != null) && (((string)value)[0] & 0xff) != 0xff)
return true;
namespace System.Data.SqlClient
{
- sealed internal class LastIOTimer
+ internal sealed class LastIOTimer
{
internal long _value;
}
{
conn.Open();
- // select with SqlChars parameter
+ // select with SqlChars parameter
SqlCommand cmd;
SqlDataReader reader;
using (cmd = conn.CreateCommand())
}
}
- // select with SqlBytes parameter
+ // select with SqlBytes parameter
using (cmd = conn.CreateCommand())
{
cmd.CommandText = "select EmployeeID, FirstName, LastName from Employees where EmployeeID = 2 and Convert(binary(5), Photo) = @bn ";
}
- #region CommandExecute and Consume methods
+ #region CommandExecute and Consume methods
/// <summary>
/// Utility function used by command tests
#endregion
- #region Command and Parameter Tests
+ #region Command and Parameter Tests
/// <summary>
/// Command Reader Test: Executes a simple SELECT statement without parameters
/// <summary>
/// It is called when SPNEGO response arrives
/// </summary>
- /// <param name="packet">TDS message received</param>
+ /// <param name="packet">TDS message received</param>
TDSMessage OnSSPIResponse(TDSMessage message);
/// <summary>
/// It is called when FedAuthInfoToken response arrives
/// </summary>
- /// <param name="packet">TDS message received</param>
+ /// <param name="packet">TDS message received</param>
TDSMessage OnFedAuthInfoTokenResponse(TDSMessage message);
/// <summary>
/// It is called when login acknowledgement arrives.
/// </summary>
- /// <param name="packet">TDS message received</param>
+ /// <param name="packet">TDS message received</param>
void OnLoginResponse(TDSMessage message);
/// <summary>
// Check the client context for encryption state
if (Client.Context.Encryption != TDSEncryptionType.Off)
{
- // Turn on encryption before sending the response
+ // Turn on encryption before sending the response
EnableClientTransportEncryption(Client.Context.ServerHost);
}
/// <summary>
/// Inflating constructor
- /// </summary>
+ /// </summary>
public TDSLogin7FedAuthOptionToken(Stream source)
: this()
{
return randomBytes;
}
}
-}
\ No newline at end of file
+}
/// <summary>
/// Inflating constructor
- /// </summary>
+ /// </summary>
public TDSLogin7GenericOptionToken(Stream source) :
this()
{
/// <summary>
/// Inflating constructor
- /// </summary>
+ /// </summary>
public TDSLogin7SessionRecoveryOptionToken(Stream source) :
this()
{
/// <summary>
/// Initialization constructor
/// </summary>
- public TDSLogin7TokenOffsetProperty(PropertyInfo property, ushort position, ushort length)
+ public TDSLogin7TokenOffsetProperty(PropertyInfo property, ushort position, ushort length)
{
Property = property;
Position = position;
/// <summary>
/// Initialization constructor
/// </summary>
- public TDSLogin7TokenOffsetProperty(PropertyInfo property, ushort position, ushort length, bool isOffsetOffset) :
+ public TDSLogin7TokenOffsetProperty(PropertyInfo property, ushort position, ushort length, bool isOffsetOffset) :
this(property, position, length)
{
IsOffsetOffset = isOffsetOffset;
/// <summary>
/// Initialization constructor
- /// </summary>
+ /// </summary>
public TDSPreLoginToken(Version version, TDSPreLoginTokenEncryptionType encryption, bool isMARS, uint threadID, TdsPreLoginFedAuthRequiredOption fedAuthRequired) :
this(version, encryption, isMARS, threadID)
{
/// Sets the bytes in 'outBytes' to be random values. outBytes.Length must be less than or equal to 16
/// </summary>
/// <param name="outBytes"></param>
- internal unsafe static void SetToRandomBytes(Span<byte> outBytes)
+ internal static unsafe void SetToRandomBytes(Span<byte> outBytes)
{
Debug.Assert(outBytes.Length <= sizeof(Guid)); // Guid is 16 bytes, and so is TraceId
Guid guid = Guid.NewGuid();
/// <summary>
/// Create a new SpanId with at random number in it (very likely to be unique)
/// </summary>
- public unsafe static ActivitySpanId CreateRandom()
+ public static unsafe ActivitySpanId CreateRandom()
{
ulong id;
ActivityTraceId.SetToRandomBytes(new Span<byte>(&id, sizeof(ulong)));
// Write out the value characters, escaping things as needed.
foreach(var c in keyValue.Value)
{
- if (Char.IsControl(c))
+ if (char.IsControl(c))
{
if (c == '\n')
sb.Append("\\n");
private BitVector32 boolFlags = new BitVector32();
private Hashtable messageLibraries;
- private readonly static Hashtable listenerInfos = new Hashtable(StringComparer.OrdinalIgnoreCase);
+ private static readonly Hashtable listenerInfos = new Hashtable(StringComparer.OrdinalIgnoreCase);
private object m_InstanceLockObject;
private object InstanceLockObject
return pubEnum;
}
- public static EventLogHandle EvtOpenChannelConfig(EventLogHandle session, String channelPath, int flags)
+ public static EventLogHandle EvtOpenChannelConfig(EventLogHandle session, string channelPath, int flags)
{
EventLogHandle handle = UnsafeNativeMethods.EvtOpenChannelConfig(session, channelPath, flags);
int win32Error = Marshal.GetLastWin32Error();
}
public static EventLogHandle EvtCreateRenderContext(
- Int32 valuePathsCount,
- String[] valuePaths,
+ int valuePathsCount,
+ string[] valuePaths,
UnsafeNativeMethods.EvtRenderContextFlags flags)
{
EventLogHandle renderContextHandleValues = UnsafeNativeMethods.EvtCreateRenderContext(valuePathsCount, valuePaths, flags);
systemProperties.Version = (byte?)ConvertToObject(varVal, UnsafeNativeMethods.EvtVariantType.EvtVarTypeByte);
break;
}
- pointer = new IntPtr(((Int64)pointer + Marshal.SizeOf(varVal)));
+ pointer = new IntPtr(((long)pointer + Marshal.SizeOf(varVal)));
}
}
finally
{
UnsafeNativeMethods.EvtVariant varVal = Marshal.PtrToStructure<UnsafeNativeMethods.EvtVariant>(pointer);
valuesList.Add(ConvertToObject(varVal));
- pointer = new IntPtr(((Int64)pointer + Marshal.SizeOf(varVal)));
+ pointer = new IntPtr(((long)pointer + Marshal.SizeOf(varVal)));
}
}
return valuesList;
while (true)
{
string s = Marshal.PtrToStringUni(pointer);
- if (String.IsNullOrEmpty(s))
+ if (string.IsNullOrEmpty(s))
break;
keywordsList.Add(s);
// nr of bytes = # chars * 2 + 2 bytes for character '\0'.
- pointer = new IntPtr((Int64)pointer + (s.Length * 2) + 2);
+ pointer = new IntPtr((long)pointer + (s.Length * 2) + 2);
}
return keywordsList.AsReadOnly();
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeByte):
if (val.Reference == IntPtr.Zero)
return Array.Empty<byte>();
- Byte[] arByte = new Byte[val.Count];
+ byte[] arByte = new byte[val.Count];
Marshal.Copy(val.Reference, arByte, 0, (int)val.Count);
return arByte;
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeInt16):
if (val.Reference == IntPtr.Zero)
return Array.Empty<short>();
- Int16[] arInt16 = new Int16[val.Count];
+ short[] arInt16 = new short[val.Count];
Marshal.Copy(val.Reference, arInt16, 0, (int)val.Count);
return arInt16;
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeInt32):
if (val.Reference == IntPtr.Zero)
return Array.Empty<int>();
- Int32[] arInt32 = new Int32[val.Count];
+ int[] arInt32 = new int[val.Count];
Marshal.Copy(val.Reference, arInt32, 0, (int)val.Count);
return arInt32;
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeInt64):
if (val.Reference == IntPtr.Zero)
return Array.Empty<long>();
- Int64[] arInt64 = new Int64[val.Count];
+ long[] arInt64 = new long[val.Count];
Marshal.Copy(val.Reference, arInt64, 0, (int)val.Count);
return arInt64;
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeSingle):
if (val.Reference == IntPtr.Zero)
return Array.Empty<float>();
- Single[] arSingle = new Single[val.Count];
+ float[] arSingle = new float[val.Count];
Marshal.Copy(val.Reference, arSingle, 0, (int)val.Count);
return arSingle;
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeDouble):
if (val.Reference == IntPtr.Zero)
return Array.Empty<double>();
- Double[] arDouble = new Double[val.Count];
+ double[] arDouble = new double[val.Count];
Marshal.Copy(val.Reference, arDouble, 0, (int)val.Count);
return arDouble;
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeSByte):
- return ConvertToArray<SByte>(val, sizeof(SByte)); // not CLS-compliant
+ return ConvertToArray<sbyte>(val, sizeof(sbyte)); // not CLS-compliant
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeUInt16):
- return ConvertToArray<UInt16>(val, sizeof(UInt16));
+ return ConvertToArray<ushort>(val, sizeof(ushort));
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeUInt64):
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeHexInt64):
- return ConvertToArray<UInt64>(val, sizeof(UInt64));
+ return ConvertToArray<ulong>(val, sizeof(ulong));
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeUInt32):
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeHexInt32):
- return ConvertToArray<UInt32>(val, sizeof(UInt32));
+ return ConvertToArray<uint>(val, sizeof(uint));
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeString):
return ConvertToStringArray(val, false);
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeAnsiString):
for (int i = 0; i < val.Count; i++)
{
array.SetValue(Marshal.PtrToStructure<T>(ptr), i);
- ptr = new IntPtr((Int64)ptr + size);
+ ptr = new IntPtr((long)ptr + size);
}
return array;
}
{
bool value = (Marshal.ReadInt32(ptr) != 0) ? true : false;
array[i] = value;
- ptr = new IntPtr((Int64)ptr + 4);
+ ptr = new IntPtr((long)ptr + 4);
}
return array;
}
for (int i = 0; i < val.Count; i++)
{
array[i] = DateTime.FromFileTime(Marshal.ReadInt64(ptr));
- ptr = new IntPtr((Int64)ptr + 8 * sizeof(byte)); // FILETIME values are 8 bytes
+ ptr = new IntPtr((long)ptr + 8 * sizeof(byte)); // FILETIME values are 8 bytes
}
return array;
}
{
UnsafeNativeMethods.SystemTime sysTime = Marshal.PtrToStructure<UnsafeNativeMethods.SystemTime>(ptr);
array[i] = new DateTime(sysTime.Year, sysTime.Month, sysTime.Day, sysTime.Hour, sysTime.Minute, sysTime.Second, sysTime.Milliseconds);
- ptr = new IntPtr((Int64)ptr + 16 * sizeof(byte)); // SystemTime values are 16 bytes
+ ptr = new IntPtr((long)ptr + 16 * sizeof(byte)); // SystemTime values are 16 bytes
}
return array;
}
if (channelRefDisplayName == null && isImported)
{
- if (String.Compare(channelName, "Application", StringComparison.OrdinalIgnoreCase) == 0)
+ if (string.Compare(channelName, "Application", StringComparison.OrdinalIgnoreCase) == 0)
channelRefMessageId = 256;
- else if (String.Compare(channelName, "System", StringComparison.OrdinalIgnoreCase) == 0)
+ else if (string.Compare(channelName, "System", StringComparison.OrdinalIgnoreCase) == 0)
channelRefMessageId = 258;
- else if (String.Compare(channelName, "Security", StringComparison.OrdinalIgnoreCase) == 0)
+ else if (string.Compare(channelName, "Security", StringComparison.OrdinalIgnoreCase) == 0)
channelRefMessageId = 257;
else
channelRefMessageId = -1;
{
internal static partial class UnsafeNativeMethods
{
- internal const String WEVTAPI = "wevtapi.dll";
+ internal const string WEVTAPI = "wevtapi.dll";
// WinError.h codes:
internal struct EvtVariant
{
[FieldOffset(0)]
- public UInt32 UInteger;
+ public uint UInteger;
[FieldOffset(0)]
- public Int32 Integer;
+ public int Integer;
[FieldOffset(0)]
public byte UInt8;
[FieldOffset(0)]
[FieldOffset(0)]
public ushort UShort;
[FieldOffset(0)]
- public UInt32 Bool;
+ public uint Bool;
[FieldOffset(0)]
- public Byte ByteVal;
+ public byte ByteVal;
[FieldOffset(0)]
public byte SByte;
[FieldOffset(0)]
- public UInt64 ULong;
+ public ulong ULong;
[FieldOffset(0)]
- public Int64 Long;
+ public long Long;
[FieldOffset(0)]
- public Single Single;
+ public float Single;
[FieldOffset(0)]
- public Double Double;
+ public double Double;
[FieldOffset(0)]
public IntPtr StringVal;
[FieldOffset(0)]
[FieldOffset(0)]
public IntPtr GuidReference;
[FieldOffset(0)]
- public UInt64 FileTime;
+ public ulong FileTime;
[FieldOffset(0)]
public IntPtr SystemTime;
[FieldOffset(0)]
public IntPtr SizeT;
[FieldOffset(8)]
- public UInt32 Count; // number of elements (not length) in bytes.
+ public uint Count; // number of elements (not length) in bytes.
[FieldOffset(12)]
- public UInt32 Type;
+ public uint Type;
}
internal enum EvtEventPropertyId
[DllImport(WEVTAPI, CharSet = CharSet.Auto, SetLastError = true)]
internal static extern EventLogHandle EvtOpenChannelConfig(
EventLogHandle session,
- [MarshalAs(UnmanagedType.LPWStr)]String channelPath,
+ [MarshalAs(UnmanagedType.LPWStr)]string channelPath,
int flags
);
// RENDERING
[DllImport(WEVTAPI, CharSet = CharSet.Auto, SetLastError = true)]
internal static extern EventLogHandle EvtCreateRenderContext(
- Int32 valuePathsCount,
+ int valuePathsCount,
[MarshalAs(UnmanagedType.LPArray,ArraySubType = UnmanagedType.LPWStr)]
- String[] valuePaths,
+ string[] valuePaths,
[MarshalAs(UnmanagedType.I4)]EvtRenderContextFlags flags
);
[MarshalAs(UnmanagedType.LPWStr), FieldOffset(0)]
public string StringVal;
[FieldOffset(8)]
- public UInt32 Count;
+ public uint Count;
[FieldOffset(12)]
- public UInt32 Type;
+ public uint Type;
};
[DllImport(WEVTAPI, CharSet = CharSet.Auto, SetLastError = true)]
return freeMemoryOffset;
}
- private unsafe static void PopulateLifetimeEntry(ProcessLifetimeEntry* lifetimeEntry, PerformanceCounterInstanceLifetime lifetime)
+ private static unsafe void PopulateLifetimeEntry(ProcessLifetimeEntry* lifetimeEntry, PerformanceCounterInstanceLifetime lifetime)
{
if (lifetime == PerformanceCounterInstanceLifetime.Process)
return DecrementUnaligned(_counterEntryPointer);
}
- internal unsafe static void RemoveAllInstances(string categoryName)
+ internal static unsafe void RemoveAllInstances(string categoryName)
{
SharedPerformanceCounter spc = new SharedPerformanceCounter(categoryName, null, null);
spc.RemoveAllInstances();
{
string nameString = names[(index * 2) + 1];
if (nameString == null)
- nameString = String.Empty;
+ nameString = string.Empty;
int key;
- if (!Int32.TryParse(names[index * 2], NumberStyles.Integer, CultureInfo.InvariantCulture, out key))
+ if (!int.TryParse(names[index * 2], NumberStyles.Integer, CultureInfo.InvariantCulture, out key))
{
if (isHelp)
{
return (userId.Value, groupId.Value, groups);
}
- private unsafe static (uint? userId, uint? groupId) GetUserAndGroupIds(string userName)
+ private static unsafe (uint? userId, uint? groupId) GetUserAndGroupIds(string userName)
{
Interop.Sys.Passwd? passwd;
// First try with a buffer that should suffice for 99% of cases.
}
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
- private unsafe static extern int AssocQueryStringW(
+ private static extern unsafe int AssocQueryStringW(
int flags,
int str,
string pszAssoc,
char* pszOut,
ref uint pcchOut);
- private unsafe static string GetAssociationString(int flags, int str, string pszAssoc, string pszExtra)
+ private static unsafe string GetAssociationString(int flags, int str, string pszAssoc, string pszExtra)
{
uint count = 0;
int result = AssocQueryStringW(flags, str, pszAssoc, pszExtra, null, ref count);
private static extern uint getgid();
[DllImport("libc", SetLastError = true)]
- private unsafe static extern int getgroups(int size, uint* list);
+ private static extern unsafe int getgroups(int size, uint* list);
- private unsafe static HashSet<uint> GetGroups()
+ private static unsafe HashSet<uint> GetGroups()
{
int maxSize = 128;
Span<uint> groups = stackalloc uint[maxSize];
private static extern int seteuid(uint euid);
[DllImport("libc")]
- private static unsafe extern int setgroups(int length, uint* groups);
+ private static extern unsafe int setgroups(int length, uint* groups);
private const int SIGKILL = 9;
if (_initializedLock == null)
{
object o = new object();
- Interlocked.CompareExchange<Object>(ref _initializedLock, o, null);
+ Interlocked.CompareExchange<object>(ref _initializedLock, o, null);
}
return _initializedLock;
{
public class AdvancedFilters
{
- internal protected AdvancedFilters(Principal p)
+ protected internal AdvancedFilters(Principal p)
{
_p = p;
}
// Extract the group SIDs from the user's context. Determine the size of the buffer we need.
f = UnsafeNativeMethods.AuthzGetInformationFromContext(
pClientContext,
- 2, // AuthzContextInfoGroupsSids
+ 2, // AuthzContextInfoGroupsSids
0,
out bufferSize,
IntPtr.Zero
// Extract the group SIDs from the user's context, into our buffer.0
f = UnsafeNativeMethods.AuthzGetInformationFromContext(
pClientContext,
- 2, // AuthzContextInfoGroupsSids
+ 2, // AuthzContextInfoGroupsSids
bufferSize,
out bufferSize,
pBuffer
//
// Private implementation
//
- internal protected AuthenticablePrincipal(PrincipalContext context)
+ protected internal AuthenticablePrincipal(PrincipalContext context)
{
if (context == null)
throw new ArgumentException(SR.NullArguments);
this.rosf = new AdvancedFilters(this);
}
- internal protected AuthenticablePrincipal(PrincipalContext context, string samAccountName, string password, bool enabled) : this(context)
+ protected internal AuthenticablePrincipal(PrincipalContext context, string samAccountName, string password, bool enabled) : this(context)
{
if (samAccountName != null)
{
// hence the LinkDemand.
[System.ComponentModel.Browsable(false)]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
- internal protected PrincipalContext ContextRaw
+ protected internal PrincipalContext ContextRaw
{
get
{ return _ctx; }
/// Performs bytewise comparison of two byte[] arrays
/// </summary>
/// <param name="src">Array to compare</param>
- /// <param name="tgt">Array to compare against src</param>
- /// <returns>true if identical, false otherwise</returns>
+ /// <param name="tgt">Array to compare against src</param>
+ /// <returns>true if identical, false otherwise</returns>
internal static bool AreBytesEqual(byte[] src, byte[] tgt)
{
if (src.Length != tgt.Length)
);
/*
- [DllImport("authz.dll", SetLastError=true, CallingConvention=CallingConvention.StdCall, EntryPoint="AuthzInitializeContextFromToken", CharSet=CharSet.Unicode)]
+ [DllImport("authz.dll", SetLastError=true, CallingConvention=CallingConvention.StdCall, EntryPoint="AuthzInitializeContextFromToken", CharSet=CharSet.Unicode)]
static extern public bool AuthzInitializeContextFromToken(
int Flags,
IntPtr TokenHandle,
Dispose(true);
}
- // private Dispose method
+ // private Dispose method
protected virtual void Dispose(bool disposing)
{
if (!_disposed)
// syntaxes
private static int s_syntaxesCount = 23;
private static Syntax[] s_syntaxes = {/* CaseExactString */ new Syntax("2.5.5.3", 27, null),
- /* CaseIgnoreString */ new Syntax("2.5.5.4", 20, null),
- /* NumericString */ new Syntax("2.5.5.6", 18, null),
- /* DirectoryString */ new Syntax("2.5.5.12", 64, null),
- /* OctetString */ new Syntax("2.5.5.10", 4, null),
- /* SecurityDescriptor */ new Syntax("2.5.5.15", 66, null),
- /* Int */ new Syntax("2.5.5.9", 2, null),
- /* Int64 */ new Syntax("2.5.5.16", 65, null),
- /* Bool */ new Syntax("2.5.5.8", 1, null),
- /* Oid */ new Syntax("2.5.5.2", 6, null),
- /* GeneralizedTime */ new Syntax("2.5.5.11", 24, null),
- /* UtcTime */ new Syntax("2.5.5.11", 23, null),
- /* DN */ new Syntax("2.5.5.1", 127, s_dnOMObjectClass),
- /* DNWithBinary */ new Syntax("2.5.5.7", 127, s_dNWithBinaryOMObjectClass),
- /* DNWithString */ new Syntax("2.5.5.14", 127, s_dNWithStringOMObjectClass),
- /* Enumeration */ new Syntax("2.5.5.9", 10, null),
- /* IA5String */ new Syntax("2.5.5.5", 22, null),
- /* PrintableString */ new Syntax("2.5.5.5", 19, null),
- /* Sid */ new Syntax("2.5.5.17", 4, null),
- /* AccessPointDN */ new Syntax("2.5.5.14", 127, s_accessPointDnOMObjectClass),
- /* ORName */ new Syntax("2.5.5.7", 127, s_oRNameOMObjectClass),
- /* PresentationAddress */ new Syntax("2.5.5.13", 127, s_presentationAddressOMObjectClass),
- /* ReplicaLink */ new Syntax("2.5.5.10", 127, s_replicaLinkOMObjectClass)};
+ /* CaseIgnoreString */ new Syntax("2.5.5.4", 20, null),
+ /* NumericString */ new Syntax("2.5.5.6", 18, null),
+ /* DirectoryString */ new Syntax("2.5.5.12", 64, null),
+ /* OctetString */ new Syntax("2.5.5.10", 4, null),
+ /* SecurityDescriptor */ new Syntax("2.5.5.15", 66, null),
+ /* Int */ new Syntax("2.5.5.9", 2, null),
+ /* Int64 */ new Syntax("2.5.5.16", 65, null),
+ /* Bool */ new Syntax("2.5.5.8", 1, null),
+ /* Oid */ new Syntax("2.5.5.2", 6, null),
+ /* GeneralizedTime */ new Syntax("2.5.5.11", 24, null),
+ /* UtcTime */ new Syntax("2.5.5.11", 23, null),
+ /* DN */ new Syntax("2.5.5.1", 127, s_dnOMObjectClass),
+ /* DNWithBinary */ new Syntax("2.5.5.7", 127, s_dNWithBinaryOMObjectClass),
+ /* DNWithString */ new Syntax("2.5.5.14", 127, s_dNWithStringOMObjectClass),
+ /* Enumeration */ new Syntax("2.5.5.9", 10, null),
+ /* IA5String */ new Syntax("2.5.5.5", 22, null),
+ /* PrintableString */ new Syntax("2.5.5.5", 19, null),
+ /* Sid */ new Syntax("2.5.5.17", 4, null),
+ /* AccessPointDN */ new Syntax("2.5.5.14", 127, s_accessPointDnOMObjectClass),
+ /* ORName */ new Syntax("2.5.5.7", 127, s_oRNameOMObjectClass),
+ /* PresentationAddress */ new Syntax("2.5.5.13", 127, s_presentationAddressOMObjectClass),
+ /* ReplicaLink */ new Syntax("2.5.5.10", 127, s_replicaLinkOMObjectClass)};
#region constructors
public ActiveDirectorySchemaProperty(DirectoryContext context, string ldapDisplayName)
GC.SuppressFinalize(this);
}
- // private Dispose method
+ // private Dispose method
protected virtual void Dispose(bool disposing)
{
if (!_disposed)
FreeReplicaInfo(DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_3_FOR_NC, info, libHandle);
}
- // get the next batch of results
+ // get the next batch of results
info = GetReplicationInfoHelper(dsHandle, (int)DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_3_FOR_NC, (int)DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_FOR_NC, partition, ref advanced, context, libHandle);
}
}
if (temp != (IntPtr)0)
{
- // error information is available
+ // error information is available
exception = ExceptionHelper.CreateSyncAllException(temp, true);
if (exception == null)
{
foreach (SearchResult res in resCol)
{
- // add the name of the appNC only if it is not
- // the Schema or Configuration partition
+ // add the name of the appNC only if it is not
+ // the Schema or Configuration partition
string nCName = (string)PropertyManager.GetSearchResultPropertyValue(res, PropertyManager.NCName);
if ((!(nCName.Equals(schemaNamingContext)))
&& (!(nCName.Equals(configurationNamingContext))))
{
/*typedef struct _DOMAIN_CONTROLLER_INFO {
- LPTSTR DomainControllerName;
- LPTSTR DomainControllerAddress;
- ULONG DomainControllerAddressType;
- GUID DomainGuid;
- LPTSTR DomainName;
- LPTSTR DnsForestName;
- ULONG Flags;
- LPTSTR DcSiteName;
- LPTSTR ClientSiteName;
- } DOMAIN_CONTROLLER_INFO, *PDOMAIN_CONTROLLER_INFO; */
+ LPTSTR DomainControllerName;
+ LPTSTR DomainControllerAddress;
+ ULONG DomainControllerAddressType;
+ GUID DomainGuid;
+ LPTSTR DomainName;
+ LPTSTR DnsForestName;
+ ULONG Flags;
+ LPTSTR DcSiteName;
+ LPTSTR ClientSiteName;
+ } DOMAIN_CONTROLLER_INFO, *PDOMAIN_CONTROLLER_INFO; */
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal sealed class DomainControllerInfo
{
}
/*typedef struct {
- LPTSTR NetbiosName;
- LPTSTR DnsHostName;
- LPTSTR SiteName;
- LPTSTR SiteObjectName;
- LPTSTR ComputerObjectName;
- LPTSTR ServerObjectName;
- LPTSTR NtdsaObjectName;
- BOOL fIsPdc;
- BOOL fDsEnabled;
- BOOL fIsGc;
- GUID SiteObjectGuid;
- GUID ComputerObjectGuid;
- GUID ServerObjectGuid;
- GUID NtdsDsaObjectGuid;
- } DS_DOMAIN_CONTROLLER_INFO_2, *PDS_DOMAIN_CONTROLLER_INFO_2;*/
+ LPTSTR NetbiosName;
+ LPTSTR DnsHostName;
+ LPTSTR SiteName;
+ LPTSTR SiteObjectName;
+ LPTSTR ComputerObjectName;
+ LPTSTR ServerObjectName;
+ LPTSTR NtdsaObjectName;
+ BOOL fIsPdc;
+ BOOL fDsEnabled;
+ BOOL fIsGc;
+ GUID SiteObjectGuid;
+ GUID ComputerObjectGuid;
+ GUID ServerObjectGuid;
+ GUID NtdsDsaObjectGuid;
+ } DS_DOMAIN_CONTROLLER_INFO_2, *PDS_DOMAIN_CONTROLLER_INFO_2;*/
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal sealed class DsDomainControllerInfo2
{
}
/*typedef struct {
- LPTSTR NetbiosName;
- LPTSTR DnsHostName;
- LPTSTR SiteName;
- LPTSTR SiteObjectName;
- LPTSTR ComputerObjectName;
- LPTSTR ServerObjectName;
- LPTSTR NtdsaObjectName;
- BOOL fIsPdc;
- BOOL fDsEnabled;
- BOOL fIsGc;
- BOOL fIsRodc;
- GUID SiteObjectGuid;
- GUID ComputerObjectGuid;
- GUID ServerObjectGuid;
- GUID NtdsDsaObjectGuid;
- } DS_DOMAIN_CONTROLLER_INFO_3, *PDS_DOMAIN_CONTROLLER_INFO_3;*/
+ LPTSTR NetbiosName;
+ LPTSTR DnsHostName;
+ LPTSTR SiteName;
+ LPTSTR SiteObjectName;
+ LPTSTR ComputerObjectName;
+ LPTSTR ServerObjectName;
+ LPTSTR NtdsaObjectName;
+ BOOL fIsPdc;
+ BOOL fDsEnabled;
+ BOOL fIsGc;
+ BOOL fIsRodc;
+ GUID SiteObjectGuid;
+ GUID ComputerObjectGuid;
+ GUID ServerObjectGuid;
+ GUID NtdsDsaObjectGuid;
+ } DS_DOMAIN_CONTROLLER_INFO_3, *PDS_DOMAIN_CONTROLLER_INFO_3;*/
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal sealed class DsDomainControllerInfo3
{
}
/*typedef struct {
- DWORD cItems;
- PDS_NAME_RESULT_ITEM rItems;
- } DS_NAME_RESULT, *PDS_NAME_RESULT;*/
+ DWORD cItems;
+ PDS_NAME_RESULT_ITEM rItems;
+ } DS_NAME_RESULT, *PDS_NAME_RESULT;*/
[StructLayout(LayoutKind.Sequential)]
internal sealed class DsNameResult
{
}
/*typedef struct {
- DWORD status;
- LPTSTR pDomain;
- LPTSTR pName;
- } DS_NAME_RESULT_ITEM, *PDS_NAME_RESULT_ITEM;*/
+ DWORD status;
+ LPTSTR pDomain;
+ LPTSTR pName;
+ } DS_NAME_RESULT_ITEM, *PDS_NAME_RESULT_ITEM;*/
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal sealed class DsNameResultItem
{
}
/*typedef struct _DnsRecord {
- struct _DnsRecord * pNext;
- LPTSTR pName;
- WORD wType;
- WORD wDataLength; // Not referenced for DNS record
- //types defined above.
- union {
- DWORD DW; // flags as DWORD
- DNS_RECORD_FLAGS S; // flags as structure
- } Flags;
-
- DWORD dwTtl;
- DWORD dwReserved;
-
- // Record Data
- union {
- DNS_A_DATA A;
- DNS_SOA_DATA SOA, Soa;
- DNS_PTR_DATA PTR, Ptr,
- NS, Ns,
- CNAME, Cname,
- MB, Mb,
- MD, Md,
- MF, Mf,
- MG, Mg,
- MR, Mr;
- DNS_MINFO_DATA MINFO, Minfo,
- RP, Rp;
- DNS_MX_DATA MX, Mx,
- AFSDB, Afsdb,
- RT, Rt;
- DNS_TXT_DATA HINFO, Hinfo,
- ISDN, Isdn,
- TXT, Txt,
- X25;
- DNS_NULL_DATA Null;
- DNS_WKS_DATA WKS, Wks;
- DNS_AAAA_DATA AAAA;
- DNS_KEY_DATA KEY, Key;
- DNS_SIG_DATA SIG, Sig;
- DNS_ATMA_DATA ATMA, Atma;
- DNS_NXT_DATA NXT, Nxt;
- DNS_SRV_DATA SRV, Srv;
- DNS_TKEY_DATA TKEY, Tkey;
- DNS_TSIG_DATA TSIG, Tsig;
- DNS_WINS_DATA WINS, Wins;
- DNS_WINSR_DATA WINSR, WinsR, NBSTAT, Nbstat;
- } Data;
- }DNS_RECORD, *PDNS_RECORD;*/
+ struct _DnsRecord * pNext;
+ LPTSTR pName;
+ WORD wType;
+ WORD wDataLength; // Not referenced for DNS record
+ //types defined above.
+ union {
+ DWORD DW; // flags as DWORD
+ DNS_RECORD_FLAGS S; // flags as structure
+ } Flags;
+
+ DWORD dwTtl;
+ DWORD dwReserved;
+
+ // Record Data
+ union {
+ DNS_A_DATA A;
+ DNS_SOA_DATA SOA, Soa;
+ DNS_PTR_DATA PTR, Ptr,
+ NS, Ns,
+ CNAME, Cname,
+ MB, Mb,
+ MD, Md,
+ MF, Mf,
+ MG, Mg,
+ MR, Mr;
+ DNS_MINFO_DATA MINFO, Minfo,
+ RP, Rp;
+ DNS_MX_DATA MX, Mx,
+ AFSDB, Afsdb,
+ RT, Rt;
+ DNS_TXT_DATA HINFO, Hinfo,
+ ISDN, Isdn,
+ TXT, Txt,
+ X25;
+ DNS_NULL_DATA Null;
+ DNS_WKS_DATA WKS, Wks;
+ DNS_AAAA_DATA AAAA;
+ DNS_KEY_DATA KEY, Key;
+ DNS_SIG_DATA SIG, Sig;
+ DNS_ATMA_DATA ATMA, Atma;
+ DNS_NXT_DATA NXT, Nxt;
+ DNS_SRV_DATA SRV, Srv;
+ DNS_TKEY_DATA TKEY, Tkey;
+ DNS_TSIG_DATA TSIG, Tsig;
+ DNS_WINS_DATA WINS, Wins;
+ DNS_WINSR_DATA WINSR, WinsR, NBSTAT, Nbstat;
+ } Data;
+ }DNS_RECORD, *PDNS_RECORD;*/
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal sealed class DnsRecord
{
}
/*typedef struct {
- LPTSTR pNameTarget;
- WORD wPriority;
- WORD wWeight;
- WORD wPort;
- WORD Pad; // keep ptrs DWORD aligned
- }DNS_SRV_DATA, *PDNS_SRV_DATA;*/
+ LPTSTR pNameTarget;
+ WORD wPriority;
+ WORD wWeight;
+ WORD wPort;
+ WORD Pad; // keep ptrs DWORD aligned
+ }DNS_SRV_DATA, *PDNS_SRV_DATA;*/
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal sealed class DnsSrvData
{
}
/*typedef struct _OSVERSIONINFOEX {
- DWORD dwOSVersionInfoSize;
- DWORD dwMajorVersion;
- DWORD dwMinorVersion;
- DWORD dwBuildNumber;
- DWORD dwPlatformId;
- TCHAR szCSDVersion[ 128 ];
- WORD wServicePackMajor;
- WORD wServicePackMinor;
- WORD wSuiteMask;
- BYTE wProductType;
- BYTE wReserved;
- } OSVERSIONINFOEX, *POSVERSIONINFOEX, *LPOSVERSIONINFOEX;*/
+ DWORD dwOSVersionInfoSize;
+ DWORD dwMajorVersion;
+ DWORD dwMinorVersion;
+ DWORD dwBuildNumber;
+ DWORD dwPlatformId;
+ TCHAR szCSDVersion[ 128 ];
+ WORD wServicePackMajor;
+ WORD wServicePackMinor;
+ WORD wSuiteMask;
+ BYTE wProductType;
+ BYTE wReserved;
+ } OSVERSIONINFOEX, *POSVERSIONINFOEX, *LPOSVERSIONINFOEX;*/
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal sealed class OSVersionInfoEx
{
}
/*typedef struct _LUID {
- DWORD LowPart;
- LONG HighPart;
- } LUID, *PLUID;*/
+ DWORD LowPart;
+ LONG HighPart;
+ } LUID, *PLUID;*/
[StructLayout(LayoutKind.Sequential)]
internal sealed class LUID
{
}
/*typedef struct _NEGOTIATE_CALLER_NAME_REQUEST {
- ULONG MessageType ;
- LUID LogonId ;
- } NEGOTIATE_CALLER_NAME_REQUEST, *PNEGOTIATE_CALLER_NAME_REQUEST ;*/
+ ULONG MessageType ;
+ LUID LogonId ;
+ } NEGOTIATE_CALLER_NAME_REQUEST, *PNEGOTIATE_CALLER_NAME_REQUEST ;*/
[StructLayout(LayoutKind.Sequential)]
internal sealed class NegotiateCallerNameRequest
{
}
/*typedef struct _NEGOTIATE_CALLER_NAME_RESPONSE {
- ULONG MessageType ;
- PWSTR CallerName ;
- } NEGOTIATE_CALLER_NAME_RESPONSE, * PNEGOTIATE_CALLER_NAME_RESPONSE ;*/
+ ULONG MessageType ;
+ PWSTR CallerName ;
+ } NEGOTIATE_CALLER_NAME_RESPONSE, * PNEGOTIATE_CALLER_NAME_RESPONSE ;*/
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal sealed class NegotiateCallerNameResponse
{
internal const int STATUS_QUOTA_EXCEEDED = unchecked((int)0xC0000044);
/*DWORD DsGetDcName(
- LPCTSTR ComputerName,
- LPCTSTR DomainName,
- GUID* DomainGuid,
- LPCTSTR SiteName,
- ULONG Flags,
- PDOMAIN_CONTROLLER_INFO* DomainControllerInfo
- );*/
+ LPCTSTR ComputerName,
+ LPCTSTR DomainName,
+ GUID* DomainGuid,
+ LPCTSTR SiteName,
+ ULONG Flags,
+ PDOMAIN_CONTROLLER_INFO* DomainControllerInfo
+ );*/
[DllImport("Netapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "DsGetDcNameW", CharSet = CharSet.Unicode)]
internal static extern int DsGetDcName(
[In] string computerName,
[Out] out IntPtr domainControllerInfo);
/* DWORD WINAPI DsGetDcOpen(
- LPCTSTR DnsName,
- ULONG OptionFlags,
- LPCTSTR SiteName,
- GUID* DomainGuid,
- LPCTSTR DnsForestName,
- ULONG DcFlags,
- PHANDLE RetGetDcContext
- );*/
+ LPCTSTR DnsName,
+ ULONG OptionFlags,
+ LPCTSTR SiteName,
+ GUID* DomainGuid,
+ LPCTSTR DnsForestName,
+ ULONG DcFlags,
+ PHANDLE RetGetDcContext
+ );*/
[DllImport("Netapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "DsGetDcOpenW", CharSet = CharSet.Unicode)]
internal static extern int DsGetDcOpen(
[In] string dnsName,
[Out] out IntPtr retGetDcContext);
/*DWORD WINAPI DsGetDcNext(
- HANDLE GetDcContextHandle,
- PULONG SockAddressCount,
- LPSOCKET_ADDRESS* SockAddresses,
- LPTSTR* DnsHostName
- );*/
+ HANDLE GetDcContextHandle,
+ PULONG SockAddressCount,
+ LPSOCKET_ADDRESS* SockAddresses,
+ LPTSTR* DnsHostName
+ );*/
[DllImport("Netapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "DsGetDcNextW", CharSet = CharSet.Unicode)]
internal static extern int DsGetDcNext(
[In] IntPtr getDcContextHandle,
[Out] out IntPtr dnsHostName);
/*void WINAPI DsGetDcClose(
- HANDLE GetDcContextHandle
- );*/
+ HANDLE GetDcContextHandle
+ );*/
[DllImport("Netapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "DsGetDcCloseW", CharSet = CharSet.Unicode)]
internal static extern void DsGetDcClose(
[In] IntPtr getDcContextHandle);
/*NET_API_STATUS NetApiBufferFree(
- LPVOID Buffer
- );*/
+ LPVOID Buffer
+ );*/
[DllImport("Netapi32.dll")]
internal static extern int NetApiBufferFree(
[In] IntPtr buffer);
/*DWORD DsMakePasswordCredentials(
- LPTSTR User,
- LPTSTR Domain,
- LPTSTR Password,
- RPC_AUTH_IDENTITY_HANDLE* pAuthIdentity
- );*/
+ LPTSTR User,
+ LPTSTR Domain,
+ LPTSTR Password,
+ RPC_AUTH_IDENTITY_HANDLE* pAuthIdentity
+ );*/
internal delegate int DsMakePasswordCredentials(
[MarshalAs(UnmanagedType.LPWStr)] string user,
[Out] out IntPtr authIdentity);
/*VOID DsFreePasswordCredentials(
- RPC_AUTH_IDENTITY_HANDLE AuthIdentity
- );*/
+ RPC_AUTH_IDENTITY_HANDLE AuthIdentity
+ );*/
internal delegate void DsFreePasswordCredentials(
[In] IntPtr authIdentity);
/*DWORD DsBindWithCred(
- TCHAR* DomainController,
- TCHAR* DnsDomainName,
- RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
- HANDLE* phDS
- );*/
+ TCHAR* DomainController,
+ TCHAR* DnsDomainName,
+ RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
+ HANDLE* phDS
+ );*/
internal delegate int DsBindWithCred(
[MarshalAs(UnmanagedType.LPWStr)] string domainController,
[MarshalAs(UnmanagedType.LPWStr)] string dnsDomainName,
[Out] out IntPtr handle);
/*DWORD DsUnBind(
- HANDLE* phDS
- );*/
+ HANDLE* phDS
+ );*/
internal delegate int DsUnBind(
[In] ref IntPtr handle);
/*DWORD DsGetDomainControllerInfo(
- HANDLE hDs,
- LPTSTR DomainName,
- DWORD InfoLevel,
- DWORD* pcOut,
- VOID** ppInfo
- );*/
+ HANDLE hDs,
+ LPTSTR DomainName,
+ DWORD InfoLevel,
+ DWORD* pcOut,
+ VOID** ppInfo
+ );*/
internal delegate int DsGetDomainControllerInfo(
[In] IntPtr handle,
[MarshalAs(UnmanagedType.LPWStr)] string domainName,
internal const int DsDomainControllerInfoLevel3 = 3;
/*VOID DsFreeDomainControllerInfo(
- DWORD InfoLevel,
- DWORD cInfo,
- VOID* pInfo
- );*/
+ DWORD InfoLevel,
+ DWORD cInfo,
+ VOID* pInfo
+ );*/
internal delegate void DsFreeDomainControllerInfo(
[In] int infoLevel,
[In] int dcInfoListCount,
internal const int DsNameNoError = 0;
/*DWORD DsListSites(
- HANDLE hDs,
- PDS_NAME_RESULT* ppSites
- );*/
+ HANDLE hDs,
+ PDS_NAME_RESULT* ppSites
+ );*/
internal delegate int DsListSites(
[In] IntPtr dsHandle,
[Out] out IntPtr sites);
/*DWORD DsListRoles(
- HANDLE hDs,
- PDS_NAME_RESULTW* ppRoles
- );*/
+ HANDLE hDs,
+ PDS_NAME_RESULTW* ppRoles
+ );*/
internal delegate int DsListRoles(
[In] IntPtr dsHandle,
[Out] out IntPtr roles);
internal const int DnsQueryBypassCache = 8;
/*DNS_STATUS WINAPI DnsQuery (
- LPSTR lpstrName,
- WORD wType,
- DWORD fOptions,
- PIP4_ARRAY aipServers,
- PDNS_RECORD *ppQueryResultsSet,
- PVOID *pReserved
- );*/
+ LPSTR lpstrName,
+ WORD wType,
+ DWORD fOptions,
+ PIP4_ARRAY aipServers,
+ PDNS_RECORD *ppQueryResultsSet,
+ PVOID *pReserved
+ );*/
[DllImport("Dnsapi.dll", EntryPoint = "DnsQuery_W", CharSet = CharSet.Unicode)]
internal static extern int DnsQuery(
[In] string recordName,
[Out] IntPtr reserved);
/*VOID WINAPI DnsRecordListFree(
- PDNS_RECORD pRecordList,
- DNS_FREE_TYPE FreeType
- );*/
+ PDNS_RECORD pRecordList,
+ DNS_FREE_TYPE FreeType
+ );*/
[DllImport("Dnsapi.dll", CharSet = CharSet.Unicode)]
internal static extern void DnsRecordListFree(
[In] IntPtr dnsResultList,
[In] bool dnsFreeType);
/*BOOL GetVersionEx(
- LPOSVERSIONINFO lpVersionInfo
- );*/
+ LPOSVERSIONINFO lpVersionInfo
+ );*/
[DllImport("Kernel32.dll", EntryPoint = "GetVersionExW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern bool GetVersionEx(
[In, Out] OSVersionInfoEx ver);
/*DWORD DsCrackNames(
- HANDLE hDS,
- DS_NAME_FLAGS flags,
- DS_NAME_FORMAT formatOffered,
- DS_NAME_FORMAT formatDesired,
- DWORD cNames,
- LPTSTR* rpNames,
- PDS_NAME_RESULT* ppResult
- );*/
+ HANDLE hDS,
+ DS_NAME_FLAGS flags,
+ DS_NAME_FORMAT formatOffered,
+ DS_NAME_FORMAT formatDesired,
+ DWORD cNames,
+ LPTSTR* rpNames,
+ PDS_NAME_RESULT* ppResult
+ );*/
internal delegate int DsCrackNames(
[In] IntPtr hDS,
[In] int flags,
[Out] out IntPtr results);
/*NTSTATUS LsaConnectUntrusted(
- PHANDLE LsaHandle
- );*/
+ PHANDLE LsaHandle
+ );*/
[DllImport("Secur32.dll")]
internal static extern int LsaConnectUntrusted(
[Out] out LsaLogonProcessSafeHandle lsaHandle);
internal const int NegGetCallerName = 1;
/*NTSTATUS LsaCallAuthenticationPackage(
- HANDLE LsaHandle,
- ULONG AuthenticationPackage,
- PVOID ProtocolSubmitBuffer,
- ULONG SubmitBufferLength,
- PVOID* ProtocolReturnBuffer,
- PULONG ReturnBufferLength,
- PNTSTATUS ProtocolStatus
- );*/
+ HANDLE LsaHandle,
+ ULONG AuthenticationPackage,
+ PVOID ProtocolSubmitBuffer,
+ ULONG SubmitBufferLength,
+ PVOID* ProtocolReturnBuffer,
+ PULONG ReturnBufferLength,
+ PNTSTATUS ProtocolStatus
+ );*/
[DllImport("Secur32.dll")]
internal static extern int LsaCallAuthenticationPackage(
[In] LsaLogonProcessSafeHandle lsaHandle,
[Out] out int protocolStatus);
/*NTSTATUS LsaFreeReturnBuffer(
- PVOID Buffer
- );*/
+ PVOID Buffer
+ );*/
[DllImport("Secur32.dll")]
internal static extern uint LsaFreeReturnBuffer(
[In] IntPtr buffer);
/*NTSTATUS LsaDeregisterLogonProcess(
- HANDLE LsaHandle
- );*/
+ HANDLE LsaHandle
+ );*/
[DllImport("Secur32.dll")]
internal static extern int LsaDeregisterLogonProcess(
[In] IntPtr lsaHandle);
/*int CompareString(LCID Locale,
- DWORD dwCmpFlags,
- DWORD lpString1,
- DWORD cchCount1,
- DWORD lpString2,
- DWORD cchCount2
- );*/
+ DWORD dwCmpFlags,
+ DWORD lpString1,
+ DWORD cchCount1,
+ DWORD lpString2,
+ DWORD cchCount2
+ );*/
[DllImport("Kernel32.dll", EntryPoint = "CompareStringW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern int CompareString(
[In] uint locale,
internal sealed class NativeComInterfaces
{
/*typedef enum {
- ADS_SETTYPE_FULL=1,
- ADS_SETTYPE_PROVIDER=2,
- ADS_SETTYPE_SERVER=3,
- ADS_SETTYPE_DN=4
- } ADS_SETTYPE_ENUM;
-
- typedef enum {
- ADS_FORMAT_WINDOWS=1,
- ADS_FORMAT_WINDOWS_NO_SERVER=2,
- ADS_FORMAT_WINDOWS_DN=3,
- ADS_FORMAT_WINDOWS_PARENT=4,
- ADS_FORMAT_X500=5,
- ADS_FORMAT_X500_NO_SERVER=6,
- ADS_FORMAT_X500_DN=7,
- ADS_FORMAT_X500_PARENT=8,
- ADS_FORMAT_SERVER=9,
- ADS_FORMAT_PROVIDER=10,
- ADS_FORMAT_LEAF=11
- } ADS_FORMAT_ENUM;
-
- typedef enum {
- ADS_ESCAPEDMODE_DEFAULT=1,
- ADS_ESCAPEDMODE_ON=2,
- ADS_ESCAPEDMODE_OFF=3,
- ADS_ESCAPEDMODE_OFF_EX=4
- } ADS_ESCAPE_MODE_ENUM;*/
+ ADS_SETTYPE_FULL=1,
+ ADS_SETTYPE_PROVIDER=2,
+ ADS_SETTYPE_SERVER=3,
+ ADS_SETTYPE_DN=4
+ } ADS_SETTYPE_ENUM;
+
+ typedef enum {
+ ADS_FORMAT_WINDOWS=1,
+ ADS_FORMAT_WINDOWS_NO_SERVER=2,
+ ADS_FORMAT_WINDOWS_DN=3,
+ ADS_FORMAT_WINDOWS_PARENT=4,
+ ADS_FORMAT_X500=5,
+ ADS_FORMAT_X500_NO_SERVER=6,
+ ADS_FORMAT_X500_DN=7,
+ ADS_FORMAT_X500_PARENT=8,
+ ADS_FORMAT_SERVER=9,
+ ADS_FORMAT_PROVIDER=10,
+ ADS_FORMAT_LEAF=11
+ } ADS_FORMAT_ENUM;
+
+ typedef enum {
+ ADS_ESCAPEDMODE_DEFAULT=1,
+ ADS_ESCAPEDMODE_ON=2,
+ ADS_ESCAPEDMODE_OFF=3,
+ ADS_ESCAPEDMODE_OFF_EX=4
+ } ADS_ESCAPE_MODE_ENUM;*/
internal const int ADS_SETTYPE_DN = 4;
internal const int ADS_FORMAT_X500_DN = 7;
/*
- #define LANG_ENGLISH 0x09
- #define SUBLANG_ENGLISH_US 0x01 // English (USA)
- #define SORT_DEFAULT 0x0 // sorting default
-
- #define NORM_IGNORECASE 0x00000001 // ignore case
- #define NORM_IGNORENONSPACE 0x00000002 // ignore nonspacing chars
- #define NORM_IGNORESYMBOLS 0x00000004 // ignore symbols
- #define NORM_IGNOREKANATYPE 0x00010000 // ignore kanatype
- #define NORM_IGNOREWIDTH 0x00020000 // ignore width
-
- #define SORT_STRINGSORT 0x00001000 // use string sort method
-
- #define MAKELANGID(p, s) ((((WORD )(s)) << 10) | (WORD )(p))
-
- #define MAKELCID(lgid, srtid) ((DWORD)((((DWORD)((WORD )(srtid))) << 16) | \
- ((DWORD)((WORD )(lgid)))))
-
- #define DS_DEFAULT_LOCALE \
- (MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), \
- SORT_DEFAULT))
-
- #define DS_DEFAULT_LOCALE_COMPARE_FLAGS (NORM_IGNORECASE | \
- NORM_IGNOREKANATYPE | \
- NORM_IGNORENONSPACE | \
- NORM_IGNOREWIDTH | \
- SORT_STRINGSORT )
-
- */
+ #define LANG_ENGLISH 0x09
+ #define SUBLANG_ENGLISH_US 0x01 // English (USA)
+ #define SORT_DEFAULT 0x0 // sorting default
+
+ #define NORM_IGNORECASE 0x00000001 // ignore case
+ #define NORM_IGNORENONSPACE 0x00000002 // ignore nonspacing chars
+ #define NORM_IGNORESYMBOLS 0x00000004 // ignore symbols
+ #define NORM_IGNOREKANATYPE 0x00010000 // ignore kanatype
+ #define NORM_IGNOREWIDTH 0x00020000 // ignore width
+
+ #define SORT_STRINGSORT 0x00001000 // use string sort method
+
+ #define MAKELANGID(p, s) ((((WORD )(s)) << 10) | (WORD )(p))
+
+ #define MAKELCID(lgid, srtid) ((DWORD)((((DWORD)((WORD )(srtid))) << 16) | \
+ ((DWORD)((WORD )(lgid)))))
+
+ #define DS_DEFAULT_LOCALE \
+ (MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), \
+ SORT_DEFAULT))
+
+ #define DS_DEFAULT_LOCALE_COMPARE_FLAGS (NORM_IGNORECASE | \
+ NORM_IGNOREKANATYPE | \
+ NORM_IGNORENONSPACE | \
+ NORM_IGNOREWIDTH | \
+ SORT_STRINGSORT )
+
+ */
private static uint s_LANG_ENGLISH = 0x09;
private static uint s_SUBLANG_ENGLISH_US = 0x01;
private static uint s_SORT_DEFAULT = 0x0;
//
// DN is of the form cn=NTDS Settings, cn={dc name}, cn=Servers, cn={site name}, cn=Sites,
- // cn=Configuration, {defaultNamingContext}
- // Bind to the NTDS-DSA (parent) object for and get the dnsHostName
- // from there
+ // cn=Configuration, {defaultNamingContext}
+ // Bind to the NTDS-DSA (parent) object for and get the dnsHostName
+ // from there
//
internal static string GetDnsHostNameFromNTDSA(DirectoryContext context, string dn)
{
public enum DereferenceAlias
{
Never = 0,
- InSearching = 1,
+ InSearching = 1,
FindingBaseObject = 2,
Always = 3
}
}
}
- public DirectoryVirtualListViewContext Copy()
+ public DirectoryVirtualListViewContext Copy()
{
return new DirectoryVirtualListViewContext(_context);
}
/// </devdoc>
public enum ExtendedDN
{
- None = -1,
- HexString = 0,
- Standard = 1
+ None = -1,
+ HexString = 0,
+ Standard = 1
}
}
namespace ActiveDirectoryComInterop
{
// , TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable)
- [Guid("9068270B-0939-11D1-8BE1-00C04FD8D503")]
- [ComImport]
- public interface IADsLargeInteger
- {
- [DispId(2)]
- int HighPart
- {
- [DispId(2)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- get;
- [DispId(2)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- set;
- }
+ [Guid("9068270B-0939-11D1-8BE1-00C04FD8D503")]
+ [ComImport]
+ public interface IADsLargeInteger
+ {
+ [DispId(2)]
+ int HighPart
+ {
+ [DispId(2)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ get;
+ [DispId(2)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ set;
+ }
- [DispId(3)]
- int LowPart
- {
- [DispId(3)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- get;
- [DispId(3)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- set;
- }
- }
+ [DispId(3)]
+ int LowPart
+ {
+ [DispId(3)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ get;
+ [DispId(3)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ set;
+ }
+ }
// , TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable)
- [Guid("FD8256D0-FD15-11CE-ABC4-02608C9E7553")]
- [ComImport]
- public interface IADs
- {
- [DispId(2)]
- string Name
- {
- [DispId(2)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [return: MarshalAs(UnmanagedType.BStr)]
- get;
- }
+ [Guid("FD8256D0-FD15-11CE-ABC4-02608C9E7553")]
+ [ComImport]
+ public interface IADs
+ {
+ [DispId(2)]
+ string Name
+ {
+ [DispId(2)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
- [DispId(3)]
- string Class
- {
- [DispId(3)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [return: MarshalAs(UnmanagedType.BStr)]
- get;
- }
+ [DispId(3)]
+ string Class
+ {
+ [DispId(3)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
- [DispId(4)]
- string GUID
- {
- [DispId(4)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [return: MarshalAs(UnmanagedType.BStr)]
- get;
- }
+ [DispId(4)]
+ string GUID
+ {
+ [DispId(4)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
- [DispId(5)]
- string ADsPath
- {
- [DispId(5)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [return: MarshalAs(UnmanagedType.BStr)]
- get;
- }
+ [DispId(5)]
+ string ADsPath
+ {
+ [DispId(5)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
- [DispId(6)]
- string Parent
- {
- [DispId(6)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [return: MarshalAs(UnmanagedType.BStr)]
- get;
- }
+ [DispId(6)]
+ string Parent
+ {
+ [DispId(6)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
- [DispId(7)]
- string Schema
- {
- [DispId(7)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [return: MarshalAs(UnmanagedType.BStr)]
- get;
- }
+ [DispId(7)]
+ string Schema
+ {
+ [DispId(7)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ }
- [DispId(8)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- void GetInfo();
+ [DispId(8)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ void GetInfo();
- [DispId(9)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- void SetInfo();
+ [DispId(9)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ void SetInfo();
- [DispId(10)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [return: MarshalAs(UnmanagedType.Struct)]
- object Get([MarshalAs(UnmanagedType.BStr)] [In] string bstrName);
+ [DispId(10)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [return: MarshalAs(UnmanagedType.Struct)]
+ object Get([MarshalAs(UnmanagedType.BStr)] [In] string bstrName);
- [DispId(11)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- void Put([MarshalAs(UnmanagedType.BStr)] [In] string bstrName, [MarshalAs(UnmanagedType.Struct)] [In] object vProp);
+ [DispId(11)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ void Put([MarshalAs(UnmanagedType.BStr)] [In] string bstrName, [MarshalAs(UnmanagedType.Struct)] [In] object vProp);
- [DispId(12)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [return: MarshalAs(UnmanagedType.Struct)]
- object GetEx([MarshalAs(UnmanagedType.BStr)] [In] string bstrName);
+ [DispId(12)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [return: MarshalAs(UnmanagedType.Struct)]
+ object GetEx([MarshalAs(UnmanagedType.BStr)] [In] string bstrName);
- [DispId(13)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- void PutEx([In] int lnControlCode, [MarshalAs(UnmanagedType.BStr)] [In] string bstrName, [MarshalAs(UnmanagedType.Struct)] [In] object vProp);
+ [DispId(13)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ void PutEx([In] int lnControlCode, [MarshalAs(UnmanagedType.BStr)] [In] string bstrName, [MarshalAs(UnmanagedType.Struct)] [In] object vProp);
- [DispId(14)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- void GetInfoEx([MarshalAs(UnmanagedType.Struct)] [In] object vProperties, [In] int lnReserved);
- }
+ [DispId(14)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ void GetInfoEx([MarshalAs(UnmanagedType.Struct)] [In] object vProperties, [In] int lnReserved);
+ }
// , TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable)
- [Guid("B8C787CA-9BDD-11D0-852C-00C04FD8D503")]
- [ComImport]
- public interface IADsSecurityDescriptor
- {
- [DispId(2)]
- int Revision
- {
- [DispId(2)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- get;
- [DispId(2)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- set;
- }
+ [Guid("B8C787CA-9BDD-11D0-852C-00C04FD8D503")]
+ [ComImport]
+ public interface IADsSecurityDescriptor
+ {
+ [DispId(2)]
+ int Revision
+ {
+ [DispId(2)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ get;
+ [DispId(2)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ set;
+ }
- [DispId(3)]
- int Control
- {
- [DispId(3)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- get;
- [DispId(3)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- set;
- }
+ [DispId(3)]
+ int Control
+ {
+ [DispId(3)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ get;
+ [DispId(3)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ set;
+ }
- [DispId(4)]
- string Owner
- {
- [DispId(4)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [return: MarshalAs(UnmanagedType.BStr)]
- get;
- [DispId(4)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [param: MarshalAs(UnmanagedType.BStr)]
- set;
- }
+ [DispId(4)]
+ string Owner
+ {
+ [DispId(4)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ [DispId(4)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [param: MarshalAs(UnmanagedType.BStr)]
+ set;
+ }
- [DispId(5)]
- bool OwnerDefaulted
- {
- [DispId(5)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- get;
- [DispId(5)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- set;
- }
+ [DispId(5)]
+ bool OwnerDefaulted
+ {
+ [DispId(5)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ get;
+ [DispId(5)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ set;
+ }
- [DispId(6)]
- string Group
- {
- [DispId(6)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [return: MarshalAs(UnmanagedType.BStr)]
- get;
- [DispId(6)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [param: MarshalAs(UnmanagedType.BStr)]
- set;
- }
+ [DispId(6)]
+ string Group
+ {
+ [DispId(6)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [return: MarshalAs(UnmanagedType.BStr)]
+ get;
+ [DispId(6)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [param: MarshalAs(UnmanagedType.BStr)]
+ set;
+ }
- [DispId(7)]
- bool GroupDefaulted
- {
- [DispId(7)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- get;
- [DispId(7)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- set;
- }
+ [DispId(7)]
+ bool GroupDefaulted
+ {
+ [DispId(7)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ get;
+ [DispId(7)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ set;
+ }
- [DispId(8)]
- object DiscretionaryAcl
- {
- [DispId(8)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [return: MarshalAs(UnmanagedType.IDispatch)]
- get;
- [DispId(8)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [param: MarshalAs(UnmanagedType.IDispatch)]
- set;
- }
+ [DispId(8)]
+ object DiscretionaryAcl
+ {
+ [DispId(8)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [return: MarshalAs(UnmanagedType.IDispatch)]
+ get;
+ [DispId(8)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [param: MarshalAs(UnmanagedType.IDispatch)]
+ set;
+ }
- [DispId(9)]
- bool DaclDefaulted
- {
- [DispId(9)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- get;
- [DispId(9)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- set;
- }
+ [DispId(9)]
+ bool DaclDefaulted
+ {
+ [DispId(9)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ get;
+ [DispId(9)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ set;
+ }
- [DispId(10)]
- object SystemAcl
- {
- [DispId(10)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [return: MarshalAs(UnmanagedType.IDispatch)]
- get;
- [DispId(10)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [param: MarshalAs(UnmanagedType.IDispatch)]
- set;
- }
+ [DispId(10)]
+ object SystemAcl
+ {
+ [DispId(10)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [return: MarshalAs(UnmanagedType.IDispatch)]
+ get;
+ [DispId(10)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [param: MarshalAs(UnmanagedType.IDispatch)]
+ set;
+ }
- [DispId(11)]
- bool SaclDefaulted
- {
- [DispId(11)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- get;
- [DispId(11)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- set;
- }
+ [DispId(11)]
+ bool SaclDefaulted
+ {
+ [DispId(11)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ get;
+ [DispId(11)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ set;
+ }
- [DispId(12)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [return: MarshalAs(UnmanagedType.IDispatch)]
- object CopySecurityDescriptor();
- }
+ [DispId(12)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [return: MarshalAs(UnmanagedType.IDispatch)]
+ object CopySecurityDescriptor();
+ }
}
Assert.Equal(originalPhone, (string) sameUserEntry.Properties["telephoneNumber"].Value);
}
- userEntry.CommitChanges();
+ userEntry.CommitChanges();
using (DirectoryEntry sameUserEntry = GetOrganizationalRole(rootOU, "caching.user.1"))
{
Assert.Equal(newPhone, (string) sameUserEntry.Properties["telephoneNumber"].Value);
}
- userEntry.UsePropertyCache = false;
+ userEntry.UsePropertyCache = false;
Assert.False(userEntry.UsePropertyCache);
userEntry.Properties["telephoneNumber"].Value = originalPhone;
/// <param name="lf">A boxed LOGFONT.</param>
/// <param name="hdc">Handle to a device context (HDC).</param>
/// <returns>The newly created <see cref="Font"/>.</returns>
- public unsafe static Font FromLogFont(object lf, IntPtr hdc)
+ public static unsafe Font FromLogFont(object lf, IntPtr hdc)
{
if (lf == null)
{
public static extern IntPtr SelectObject(HandleRef hdc, HandleRef obj);
[DllImport(ExternDll.User32, ExactSpelling = true, SetLastError = true)]
- public unsafe static extern IntPtr CreateIconFromResourceEx(
+ public static extern unsafe IntPtr CreateIconFromResourceEx(
byte* pbIconBits,
uint cbIconBits,
bool fIcon,
int flags);
[DllImport(ExternDll.Shell32, CharSet = CharSet.Unicode)]
- public unsafe static extern IntPtr ExtractAssociatedIcon(HandleRef hInst, char* iconPath, ref int index);
+ public static extern unsafe IntPtr ExtractAssociatedIcon(HandleRef hInst, char* iconPath, ref int index);
[DllImport(ExternDll.User32, SetLastError = true, CharSet = CharSet.Unicode)]
public static extern IntPtr LoadIcon(HandleRef hInst, IntPtr iconId);
[DllImport(ExternDll.Gdi32, SetLastError = true, CharSet = CharSet.Unicode)]
public static extern int GetObject(HandleRef hObject, int nSize, ref LOGFONT lf);
- public unsafe static int GetObject(HandleRef hObject, ref LOGFONT lp)
+ public static unsafe int GetObject(HandleRef hObject, ref LOGFONT lp)
=> GetObject(hObject, sizeof(LOGFONT), ref lp);
[DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true)]
namespace System.Drawing
{
- internal unsafe static partial class SafeNativeMethods
+ internal static unsafe partial class SafeNativeMethods
{
internal static partial class Gdip
{
public static Icon ExtractAssociatedIcon(string filePath) => ExtractAssociatedIcon(filePath, 0);
- private unsafe static Icon ExtractAssociatedIcon(string filePath, int index)
+ private static unsafe Icon ExtractAssociatedIcon(string filePath, int index)
{
if (filePath == null)
{
}
}
- internal unsafe static void EnsureSave(Image image, string filename, Stream dataStream)
+ internal static unsafe void EnsureSave(Image image, string filename, Stream dataStream)
{
if (image.RawFormat.Equals(ImageFormat.Gif))
{
{
public static partial class SystemFonts
{
- private unsafe static bool GetNonClientMetrics(out NativeMethods.NONCLIENTMETRICS metrics)
+ private static unsafe bool GetNonClientMetrics(out NativeMethods.NONCLIENTMETRICS metrics)
{
metrics = new NativeMethods.NONCLIENTMETRICS { cbSize = (uint)sizeof(NativeMethods.NONCLIENTMETRICS) };
fixed (void* m = &metrics)
public static extern int GetSystemMetrics(int nIndex);
[DllImport(ExternDll.User32, SetLastError = true, CharSet = CharSet.Unicode)]
- public static unsafe extern bool SystemParametersInfo(uint uiAction, uint uiParam, void* pvParam, uint fWinIni);
+ public static extern unsafe bool SystemParametersInfo(uint uiAction, uint uiParam, void* pvParam, uint fWinIni);
[DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)]
public static extern int GetDeviceCaps(HandleRef hDC, int nIndex);
// See the LICENSE file in the project root for more information.
//
// Authors:
-// Jordi Mas i Hernà ndez (jordi@ximian.com)
-// Sebastien Pouliot <sebastien@ximian.com>
+// Jordi Mas i Hernà ndez (jordi@ximian.com)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2004 Ximian, Inc. http://www.ximian.com
// Copyright (C) 2004-2007 Novell, Inc (http://www.novell.com)
// See the LICENSE file in the project root for more information.
//
// Authors:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
//
// Author:
//
-// Jordi Mas i Hernandez, jordimash@gmail.com
+// Jordi Mas i Hernandez, jordimash@gmail.com
//
using Xunit;
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Author:
-// Andy Hume <andyhume32@yahoo.co.uk>
+// Andy Hume <andyhume32@yahoo.co.uk>
//
using Xunit;
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Author:
-// Andy Hume <andyhume32@yahoo.co.uk>
+// Andy Hume <andyhume32@yahoo.co.uk>
//
using Xunit;
// See the LICENSE file in the project root for more information.
//
// Authors:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
//
// Author:
//
-// Jordi Mas i Hernandez, jordimash@gmail.com
+// Jordi Mas i Hernandez, jordimash@gmail.com
//
using Xunit;
// BMPCodec class testing unit
//
// Authors:
-// Jordi Mas i Hernà ndez (jordi@ximian.com)
-// Sebastien Pouliot <sebastien@ximian.com>
+// Jordi Mas i Hernà ndez (jordi@ximian.com)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2004 Ximian, Inc. http://www.ximian.com
// Copyright (C) 2004-2007 Novell, Inc (http://www.novell.com)
{
string sOutFile = $"linerect-{expected}.bmp";
- // Save
+ // Save
Bitmap bmp = new Bitmap(100, 100, original);
Graphics gr = Graphics.FromImage(bmp);
// GIF Codec class testing unit
//
// Authors:
-// Jordi Mas i Hernà ndez (jordi@ximian.com)
-// Sebastien Pouliot <sebastien@ximian.com>
+// Jordi Mas i Hernà ndez (jordi@ximian.com)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2006, 2007 Novell, Inc (http://www.novell.com)
//
{
string sOutFile = $"linerect-{expected}.gif";
- // Save
+ // Save
Bitmap bmp = new Bitmap(100, 100, original);
Graphics gr = Graphics.FromImage(bmp);
// ICO Codec class testing unit
//
// Authors:
-// Jordi Mas i Hernà ndez (jordi@ximian.com)
-// Sebastien Pouliot <sebastien@ximian.com>
+// Jordi Mas i Hernà ndez (jordi@ximian.com)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
//
{
string sOutFile = $"linerect-{expected}.ico";
- // Save
+ // Save
Bitmap bmp = new Bitmap(100, 100, original);
Graphics gr = Graphics.FromImage(bmp);
// JpegCodec class testing unit
//
// Authors:
-// Jordi Mas i Hernà ndez (jordi@ximian.com)
-// Sebastien Pouliot <sebastien@ximian.com>
+// Jordi Mas i Hernà ndez (jordi@ximian.com)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2004 Ximian, Inc. http://www.ximian.com
// Copyright (C) 2004-2007 Novell, Inc (http://www.novell.com)
{
string sOutFile = $"linerect-{expected}.jpeg";
- // Save
+ // Save
Bitmap bmp = new Bitmap(100, 100, original);
Graphics gr = Graphics.FromImage(bmp);
{
bmp.Save(sOutFile, ImageFormat.Jpeg);
- // Load
+ // Load
using (Bitmap bmpLoad = new Bitmap(sOutFile))
{
Assert.Equal(expected, bmpLoad.PixelFormat);
// PNG Codec class testing unit
//
// Authors:
-// Jordi Mas i Hernà ndez (jordi@ximian.com)
-// Sebastien Pouliot <sebastien@ximian.com>
+// Jordi Mas i Hernà ndez (jordi@ximian.com)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2006, 2007 Novell, Inc (http://www.novell.com)
//
{
string sOutFile = $"linerect-{expected}.png";
- // Save
+ // Save
Bitmap bmp = new Bitmap(100, 100, original);
Graphics gr = Graphics.FromImage(bmp);
// TIFF Codec class testing unit
//
// Authors:
-// Jordi Mas i Hernà ndez (jordi@ximian.com)
-// Sebastien Pouliot <sebastien@ximian.com>
+// Jordi Mas i Hernà ndez (jordi@ximian.com)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2006, 2007 Novell, Inc (http://www.novell.com)
//
GraphicsUnit unit = GraphicsUnit.World;
RectangleF rect = bmp.GetBounds(ref unit);
// MS reports 24 bpp while we report 32 bpp
- // Assert.Equal (PixelFormat.Format24bppRgb, bmp.PixelFormat);
+ // Assert.Equal (PixelFormat.Format24bppRgb, bmp.PixelFormat);
Assert.Equal(173, bmp.Width);
Assert.Equal(183, bmp.Height);
{
string sOutFile = $"linerect-{expected}.tif";
- // Save
+ // Save
Bitmap bmp = new Bitmap(100, 100, original);
Graphics gr = Graphics.FromImage(bmp);
// Bitmap class testing unit
//
// Authors:
-// Jordi Mas i Hernà ndez (jmas@softcatala.org>
-// Jonathan Gilbert <logic@deltaq.org>
-// Sebastien Pouliot <sebastien@ximian.com>
+// Jordi Mas i Hernà ndez (jmas@softcatala.org>
+// Jonathan Gilbert <logic@deltaq.org>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2004 Ximian, Inc. http://www.ximian.com
// Copyright (C) 2004,2006-2007 Novell, Inc (http://www.novell.com)
[ConditionalFact(Helpers.IsDrawingSupported)]
public void TestPixels()
{
- // Tests GetSetPixel/SetPixel
+ // Tests GetSetPixel/SetPixel
Bitmap bmp = new Bitmap(100, 100, PixelFormat.Format32bppRgb);
bmp.SetPixel(0, 0, Color.FromArgb(255, 128, 128, 128));
Color color = bmp.GetPixel(0, 0);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.TextRenderingHint = TextRenderingHint.SystemDefault;
- //Clipping set/get tested in clipping functions
+ //Clipping set/get tested in clipping functions
Assert.Equal(CompositingMode.SourceCopy, g.CompositingMode);
Assert.Equal(CompositingQuality.GammaCorrected, g.CompositingQuality);
Assert.Equal(InterpolationMode.HighQualityBilinear, g.InterpolationMode);
// Metafile class unit tests
//
// Authors:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
/// <summary>
/// <para>
/// Specifies whether this <see cref='System.Drawing.Point'/> contains
- /// the same coordinates as the specified <see cref='System.Object'/>.
+ /// the same coordinates as the specified <see cref='object'/>.
/// </para>
/// </summary>
public override bool Equals(object obj) => obj is Point && Equals((Point)obj);
/// According to the ToASCII algorithm, if the UseSTD3ASCIIRules flag is set,
/// then perform these checks:
///
- /// (a) Verify the absence of non-LDH ASCII code points; that is, the absence
+ /// (a) Verify the absence of non-LDH ASCII code points; that is, the absence
/// of 0..2C, 2E..2F, 3A..40, 5B..60, and 7B..7F.
///
/// (b) Verify the absence of leading and trailing hyphen-minus; that is, the
if (PlatformDetection.IsWindows && PlatformDetection.WindowsVersion < 10)
{
- Assert.Throws<CultureNotFoundException>(() => new CultureInfo("no-such-culture"));
+ Assert.Throws<CultureNotFoundException>(() => new CultureInfo("no-such-culture"));
Assert.Throws<CultureNotFoundException>(() => new CultureInfo("en-US-CUSTOM"));
Assert.Throws<CultureNotFoundException>(() => new CultureInfo("xx-XX"));
}
DateTimeFormatInfo readOnlyFormat = DateTimeFormatInfo.ReadOnly(format);
if (originalFormatIsReadOnly)
{
- Assert.Same(format, readOnlyFormat);
+ Assert.Same(format, readOnlyFormat);
}
else
{
- Assert.NotSame(format, readOnlyFormat);
+ Assert.NotSame(format, readOnlyFormat);
}
Assert.True(readOnlyFormat.IsReadOnly);
}
while ((value = inputStream.ReadByte()) != -1)
{
bitlist.Add((byte)value);
- // outputStream.WriteByte((Byte)value);
+ // outputStream.WriteByte((Byte)value);
}
- // outputStream.Close();
+ // outputStream.Close();
inputStream.Dispose();
//Footer
//We can confirm this by comparing the size of the decompressed file with the size specified in the footer
//To do this, we need to decompress the file
//@TODO!! - is it worth it??
- // outputStream = new MemoryStream(outputFileName, FileMode.Create, FileAccess.Write);
- // inputStream = new MemoryStream(inputFileName, FileMode.Open, FileAccess.Read, FileShare.Read);
+ // outputStream = new MemoryStream(outputFileName, FileMode.Create, FileAccess.Write);
+ // inputStream = new MemoryStream(inputFileName, FileMode.Open, FileAccess.Read, FileShare.Read);
- // outputStream.Flush();
+ // outputStream.Flush();
byte[] bits = new byte[bitlist.Count - 8];
bitlist.CopyTo(0, bits, 0, bitlist.Count - 8);
outputStream.Write(bits, 0, bits.Length);
using System.Threading;
using System.Text;
+#pragma warning disable SA1121 // we don't want to simplify built-ins here as we're using aliasing
using CFStringRef = System.IntPtr;
using FSEventStreamRef = System.IntPtr;
using size_t = System.IntPtr;
File.Move(filePath, filePathRenamed);
Assert.True(WaitHandle.WaitAll(
- new[] { autoResetEvent1_created, autoResetEvent1_deleted, autoResetEvent2_created, autoResetEvent2_deleted },
- WaitForExpectedEventTimeout_NoRetry));
+ new[] { autoResetEvent1_created, autoResetEvent1_deleted, autoResetEvent2_created, autoResetEvent2_deleted },
+ WaitForExpectedEventTimeout_NoRetry));
File.Move(filePathRenamed, filePath);
watcher1.EnableRaisingEvents = false;
File.Move(filePath, filePathRenamed);
Assert.False(WaitHandle.WaitAll(
- new[] { autoResetEvent1_created, autoResetEvent1_deleted },
- WaitForUnexpectedEventTimeout));
+ new[] { autoResetEvent1_created, autoResetEvent1_deleted },
+ WaitForUnexpectedEventTimeout));
Assert.True(WaitHandle.WaitAll(
- new[] { autoResetEvent2_created, autoResetEvent2_deleted },
- WaitForExpectedEventTimeout_NoRetry));
+ new[] { autoResetEvent2_created, autoResetEvent2_deleted },
+ WaitForExpectedEventTimeout_NoRetry));
}
});
}
// is the directory separator and cannot be part of any path segment in Windows). The other three are the
// special case wildcards that we'll convert some * and ? into. They're also valid as filenames on Unix,
// which is not true in Windows and as such we'll escape any that occur on the input string.
- private readonly static char[] s_unixEscapeChars = { '\\', '"', '<', '>' };
+ private static readonly char[] s_unixEscapeChars = { '\\', '"', '<', '>' };
/// <summary>
/// Validates the directory and expression strings to check that they have no invalid characters, any special DOS wildcard characters in Win32 in the expression get replaced with their proper escaped representation, and if the expression string begins with a directory name, the directory name is moved and appended at the end of the directory string.
- Different drive is mounted on the current drive
- Current drive is mounted on a different drive
- Current drive is mounted on current directory
- - refer to the directory in a recursive manner in addition to the normal one
+ - refer to the directory in a recursive manner in addition to the normal one
**/
using System;
using System.IO;
}
}
- [Fact]
- public void VariableLengthFileNames_AllCreatableFilesAreEnumerable()
- {
- DirectoryInfo testDirectory = Directory.CreateDirectory(GetTestFilePath());
- var names = new List<string>();
-
- for (int length = 1; length < 10_000; length++) // arbitrarily large limit for the test
- {
- string name = new string('a', length);
- try { File.Create(Path.Join(testDirectory.FullName, name)).Dispose(); }
- catch { break; }
- names.Add(name);
- }
- Assert.InRange(names.Count, 1, int.MaxValue);
- Assert.Equal(names.OrderBy(n => n), Directory.GetFiles(testDirectory.FullName).Select(n => Path.GetFileName(n)).OrderBy(n => n));
- }
-
- [Fact]
- public void VariableLengthDirectoryNames_AllCreatableDirectoriesAreEnumerable()
- {
- DirectoryInfo testDirectory = Directory.CreateDirectory(GetTestFilePath());
- var names = new List<string>();
-
- for (int length = 1; length < 10_000; length++) // arbitrarily large limit for the test
- {
- string name = new string('a', length);
- try { Directory.CreateDirectory(Path.Join(testDirectory.FullName, name)); }
- catch { break; }
- names.Add(name);
- }
- Assert.InRange(names.Count, 1, int.MaxValue);
- Assert.Equal(names.OrderBy(n => n), Directory.GetDirectories(testDirectory.FullName).Select(n => Path.GetFileName(n)).OrderBy(n => n));
- }
+ [Fact]
+ public void VariableLengthFileNames_AllCreatableFilesAreEnumerable()
+ {
+ DirectoryInfo testDirectory = Directory.CreateDirectory(GetTestFilePath());
+ var names = new List<string>();
+
+ for (int length = 1; length < 10_000; length++) // arbitrarily large limit for the test
+ {
+ string name = new string('a', length);
+ try { File.Create(Path.Join(testDirectory.FullName, name)).Dispose(); }
+ catch { break; }
+ names.Add(name);
+ }
+ Assert.InRange(names.Count, 1, int.MaxValue);
+ Assert.Equal(names.OrderBy(n => n), Directory.GetFiles(testDirectory.FullName).Select(n => Path.GetFileName(n)).OrderBy(n => n));
+ }
+
+ [Fact]
+ public void VariableLengthDirectoryNames_AllCreatableDirectoriesAreEnumerable()
+ {
+ DirectoryInfo testDirectory = Directory.CreateDirectory(GetTestFilePath());
+ var names = new List<string>();
+
+ for (int length = 1; length < 10_000; length++) // arbitrarily large limit for the test
+ {
+ string name = new string('a', length);
+ try { Directory.CreateDirectory(Path.Join(testDirectory.FullName, name)); }
+ catch { break; }
+ names.Add(name);
+ }
+ Assert.InRange(names.Count, 1, int.MaxValue);
+ Assert.Equal(names.OrderBy(n => n), Directory.GetDirectories(testDirectory.FullName).Select(n => Path.GetFileName(n)).OrderBy(n => n));
+ }
}
}
/// For standalone debugging help. Change Main0 to Main
public static void Main0(string[] args)
{
- try
+ try
{
- if(args[0]=="-m")
- Mount(args[1], args[2]);
- if(args[0]=="-u")
- Unmount(args[1]);
- }
+ if(args[0]=="-m")
+ Mount(args[1], args[2]);
+ if(args[0]=="-u")
+ Unmount(args[1]);
+ }
catch(Exception ex)
{
- Console.WriteLine(ex);
- }
- }
+ Console.WriteLine(ex);
+ }
+ }
}
absolutePackageUri = absolutePackageUri.Replace('/', ',');
// Step 5 - Append pack:// at the begining and a '/' at the end of the pack uri obtained so far
- absolutePackageUri = String.Concat(PackUriHelper.UriSchemePack, Uri.SchemeDelimiter, absolutePackageUri);
+ absolutePackageUri = string.Concat(PackUriHelper.UriSchemePack, Uri.SchemeDelimiter, absolutePackageUri);
Uri packUri = new Uri(absolutePackageUri);
// Step 7 - Append fragment if present
if (fragment != null)
- packUri = new Uri(String.Concat(packUri.GetComponents(UriComponents.AbsoluteUri, UriFormat.UriEscaped), fragment));
+ packUri = new Uri(string.Concat(packUri.GetComponents(UriComponents.AbsoluteUri, UriFormat.UriEscaped), fragment));
// We want to ensure that internal content of resulting Uri has canonical form
// i.e. result.OrignalString would appear as perfectly formatted Uri string
Debug.Assert(packUri != null, "packUri parameter cannot be null");
//Step 1 - Get the authority part of the URI. This section represents that package URI
- String hostAndPort = packUri.GetComponents(UriComponents.HostAndPort, UriFormat.UriEscaped);
+ string hostAndPort = packUri.GetComponents(UriComponents.HostAndPort, UriFormat.UriEscaped);
//Step 2 - Replace the ',' with '/' to reconstruct the package URI
hostAndPort = hostAndPort.Replace(',', '/');
//Step 3 - Unescape the special characters that we had escaped to construct the packUri
Uri packageUri = new Uri(Uri.UnescapeDataString(hostAndPort));
- if (packageUri.Fragment != String.Empty)
+ if (packageUri.Fragment != string.Empty)
throw new ArgumentException(SR.InnerPackageUriHasFragment);
return packageUri;
string partName = GetStringForPartUriFromAnyUri(packUri);
- if (partName == String.Empty)
+ if (partName == string.Empty)
return null;
else
return ValidatePartUri(new Uri(partName, UriKind.Relative));
if (numCharsRead > 1)
{
for (int i = 0; i < numCharsRead; i++)
- Debug.Assert((Char.IsSurrogate(_singleCharBuffer[i])), "number of chars read should be more than one only for surrogate characters!");
+ Debug.Assert((char.IsSurrogate(_singleCharBuffer[i])), "number of chars read should be more than one only for surrogate characters!");
}
#endif
Debug.Assert((numCharsRead > 0), "possible bug in ReadBufferIntoChars, reading surrogate char?");
private byte[] _tempBuf; // used to avoid multiple array allocations in ReadByte()
// called whenever any async i/o operation completes.
- private unsafe static readonly IOCompletionCallback s_IOCallback = new IOCompletionCallback(AsyncFSCallback);
+ private static unsafe readonly IOCompletionCallback s_IOCallback = new IOCompletionCallback(AsyncFSCallback);
// ----- new get-set properties -----------------*
com2.Write(xmitChars, 0, xmitChars.Length);
- // for(int i=0; i<xmitChars.Length; ++i) {
- // Debug.WriteLine("{0},", (int)xmitChars[i]);
- // }
+ // for(int i=0; i<xmitChars.Length; ++i) {
+ // Debug.WriteLine("{0},", (int)xmitChars[i]);
+ // }
while (com1.BytesToRead < xmitBytes.Length)
{
newReadBufferSize &= 0xFFFFFFFE; //Make sure the new buffer size is even by clearing the lowest order bit
- // if(!VerifyReadBufferSize((int)newReadBufferSize)){
+ // if(!VerifyReadBufferSize((int)newReadBufferSize)){
VerifyReadBufferSize(11620);
}
Random rndGen = new Random(-55);
com.ReadTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout);
- // com.Encoding = new System.Text.UTF7Encoding();
+ // com.Encoding = new System.Text.UTF7Encoding();
com.Encoding = Encoding.Unicode;
Debug.WriteLine("Verifying ReadTimeout={0} with successive call to read method and no data", com.ReadTimeout);
{
Random rndGen = new Random(-55);
- // if(!VerifyParityReplaceByte((int)'\0', rndGen.Next(0, numRndByte - 1), new System.Text.UTF7Encoding())){
+ // if(!VerifyParityReplaceByte((int)'\0', rndGen.Next(0, numRndByte - 1), new System.Text.UTF7Encoding())){
VerifyParityReplaceByte('\0', rndGen.Next(0, numRndByte - 1), new UTF32Encoding());
}
Random rndGen = new Random(-55);
com.ReadTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout);
- // com.Encoding = new System.Text.UTF7Encoding();
+ // com.Encoding = new System.Text.UTF7Encoding();
com.Encoding = Encoding.Unicode;
Debug.WriteLine("Verifying ReadTimeout={0} with successive call to read method and no data", com.ReadTimeout);
bytesRead = com1.Encoding.GetByteCount(rcvCharBuffer, 0, charsRead);
totalBytesRead += bytesRead + numNewLineBytes;
- // indexOfNewLine = strToWrite.IndexOf(com1.NewLine, lastIndexOfNewLine + newLineStringLength);
+ // indexOfNewLine = strToWrite.IndexOf(com1.NewLine, lastIndexOfNewLine + newLineStringLength);
indexOfNewLine = TCSupport.OrdinalIndexOf(expectedString, lastIndexOfNewLine + newLineStringLength, newLine);
//SerialPort does a Ordinal comparison
Random rndGen = new Random(-55);
com.ReadTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout);
- // com.Encoding = new System.Text.UTF7Encoding();
+ // com.Encoding = new System.Text.UTF7Encoding();
com.Encoding = Encoding.Unicode;
Debug.WriteLine("Verifying ReadTimeout={0} with successive call to read method and no data", com.ReadTimeout);
com.Open();
totalBytesRead += bytesRead + numNewLineBytes;
}
- // indexOfNewLine = strToWrite.IndexOf(newLine, lastIndexOfNewLine + newLineStringLength);
+ // indexOfNewLine = strToWrite.IndexOf(newLine, lastIndexOfNewLine + newLineStringLength);
int indexOfNewLine = TCSupport.OrdinalIndexOf(expectedString, lastIndexOfNewLine + newLineStringLength, newLine);
Random rndGen = new Random(-55);
com.ReadTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout);
- // com.Encoding = new System.Text.UTF7Encoding();
+ // com.Encoding = new System.Text.UTF7Encoding();
com.Encoding = Encoding.Unicode;
Debug.WriteLine("Verifying ReadTimeout={0} with successive call to read method and no data", com.ReadTimeout);
Random rndGen = new Random();
com.ReadTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout);
- // com.Encoding = new System.Text.UTF7Encoding();
+ // com.Encoding = new System.Text.UTF7Encoding();
com.Encoding = Encoding.Unicode;
Debug.WriteLine("Verifying ReadTimeout={0} with successive call to read method and no data", com.ReadTimeout);
com2.Write(byteXmitBuffer, 3, byteXmitBuffer.Length - 3);
- // retValue &= TCSupport.WaitForPredicate(delegate() {return com1.BytesToRead == byteXmitBuffer.Length; },
- // 5000, "Err_91818aheid Expected BytesToRead={0} actual={1}", byteXmitBuffer.Length, com1.BytesToRead);
+ // retValue &= TCSupport.WaitForPredicate(delegate() {return com1.BytesToRead == byteXmitBuffer.Length; },
+ // 5000, "Err_91818aheid Expected BytesToRead={0} actual={1}", byteXmitBuffer.Length, com1.BytesToRead);
TCSupport.WaitForExpected(() => com1.BytesToRead, byteXmitBuffer.Length,
5000, "Err_91818aheid BytesToRead");
for(int i=0; i<xmitCharBuffer.Length; ++i) {
Debug.WriteLine("{0}, ", (int)xmitByteBuffer[i]);
- }
+ }
}*/
}
}
com.ReadTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout);
- // com.Encoding = new System.Text.UTF7Encoding();
+ // com.Encoding = new System.Text.UTF7Encoding();
com.Encoding = Encoding.Unicode;
Debug.WriteLine("Verifying ReadTimeout={0} with successive call to read method and no data", com.ReadTimeout);
Math.Min(xmitCharBuffer.Length, maxNumberOfCharactes) + 1);
int expectedBytesToRead = com2.BytesToRead + 2 * numberOfCharacters;
- // Debug.WriteLine("Writing {0,5} characters BytesToRead={1,5}", numberOfCharacters, com2.BytesToRead);
+ // Debug.WriteLine("Writing {0,5} characters BytesToRead={1,5}", numberOfCharacters, com2.BytesToRead);
com1.Write(xmitCharBuffer, 0, numberOfCharacters);
buffer.Append(xmitCharBuffer, 0, numberOfCharacters);
int actualNumberOfCharactersRead;
int expectedBytesToRead = com2.BytesToRead - (2 * numberOfCharacters);
- // Debug.WriteLine("Reading {0,5} characters BytesToRead={1,5}", numberOfCharacters, com2.BytesToRead);
+ // Debug.WriteLine("Reading {0,5} characters BytesToRead={1,5}", numberOfCharacters, com2.BytesToRead);
actualNumberOfCharactersRead = com2.Read(rcvCharBuffer, 0, numberOfCharacters);
if (actualNumberOfCharactersRead == numberOfCharacters)
com.WriteTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout);
com.Handshake = Handshake.RequestToSendXOnXOff;
- // com.Encoding = new System.Text.UTF7Encoding();
+ // com.Encoding = new System.Text.UTF7Encoding();
com.Encoding = Encoding.Unicode;
Debug.WriteLine("Verifying WriteTimeout={0} with successive call to write method", com.WriteTimeout);
com.WriteTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout);
com.Handshake = Handshake.RequestToSendXOnXOff;
- // com.Encoding = new System.Text.UTF7Encoding();
+ // com.Encoding = new System.Text.UTF7Encoding();
com.Encoding = Encoding.Unicode;
Debug.WriteLine("Verifying WriteTimeout={0} with successive call to write method", com.WriteTimeout);
{
var rndGen = new Random(-55);
- // if(!VerifyParityReplaceByte((int)'\0', rndGen.Next(0, numRndBytesPairty - 1), new System.Text.UTF7Encoding())){
+ // if(!VerifyParityReplaceByte((int)'\0', rndGen.Next(0, numRndBytesPairty - 1), new System.Text.UTF7Encoding())){
VerifyParityReplaceByte((int)'\0', rndGen.Next(0, numRndBytesPairty - 1), Encoding.Unicode);
}
[ConditionalFact(nameof(HasNullModem))]
public void BytesToRead_1_Buffer_Size()
{
- // if(!VerifyBytesToRead(1, new System.Text.UTF7Encoding())){
+ // if(!VerifyBytesToRead(1, new System.Text.UTF7Encoding())){
VerifyBytesToRead(1, Encoding.UTF32);
}
com.WriteTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout);
com.Handshake = Handshake.RequestToSendXOnXOff;
- // com.Encoding = new System.Text.UTF7Encoding();
+ // com.Encoding = new System.Text.UTF7Encoding();
com.Encoding = Encoding.Unicode;
Debug.WriteLine("Verifying WriteTimeout={0} with successive call to write method",
com.WriteTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout);
com.Handshake = Handshake.RequestToSendXOnXOff;
- // com.Encoding = new System.Text.UTF7Encoding();
+ // com.Encoding = new System.Text.UTF7Encoding();
com.Encoding = Encoding.Unicode;
Debug.WriteLine("Verifying WriteTimeout={0} with successive call to write method", com.WriteTimeout);
return --readsLeft; // CopyTo will call Read on this ReadLimit times before stopping
});
- var src = new CallTrackingStream(srcBase);
+ var src = new CallTrackingStream(srcBase);
var destBase = new DelegateStream(
canWriteFunc: () => true,
return --readsLeft; // CopyTo will call Read on this ReadLimit times before stopping
});
- var src = new CallTrackingStream(srcBase);
+ var src = new CallTrackingStream(srcBase);
var destBase = new DelegateStream(
canWriteFunc: () => true,
public Expression Filter { get; }
/// <summary>
- /// Returns a <see cref="String"/> that represents the current <see cref="Object"/>.
+ /// Returns a <see cref="string"/> that represents the current <see cref="object"/>.
/// </summary>
- /// <returns>A <see cref="String"/> that represents the current <see cref="Object"/>.</returns>
+ /// <returns>A <see cref="string"/> that represents the current <see cref="object"/>.</returns>
public override string ToString()
{
return ExpressionStringBuilder.CatchBlockToString(this);
/// <summary>
/// Creates a <see cref="ConstantExpression"/> that has the <see cref="ConstantExpression.Value"/> property set to the specified value. .
/// </summary>
- /// <param name="value">An <see cref="Object"/> to set the <see cref="ConstantExpression.Value"/> property equal to.</param>
+ /// <param name="value">An <see cref="object"/> to set the <see cref="ConstantExpression.Value"/> property equal to.</param>
/// <returns>
/// A <see cref="ConstantExpression"/> that has the <see cref="NodeType"/> property equal to
/// <see cref="ExpressionType.Constant"/> and the <see cref="ConstantExpression.Value"/> property set to the specified value.
/// Creates a <see cref="ConstantExpression"/> that has the <see cref="ConstantExpression.Value"/>
/// and <see cref="ConstantExpression.Type"/> properties set to the specified values. .
/// </summary>
- /// <param name="value">An <see cref="Object"/> to set the <see cref="ConstantExpression.Value"/> property equal to.</param>
+ /// <param name="value">An <see cref="object"/> to set the <see cref="ConstantExpression.Value"/> property equal to.</param>
/// <param name="type">A <see cref="Type"/> to set the <see cref="Type"/> property equal to.</param>
/// <returns>
/// A <see cref="ConstantExpression"/> that has the <see cref="NodeType"/> property equal to
public int ArgumentCount => Arguments.Count;
/// <summary>
- /// Creates a <see cref="String"/> representation of the node.
+ /// Creates a <see cref="string"/> representation of the node.
/// </summary>
- /// <returns>A <see cref="String"/> representation of the node.</returns>
+ /// <returns>A <see cref="string"/> representation of the node.</returns>
public override string ToString()
{
return ExpressionStringBuilder.ElementInitBindingToString(this);
}
/// <summary>
- /// Creates a <see cref="String"/> representation of the Expression.
+ /// Creates a <see cref="string"/> representation of the Expression.
/// </summary>
- /// <returns>A <see cref="String"/> representation of the Expression.</returns>
+ /// <returns>A <see cref="string"/> representation of the Expression.</returns>
public override string ToString()
{
return ExpressionStringBuilder.ExpressionToString(this);
}
/// <summary>
- /// Creates a <see cref="String"/> representation of the Expression.
+ /// Creates a <see cref="string"/> representation of the Expression.
/// </summary>
- /// <returns>A <see cref="String"/> representation of the Expression.</returns>
+ /// <returns>A <see cref="string"/> representation of the Expression.</returns>
private string DebugView
{
// Note that this property is often accessed using reflection. As such it will have more dependencies than one
public Type Type { get; }
/// <summary>
- /// Returns a <see cref="String"/> that represents the current <see cref="Object"/>.
+ /// Returns a <see cref="string"/> that represents the current <see cref="object"/>.
/// </summary>
- /// <returns>A <see cref="String"/> that represents the current <see cref="Object"/>.</returns>
+ /// <returns>A <see cref="string"/> that represents the current <see cref="object"/>.</returns>
public override string ToString()
{
return string.IsNullOrEmpty(Name) ? "UnamedLabel" : Name;
public MemberInfo Member { get; }
/// <summary>
- /// Returns a <see cref="String"/> that represents the current <see cref="Object"/>.
+ /// Returns a <see cref="string"/> that represents the current <see cref="object"/>.
/// </summary>
- /// <returns>A <see cref="String"/> that represents the current <see cref="Object"/>.</returns>
+ /// <returns>A <see cref="string"/> that represents the current <see cref="object"/>.</returns>
public override string ToString()
{
return ExpressionStringBuilder.MemberBindingToString(this);
/// <exception cref="ArgumentNullException">
/// <paramref name="array"/> or <paramref name="indexes"/> is null.</exception>
/// <exception cref="ArgumentException">
- /// <paramref name="array"/>.Type does not represent an array type.-or-The rank of <paramref name="array"/>.Type does not match the number of elements in <paramref name="indexes"/>.-or-The <see cref="Expression.Type"/> property of one or more elements of <paramref name="indexes"/> does not represent the <see cref="Int32"/> type.</exception>
+ /// <paramref name="array"/>.Type does not represent an array type.-or-The rank of <paramref name="array"/>.Type does not match the number of elements in <paramref name="indexes"/>.-or-The <see cref="Expression.Type"/> property of one or more elements of <paramref name="indexes"/> does not represent the <see cref="int"/> type.</exception>
public static MethodCallExpression ArrayIndex(Expression array, IEnumerable<Expression> indexes)
{
ExpressionUtils.RequiresCanRead(array, nameof(array), -1);
public Expression Body { get; }
/// <summary>
- /// Returns a <see cref="String"/> that represents the current <see cref="Object"/>.
+ /// Returns a <see cref="string"/> that represents the current <see cref="object"/>.
/// </summary>
- /// <returns>A <see cref="String"/> that represents the current <see cref="Object"/>.</returns>
+ /// <returns>A <see cref="string"/> that represents the current <see cref="object"/>.</returns>
public override string ToString()
{
return ExpressionStringBuilder.SwitchCaseToString(this);
/// <summary>
/// Creates an instance of <see cref="SymbolDocumentInfo"/>.
/// </summary>
- /// <param name="fileName">A <see cref="String"/> to set the <see cref="SymbolDocumentInfo.FileName"/> equal to.</param>
+ /// <param name="fileName">A <see cref="string"/> to set the <see cref="SymbolDocumentInfo.FileName"/> equal to.</param>
/// <returns>A <see cref="SymbolDocumentInfo"/> that has the <see cref="SymbolDocumentInfo.FileName"/> property set to the specified value.</returns>
public static SymbolDocumentInfo SymbolDocument(string fileName)
{
/// <summary>
/// Creates an instance of <see cref="SymbolDocumentInfo"/>.
/// </summary>
- /// <param name="fileName">A <see cref="String"/> to set the <see cref="SymbolDocumentInfo.FileName"/> equal to.</param>
+ /// <param name="fileName">A <see cref="string"/> to set the <see cref="SymbolDocumentInfo.FileName"/> equal to.</param>
/// <param name="language">A <see cref="Guid"/> to set the <see cref="SymbolDocumentInfo.Language"/> equal to.</param>
/// <returns>A <see cref="SymbolDocumentInfo"/> that has the <see cref="SymbolDocumentInfo.FileName"/>
/// and <see cref="SymbolDocumentInfo.Language"/> properties set to the specified value.</returns>
/// <summary>
/// Creates an instance of <see cref="SymbolDocumentInfo"/>.
/// </summary>
- /// <param name="fileName">A <see cref="String"/> to set the <see cref="SymbolDocumentInfo.FileName"/> equal to.</param>
+ /// <param name="fileName">A <see cref="string"/> to set the <see cref="SymbolDocumentInfo.FileName"/> equal to.</param>
/// <param name="language">A <see cref="Guid"/> to set the <see cref="SymbolDocumentInfo.Language"/> equal to.</param>
/// <param name="languageVendor">A <see cref="Guid"/> to set the <see cref="SymbolDocumentInfo.LanguageVendor"/> equal to.</param>
/// <returns>A <see cref="SymbolDocumentInfo"/> that has the <see cref="SymbolDocumentInfo.FileName"/>
/// <summary>
/// Creates an instance of <see cref="SymbolDocumentInfo"/>.
/// </summary>
- /// <param name="fileName">A <see cref="String"/> to set the <see cref="SymbolDocumentInfo.FileName"/> equal to.</param>
+ /// <param name="fileName">A <see cref="string"/> to set the <see cref="SymbolDocumentInfo.FileName"/> equal to.</param>
/// <param name="language">A <see cref="Guid"/> to set the <see cref="SymbolDocumentInfo.Language"/> equal to.</param>
/// <param name="languageVendor">A <see cref="Guid"/> to set the <see cref="SymbolDocumentInfo.LanguageVendor"/> equal to.</param>
/// <param name="documentType">A <see cref="Guid"/> to set the <see cref="SymbolDocumentInfo.DocumentType"/> equal to.</param>
namespace System.Runtime.CompilerServices
{
/// <summary>
- /// Indicates that the use of <see cref="System.Object"/> on a member is meant to be treated as a dynamically dispatched type.
+ /// Indicates that the use of <see cref="object"/> on a member is meant to be treated as a dynamically dispatched type.
/// </summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue | AttributeTargets.Class | AttributeTargets.Struct)]
public sealed class DynamicAttribute : Attribute
/// When used in an attribute specification, the default constructor is semantically
/// equivalent to <c>DynamicAttribute({ true })</c>, and can be considered
/// a shorthand for that expression. It should therefore only be used on an element
- /// of type <see cref="System.Object"/>.
+ /// of type <see cref="object"/>.
/// </remarks>
public DynamicAttribute()
{
/// Initializes a new instance of the <see cref="DynamicAttribute"/> class.
/// </summary>
/// <param name="transformFlags">Specifies, in a prefix traversal of a type's
- /// construction, which <see cref="System.Object"/> occurrences are meant to
+ /// construction, which <see cref="object"/> occurrences are meant to
/// be treated as a dynamically dispatched type.</param>
/// <remarks>
/// This constructor is meant to be used on types that are built on an underlying
- /// occurrence of <see cref="System.Object"/> that is meant to be treated dynamically.
+ /// occurrence of <see cref="object"/> that is meant to be treated dynamically.
/// For instance, if <c>C</c> is a generic type with two type parameters, then a
- /// use of the constructed type<c>C<<see cref="System.Object"/>, <see cref="System.Object"/>></c>
+ /// use of the constructed type<c>C<<see cref="object"/>, <see cref="object"/>></c>
/// might be intended to treat the first type argument dynamically and the second
/// normally, in which case the appropriate attribute specification should
/// use a <c>transformFlags</c> value of <c>{ false, true, false }</c>.
/// <summary>
/// Specifies, in a prefix traversal of a type's
- /// construction, which <see cref="System.Object"/> occurrences are meant to
+ /// construction, which <see cref="object"/> occurrences are meant to
/// be treated as a dynamically dispatched type.
/// </summary>
public IList<bool> TransformFlags
/// <exception cref="System.ArgumentOutOfRangeException">
/// <paramref name="count"/> is less than 0
/// -or-
- /// <paramref name="start"/> + <paramref name="count"/> - 1 is larger than <see cref="System.Int32.MaxValue"/>.
+ /// <paramref name="start"/> + <paramref name="count"/> - 1 is larger than <see cref="int.MaxValue"/>.
/// </exception>
public static ParallelQuery<int> Range(int start, int count)
{
/// <paramref name="source"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The number of elements in source is larger than <see cref="System.Int32.MaxValue"/>.
+ /// The number of elements in source is larger than <see cref="int.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> or <paramref name="predicate"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The number of elements in source is larger than <see cref="System.Int32.MaxValue"/>.
+ /// The number of elements in source is larger than <see cref="int.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The number of elements in source is larger than <see cref="System.Int64.MaxValue"/>.
+ /// The number of elements in source is larger than <see cref="long.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> or <paramref name="predicate"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The number of elements in source is larger than <see cref="System.Int64.MaxValue"/>.
+ /// The number of elements in source is larger than <see cref="long.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum is larger than <see cref="System.Int32.MaxValue"/>.
+ /// The sum is larger than <see cref="int.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum is larger than <see cref="System.Int32.MaxValue"/>.
+ /// The sum is larger than <see cref="int.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum is larger than <see cref="System.Int64.MaxValue"/>.
+ /// The sum is larger than <see cref="long.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum is larger than <see cref="System.Int64.MaxValue"/>.
+ /// The sum is larger than <see cref="long.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum is larger than <see cref="System.Decimal.MaxValue"/>.
+ /// The sum is larger than <see cref="decimal.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum is larger than <see cref="System.Decimal.MaxValue"/>.
+ /// The sum is larger than <see cref="decimal.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> or <paramref name="selector"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum is larger than <see cref="System.Int32.MaxValue"/>.
+ /// The sum is larger than <see cref="int.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> or <paramref name="selector"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum is larger than <see cref="System.Int32.MaxValue"/>.
+ /// The sum is larger than <see cref="int.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> or <paramref name="selector"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum is larger than <see cref="System.Int64.MaxValue"/>.
+ /// The sum is larger than <see cref="long.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> or <paramref name="selector"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum is larger than <see cref="System.Int64.MaxValue"/>.
+ /// The sum is larger than <see cref="long.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> or <paramref name="selector"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum is larger than <see cref="System.Decimal.MaxValue"/>.
+ /// The sum is larger than <see cref="decimal.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> or <paramref name="selector"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum is larger than <see cref="System.Decimal.MaxValue"/>.
+ /// The sum is larger than <see cref="decimal.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> contains no elements.
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum or count of the elements in the sequence is larger than <see cref="System.Int32.MaxValue"/>.
+ /// The sum or count of the elements in the sequence is larger than <see cref="int.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum or count of the elements in the sequence is larger than <see cref="System.Int32.MaxValue"/>.
+ /// The sum or count of the elements in the sequence is larger than <see cref="int.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> contains no elements.
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum or count of the elements in the sequence is larger than <see cref="System.Int32.MaxValue"/>.
+ /// The sum or count of the elements in the sequence is larger than <see cref="int.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum or count of the elements in the sequence is larger than <see cref="System.Int32.MaxValue"/>.
+ /// The sum or count of the elements in the sequence is larger than <see cref="int.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> contains no elements.
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum or count of the elements in the sequence is larger than <see cref="System.Int32.MaxValue"/>.
+ /// The sum or count of the elements in the sequence is larger than <see cref="int.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> or <paramref name="selector"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum or count of the elements in the sequence is larger than <see cref="System.Int32.MaxValue"/>.
+ /// The sum or count of the elements in the sequence is larger than <see cref="int.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> contains no elements.
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum or count of the elements in the sequence is larger than <see cref="System.Int32.MaxValue"/>.
+ /// The sum or count of the elements in the sequence is larger than <see cref="int.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// <paramref name="source"/> or <paramref name="selector"/> is a null reference (Nothing in Visual Basic).
/// </exception>
/// <exception cref="System.AggregateException">
- /// The sum or count of the elements in the sequence is larger than <see cref="System.Int64.MaxValue"/>.
+ /// The sum or count of the elements in the sequence is larger than <see cref="long.MaxValue"/>.
/// -or-
/// One or more exceptions occurred during the evaluation of the query.
/// </exception>
/// </summary>
/// <param name='propertyName'>The name of the property of interest. </param>
/// <value>
- /// An <see cref='System.Object'/> containing the
+ /// An <see cref='object'/> containing the
/// value of the requested property.
/// </value>
public object this[string propertyName]
namespace System.Management
{
- //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
+ //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
/// <summary>
/// <para> Represents a CIM management class from WMI. CIM (Common Information Model) classes
- /// represent management information including hardware, software, processes, etc.
- /// For more information about the CIM classes available in Windows search for �win32 classes�.</para>
+ /// represent management information including hardware, software, processes, etc.
+ /// For more information about the CIM classes available in Windows search for �win32 classes�.</para>
/// </summary>
/// <example>
/// <code lang='C#'>using System;
// (Options, Path and Scope) would mark it as unbound
//
// ***
- // * Changed isBound flag to wbemObject==null check.
- // * newClass.IsBound = true;
+ // * Changed isBound flag to wbemObject==null check.
+ // * newClass.IsBound = true;
// ***
}
//The only flags in EnumerationOptions not valid for enumerations are EnsureLocatable & PrototypeOnly.
o.EnsureLocatable = false; o.PrototypeOnly = false;
- SecurityHandler securityHandler = null;
- int status = (int)ManagementStatus.NoError;
+ SecurityHandler securityHandler = null;
+ int status = (int)ManagementStatus.NoError;
try
{
WmiEventSink sink = watcher.GetNewSink(Scope, o.Context);
- SecurityHandler securityHandler = null;
- int status = (int)ManagementStatus.NoError;
+ SecurityHandler securityHandler = null;
+ int status = (int)ManagementStatus.NoError;
securityHandler = Scope.GetSecurityHandler();
o.EnsureLocatable = false; o.PrototypeOnly = false;
SecurityHandler securityHandler = null;
- int status = (int)ManagementStatus.NoError;
+ int status = (int)ManagementStatus.NoError;
try
{
/// <param name='options'>The specified additional options to use in the derived class retrieval.</param>
public void GetSubclasses(ManagementOperationObserver watcher,
EnumerationOptions options)
- {
+ {
if (null == watcher)
throw new ArgumentNullException(nameof(watcher));
WmiEventSink sink = watcher.GetNewSink(Scope, o.Context);
SecurityHandler securityHandler = null;
- int status = (int)ManagementStatus.NoError;
+ int status = (int)ManagementStatus.NoError;
securityHandler = Scope.GetSecurityHandler();
//Ensure EnumerateDeep flag bit is turned off as it's invalid for queries
o.EnumerateDeep = true;
- RelatedObjectQuery q = new RelatedObjectQuery(true, Path.Path,
+ RelatedObjectQuery q = new RelatedObjectQuery(true, Path.Path,
relatedClass,
relationshipClass,
relatedQualifier,
relatedRole, thisRole);
SecurityHandler securityHandler = null;
- int status = (int)ManagementStatus.NoError;
+ int status = (int)ManagementStatus.NoError;
try
{
relatedRole, thisRole);
SecurityHandler securityHandler = null;
- int status = (int)ManagementStatus.NoError;
+ int status = (int)ManagementStatus.NoError;
securityHandler = Scope.GetSecurityHandler();
relationshipQualifier, thisRole);
SecurityHandler securityHandler = null;
- int status = (int)ManagementStatus.NoError;
+ int status = (int)ManagementStatus.NoError;
//Execute WMI query
try
relationshipQualifier, thisRole);
SecurityHandler securityHandler = null;
- int status = (int)ManagementStatus.NoError;
+ int status = (int)ManagementStatus.NoError;
securityHandler = Scope.GetSecurityHandler();
/// <summary>
/// <para>Converts a given DMTF datetime to <see cref='System.DateTime'/> object. The returned DateTime will be in the
- /// current TimeZone of the system.</para>
+ /// current TimeZone of the system.</para>
/// </summary>
/// <param name='dmtfDate'>A string representing the datetime in DMTF format.</param>
/// <returns>
/// <para>A <see cref='System.DateTime'/> object that represents the given DMTF datetime.</para>
/// </returns>
/// <remarks>
- /// <para> Date and time in WMI is represented in DMTF datetime format. This format is explained in WMI SDK documentation.
- /// DMTF datetime string has an UTC offset which this datetime string represents.
- /// During conversion to <see cref='System.DateTime'/>, UTC offset is used to convert the date to the
- /// current timezone. According to DMTF format a particular field can be represented by the character
- /// '*'. This will be converted to the MinValue of this field that can be represented in <see cref='System.DateTime'/>.
- /// </para>
+ /// <para> Date and time in WMI is represented in DMTF datetime format. This format is explained in WMI SDK documentation.
+ /// DMTF datetime string has an UTC offset which this datetime string represents.
+ /// During conversion to <see cref='System.DateTime'/>, UTC offset is used to convert the date to the
+ /// current timezone. According to DMTF format a particular field can be represented by the character
+ /// '*'. This will be converted to the MinValue of this field that can be represented in <see cref='System.DateTime'/>.
+ /// </para>
/// </remarks>
/// <example>
/// <code lang='C#'>
- /// // Convert a DMTF datetime to System.DateTime
- /// DateTime date = ManagementDateTimeConverter.ToDateTime("20020408141835.999999-420");
+ /// // Convert a DMTF datetime to System.DateTime
+ /// DateTime date = ManagementDateTimeConverter.ToDateTime("20020408141835.999999-420");
/// </code>
/// <code lang='VB'>
- /// ' Convert a DMTF datetime to System.DateTime
- /// Dim date as DateTime = ManagementDateTimeConverter.ToDateTime("20020408141835.999999-420")
+ /// ' Convert a DMTF datetime to System.DateTime
+ /// Dim date as DateTime = ManagementDateTimeConverter.ToDateTime("20020408141835.999999-420")
/// </code>
/// </example>
public static DateTime ToDateTime(string dmtfDate)
/// <summary>
/// <para>Converts a given <see cref='System.DateTime'/> object to DMTF format.</para>
- ///
+ ///
/// </summary>
/// <param name='date'>A <see cref='System.DateTime'/> object representing the datetime to be converted to DMTF datetime.</param>
/// <returns>
/// <para>A string that represents the DMTF datetime for the given DateTime object.</para>
/// </returns>
/// <remarks>
- /// <para> Date and time in WMI is represented in DMTF datetime format. This format is explained in WMI SDK documentation.
- /// The DMTF datetime string represented will be with respect to the UTC offset of the
- /// current timezone. The lowest precision in DMTF is microseconds and
- /// in <see cref='System.DateTime'/> is Ticks , which is equivalent to 100 of nanoseconds.
- /// During conversion these Ticks are converted to microseconds and rounded
- /// off to the nearest microsecond.
- /// </para>
+ /// <para> Date and time in WMI is represented in DMTF datetime format. This format is explained in WMI SDK documentation.
+ /// The DMTF datetime string represented will be with respect to the UTC offset of the
+ /// current timezone. The lowest precision in DMTF is microseconds and
+ /// in <see cref='System.DateTime'/> is Ticks , which is equivalent to 100 of nanoseconds.
+ /// During conversion these Ticks are converted to microseconds and rounded
+ /// off to the nearest microsecond.
+ /// </para>
/// </remarks>
/// <example>
/// <code lang='C#'>
- /// // Convert the current time in System.DateTime to DMTF format
- /// string dmtfDateTime = ManagementDateTimeConverter.ToDmtfDateTime(DateTime.Now);
+ /// // Convert the current time in System.DateTime to DMTF format
+ /// string dmtfDateTime = ManagementDateTimeConverter.ToDmtfDateTime(DateTime.Now);
/// </code>
/// <code lang='VB'>
- /// ' Convert the current time in System.DateTime to DMTF format
- /// Dim dmtfDateTime as String = ManagementDateTimeConverter.ToDmtfDateTime(DateTime.Now)
+ /// ' Convert the current time in System.DateTime to DMTF format
+ /// Dim dmtfDateTime as String = ManagementDateTimeConverter.ToDmtfDateTime(DateTime.Now)
/// </code>
/// </example>
public static string ToDmtfDateTime(DateTime date)
string strMicrosec = microsec.ToString((IFormatProvider)CultureInfo.InvariantCulture.GetFormat(typeof(long)));
if(strMicrosec.Length > 6)
{
- strMicrosec = strMicrosec.Substring(0,6);
+ strMicrosec = strMicrosec.Substring(0,6);
}
dmtfDateTime = dmtfDateTime + strMicrosec.PadLeft(6,'0');
// adding the UTC offset
/// <para>A <see cref='System.TimeSpan'/> object that represents the given DMTF time interval.</para>
/// </returns>
/// <remarks>
- /// <para> Time interval in WMI is represented in DMTF format. This format is explained in WMI SDK documentation.
- /// If the DMTF time interval value is more than that of
- /// <see cref='System.TimeSpan.MaxValue'/> then <see cref='System.ArgumentOutOfRangeException'/> is thrown.
- /// </para>
+ /// <para> Time interval in WMI is represented in DMTF format. This format is explained in WMI SDK documentation.
+ /// If the DMTF time interval value is more than that of
+ /// <see cref='System.TimeSpan.MaxValue'/> then <see cref='System.ArgumentOutOfRangeException'/> is thrown.
+ /// </para>
/// </remarks>
/// <example>
/// <code lang='C#'>
- /// // Convert a DMTF time interval to System.TimeSpan
- /// TimeSpan dmtfTimeInterval = ManagementDateTimeConverter.ToTimeSpan("00000010122532:123456:000");
+ /// // Convert a DMTF time interval to System.TimeSpan
+ /// TimeSpan dmtfTimeInterval = ManagementDateTimeConverter.ToTimeSpan("00000010122532:123456:000");
/// </code>
/// <code lang='VB'>
- /// ' Convert a DMTF time interval to System.TimeSpan
- /// Dim ts as TimeSpan = ManagementDateTimeConverter.ToTimeSpan("00000010122532:123456:000")
+ /// ' Convert a DMTF time interval to System.TimeSpan
+ /// Dim ts as TimeSpan = ManagementDateTimeConverter.ToTimeSpan("00000010122532:123456:000")
/// </code>
/// </example>
public static TimeSpan ToTimeSpan(string dmtfTimespan)
/// <para>A string that represents the DMTF time interval for the given TimeSpan object.</para>
/// </returns>
/// <remarks>
- /// <para> Time interval in WMI is represented in DMTF datetime format. This format
- /// is explained in WMI SDK documentation. The lowest precision in
- /// DMTF is microseconds and in <see cref='System.TimeSpan'/> is Ticks , which is equivalent
- /// to 100 of nanoseconds.During conversion these Ticks are converted to
- /// microseconds and rounded off to the nearest microsecond.
- /// </para>
+ /// <para> Time interval in WMI is represented in DMTF datetime format. This format
+ /// is explained in WMI SDK documentation. The lowest precision in
+ /// DMTF is microseconds and in <see cref='System.TimeSpan'/> is Ticks , which is equivalent
+ /// to 100 of nanoseconds.During conversion these Ticks are converted to
+ /// microseconds and rounded off to the nearest microsecond.
+ /// </para>
/// </remarks>
/// <example>
/// <code lang='C#'>
- /// // Construct a Timespan object and convert it to DMTF format
- /// System.TimeSpan ts = new System.TimeSpan(10,12,25,32,456);
- /// String dmtfTimeInterval = ManagementDateTimeConverter.ToDmtfTimeInterval(ts);
+ /// // Construct a Timespan object and convert it to DMTF format
+ /// System.TimeSpan ts = new System.TimeSpan(10,12,25,32,456);
+ /// String dmtfTimeInterval = ManagementDateTimeConverter.ToDmtfTimeInterval(ts);
/// </code>
/// <code lang='VB'>
- /// // Construct a Timespan object and convert it to DMTF format
- /// Dim ts as System.TimeSpan = new System.TimeSpan(10,12,25,32,456)
- /// Dim dmtfTimeInterval as String = ManagementDateTimeConverter.ToDmtfTimeInterval(ts)
+ /// // Construct a Timespan object and convert it to DMTF format
+ /// Dim ts as System.TimeSpan = new System.TimeSpan(10,12,25,32,456)
+ /// Dim dmtfTimeInterval as String = ManagementDateTimeConverter.ToDmtfTimeInterval(ts)
/// </code>
/// </example>
public static string ToDmtfTimeInterval(TimeSpan timespan)
{
- string dmtftimespan = timespan.Days.ToString((IFormatProvider)CultureInfo.InvariantCulture.GetFormat(typeof(System.Int32))).PadLeft(8,'0');
+ string dmtftimespan = timespan.Days.ToString((IFormatProvider)CultureInfo.InvariantCulture.GetFormat(typeof(int))).PadLeft(8,'0');
IFormatProvider frmInt32 = (IFormatProvider)CultureInfo.InvariantCulture.GetFormat(typeof(int));
// Days that can be represented is more than what can be represented
long microsec = ((timespan.Ticks-tsTemp.Ticks) * 1000) / System.TimeSpan.TicksPerMillisecond;
// fill the microseconds field
- string strMicrosec = microsec.ToString((IFormatProvider)CultureInfo.InvariantCulture.GetFormat(typeof(long)));
+ string strMicrosec = microsec.ToString((IFormatProvider)CultureInfo.InvariantCulture.GetFormat(typeof(long)));
if(strMicrosec.Length > 6)
{
- strMicrosec = strMicrosec.Substring(0,6);
+ strMicrosec = strMicrosec.Substring(0,6);
}
dmtftimespan = dmtftimespan + strMicrosec.PadLeft(6,'0');
/// </summary>
public class ProgressEventArgs : ManagementEventArgs
{
- private int upperBound;
- private int current;
- private string message;
+ private int upperBound;
+ private int current;
+ private string message;
/// <summary>
/// Constructor
/// <summary>
/// The operation was successful.
/// </summary>
- NoError = 0,
+ NoError = 0,
/// <summary>
/// <para> This value is returned when no more objects
/// are available, the number of objects returned is less than the number requested,
/// or at the end of an enumeration. It is also returned when the method is called
/// with a value of 0 for the "uCount" parameter.</para>
/// </summary>
- False = 1,
+ False = 1,
/// <summary>
/// <para>An overridden property was deleted. This value is
/// returned to signal that the original, non-overridden value has been restored as a
/// result of the deletion.</para>
/// </summary>
- ResetToDefault = 0x40002,
+ ResetToDefault = 0x40002,
/// <summary>
/// <para> The compared items (such as objects and classes)
/// are not identical.</para>
/// </summary>
- Different = 0x40003,
+ Different = 0x40003,
/// <summary>
/// <para> A call timed out. This is not an
/// error condition; therefore, some results may have been returned.</para>
/// </summary>
- Timedout = 0x40004,
+ Timedout = 0x40004,
/// <summary>
/// <para> No more data is available from the enumeration; the
/// user should terminate the enumeration. </para>
/// </summary>
- NoMoreData = 0x40005,
+ NoMoreData = 0x40005,
/// <summary>
/// <para> The operation was
/// canceled.</para>
/// </summary>
- OperationCanceled = 0x40006,
+ OperationCanceled = 0x40006,
/// <summary>
/// <para>A request is still in progress; however, the results are not
/// yet available.</para>
/// </summary>
- Pending = 0x40007,
+ Pending = 0x40007,
/// <summary>
/// <para> More than one copy of the same object was detected in
/// the result set of an enumeration. </para>
/// </summary>
- DuplicateObjects = 0x40008,
+ DuplicateObjects = 0x40008,
/// <summary>
/// <para>The user did not receive all of the requested objects
/// because of inaccessible resources (other than security violations).</para>
/// </summary>
- PartialResults = 0x40010,
+ PartialResults = 0x40010,
/// <summary>
/// <para>The call failed.</para>
/// </summary>
/// A provider referenced in the schema does not have a
/// corresponding registration.
/// </summary>
- ProviderNotFound = unchecked((int)0x80041011),
+ ProviderNotFound = unchecked((int)0x80041011),
/// <summary>
/// A provider referenced in the schema has an incorrect or
/// incomplete registration.
/// </summary>
- InvalidProviderRegistration = unchecked((int)0x80041012),
+ InvalidProviderRegistration = unchecked((int)0x80041012),
/// <summary>
/// COM cannot locate a provider referenced in the schema.
/// </summary>
- ProviderLoadFailure = unchecked((int)0x80041013),
+ ProviderLoadFailure = unchecked((int)0x80041013),
/// <summary>
/// A component, such as a provider, failed to initialize for internal reasons.
/// </summary>
/// <summary>
/// <para>The requested query language is not supported.</para>
/// </summary>
- InvalidQueryType = unchecked((int)0x80041018),
+ InvalidQueryType = unchecked((int)0x80041018),
/// <summary>
/// <para>In a put operation, the <see langword='wbemChangeFlagCreateOnly'/>
/// flag was specified, but the instance already exists.</para>
/// <para>The add operation cannot be performed on the qualifier
/// because the owning object does not permit overrides.</para>
/// </summary>
- OverrideNotAllowed = unchecked((int)0x8004101A),
+ OverrideNotAllowed = unchecked((int)0x8004101A),
/// <summary>
/// <para> The user attempted to delete a qualifier that was not
/// owned. The qualifier was inherited from a parent class. </para>
/// on a property that cannot be a key. The keys are specified in the class
/// definition for an object and cannot be altered on a per-instance basis.</para>
/// </summary>
- CannotBeKey = unchecked((int)0x8004101F),
+ CannotBeKey = unchecked((int)0x8004101F),
/// <summary>
/// <para>The current object is not a valid class definition.
/// Either it is incomplete, or it has not been registered with WMI using
/// as requesting a query that is too complex, retrieving an instance, creating or
/// updating a class, deleting a class, or enumerating a class. </para>
/// </summary>
- ProviderNotCapable = unchecked((int)0x80041024),
+ ProviderNotCapable = unchecked((int)0x80041024),
/// <summary>
/// <para>An attempt was made to make a change that would
/// invalidate a derived class.</para>
/// </summary>
- ClassHasChildren = unchecked((int)0x80041025),
+ ClassHasChildren = unchecked((int)0x80041025),
/// <summary>
/// <para> An attempt has been made to delete or modify a class that
/// has instances. </para>
/// </summary>
- ClassHasInstances = unchecked((int)0x80041026),
+ ClassHasInstances = unchecked((int)0x80041026),
/// <summary>
/// Reserved for future use.
/// </summary>
- QueryNotImplemented = unchecked((int)0x80041027),
+ QueryNotImplemented = unchecked((int)0x80041027),
/// <summary>
/// <para> A value of null was specified for a property that may
/// not be null, such as one that is marked by a <see langword='Key'/>, <see langword='Indexed'/>, or
/// <para> The value provided for a qualifier was not a
/// legal qualifier type.</para>
/// </summary>
- InvalidQualifierType = unchecked((int)0x80041029),
+ InvalidQualifierType = unchecked((int)0x80041029),
/// <summary>
/// The CIM type specified for a property is not valid.
/// </summary>
- InvalidPropertyType = unchecked((int)0x8004102A),
+ InvalidPropertyType = unchecked((int)0x8004102A),
/// <summary>
/// <para> The request was made with an out-of-range value, or is
/// incompatible with the type. </para>
/// </summary>
- ValueOutOfRange = unchecked((int)0x8004102B),
+ ValueOutOfRange = unchecked((int)0x8004102B),
/// <summary>
/// <para>An illegal attempt was made to make a class singleton,
/// such as when the class is derived from a non-singleton class.</para>
/// </summary>
- CannotBeSingleton = unchecked((int)0x8004102C),
+ CannotBeSingleton = unchecked((int)0x8004102C),
/// <summary>
/// The CIM type specified is not valid.
/// </summary>
- InvalidCimType = unchecked((int)0x8004102D),
+ InvalidCimType = unchecked((int)0x8004102D),
/// <summary>
/// The requested method is not available.
/// </summary>
/// <para> The parameters provided for the method are not valid.
/// </para>
/// </summary>
- InvalidMethodParameters = unchecked((int)0x8004102F),
+ InvalidMethodParameters = unchecked((int)0x8004102F),
/// <summary>
/// There was an attempt to get qualifiers on a system
/// property.
/// <summary>
/// A parameter was missing from the method call.
/// </summary>
- MissingParameterID = unchecked((int)0x80041036),
+ MissingParameterID = unchecked((int)0x80041036),
/// <summary>
/// A method parameter has an invalid <see langword='ID'/> qualifier.
/// </summary>
- InvalidParameterID = unchecked((int)0x80041037),
+ InvalidParameterID = unchecked((int)0x80041037),
/// <summary>
/// <para> One or more of the method parameters have <see langword='ID'/>
/// qualifiers that are out of sequence. </para>
/// </summary>
- NonconsecutiveParameterIDs = unchecked((int)0x80041038),
+ NonconsecutiveParameterIDs = unchecked((int)0x80041038),
/// <summary>
/// <para> The return value for a method has an <see langword='ID'/> qualifier.
/// </para>
/// </summary>
- ParameterIDOnRetval = unchecked((int)0x80041039),
+ ParameterIDOnRetval = unchecked((int)0x80041039),
/// <summary>
/// The specified object path was invalid.
/// </summary>
- InvalidObjectPath = unchecked((int)0x8004103A),
+ InvalidObjectPath = unchecked((int)0x8004103A),
/// <summary>
/// <para> There is not enough free disk space to continue the
/// operation. </para>
/// </summary>
- OutOfDiskSpace = unchecked((int)0x8004103B),
+ OutOfDiskSpace = unchecked((int)0x8004103B),
/// <summary>
/// <para> The supplied buffer was too small to hold all the objects
/// in the enumerator or to read a string property. </para>
/// </summary>
- BufferTooSmall = unchecked((int)0x8004103C),
+ BufferTooSmall = unchecked((int)0x8004103C),
/// <summary>
/// The provider does not support the requested put
/// operation.
/// </summary>
- UnsupportedPutExtension = unchecked((int)0x8004103D),
+ UnsupportedPutExtension = unchecked((int)0x8004103D),
/// <summary>
/// <para> An object with an incorrect type or version was
/// encountered during marshaling. </para>
/// </summary>
- UnknownObjectType = unchecked((int)0x8004103E),
+ UnknownObjectType = unchecked((int)0x8004103E),
/// <summary>
/// <para> A packet with an incorrect type or version was
/// encountered during marshaling. </para>
/// </summary>
- UnknownPacketType = unchecked((int)0x8004103F),
+ UnknownPacketType = unchecked((int)0x8004103F),
/// <summary>
/// The packet has an unsupported version.
/// </summary>
- MarshalVersionMismatch = unchecked((int)0x80041040),
+ MarshalVersionMismatch = unchecked((int)0x80041040),
/// <summary>
/// <para>The packet is corrupted.</para>
/// </summary>
- MarshalInvalidSignature = unchecked((int)0x80041041),
+ MarshalInvalidSignature = unchecked((int)0x80041041),
/// <summary>
/// An attempt has been made to mismatch qualifiers, such as
/// putting [key] on an object instead of a property.
/// </summary>
- InvalidQualifier = unchecked((int)0x80041042),
+ InvalidQualifier = unchecked((int)0x80041042),
/// <summary>
/// A duplicate parameter has been declared in a CIM method.
/// </summary>
- InvalidDuplicateParameter = unchecked((int)0x80041043),
+ InvalidDuplicateParameter = unchecked((int)0x80041043),
/// <summary>
/// <para> Reserved for future use. </para>
/// </summary>
- TooMuchData = unchecked((int)0x80041044),
+ TooMuchData = unchecked((int)0x80041044),
/// <summary>
/// <para>The delivery of an event has failed. The provider may
/// choose to re-raise the event.</para>
/// </summary>
- ServerTooBusy = unchecked((int)0x80041045),
+ ServerTooBusy = unchecked((int)0x80041045),
/// <summary>
/// The specified flavor was invalid.
/// </summary>
- InvalidFlavor = unchecked((int)0x80041046),
+ InvalidFlavor = unchecked((int)0x80041046),
/// <summary>
/// <para> An attempt has been made to create a reference that is
/// circular (for example, deriving a class from itself). </para>
/// </summary>
- CircularReference = unchecked((int)0x80041047),
+ CircularReference = unchecked((int)0x80041047),
/// <summary>
/// The specified class is not supported.
/// </summary>
- UnsupportedClassUpdate = unchecked((int)0x80041048),
+ UnsupportedClassUpdate = unchecked((int)0x80041048),
/// <summary>
/// <para> An attempt was made to change a key when instances or derived
/// classes are already using the key. </para>
/// </summary>
- CannotChangeKeyInheritance = unchecked((int)0x80041049),
+ CannotChangeKeyInheritance = unchecked((int)0x80041049),
/// <summary>
/// <para> An attempt was made to change an index when instances or derived
/// classes are already using the index. </para>
/// </summary>
- CannotChangeIndexInheritance = unchecked((int)0x80041050),
+ CannotChangeIndexInheritance = unchecked((int)0x80041050),
/// <summary>
/// <para> An attempt was made to create more properties than the
/// current version of the class supports. </para>
/// </summary>
- TooManyProperties = unchecked((int)0x80041051),
+ TooManyProperties = unchecked((int)0x80041051),
/// <summary>
/// <para> A property was redefined with a conflicting type in a
/// derived class. </para>
/// </summary>
- UpdateTypeMismatch = unchecked((int)0x80041052),
+ UpdateTypeMismatch = unchecked((int)0x80041052),
/// <summary>
/// <para> An attempt was made in a derived class to override a
/// non-overrideable qualifier. </para>
/// </summary>
- UpdateOverrideNotAllowed = unchecked((int)0x80041053),
+ UpdateOverrideNotAllowed = unchecked((int)0x80041053),
/// <summary>
/// <para> A method was redeclared with a conflicting signature in a
/// derived class. </para>
/// </summary>
- UpdatePropagatedMethod = unchecked((int)0x80041054),
+ UpdatePropagatedMethod = unchecked((int)0x80041054),
/// <summary>
/// An attempt was made to execute a method not marked with
/// [implemented] in any relevant class.
/// </summary>
- MethodNotImplemented = unchecked((int)0x80041055),
+ MethodNotImplemented = unchecked((int)0x80041055),
/// <summary>
/// <para> An attempt was made to execute a method marked with
/// [disabled]. </para>
/// </summary>
- MethodDisabled = unchecked((int)0x80041056),
+ MethodDisabled = unchecked((int)0x80041056),
/// <summary>
/// <para> The refresher is busy with another operation. </para>
/// </summary>
- RefresherBusy = unchecked((int)0x80041057),
+ RefresherBusy = unchecked((int)0x80041057),
/// <summary>
/// <para> The filtering query is syntactically invalid. </para>
/// </summary>
/// The FROM clause of a filtering query references a class
/// that is not an event class.
/// </summary>
- NotEventClass = unchecked((int)0x80041059),
+ NotEventClass = unchecked((int)0x80041059),
/// <summary>
/// A GROUP BY clause was used without the corresponding
/// GROUP WITHIN clause.
/// </summary>
- MissingGroupWithin = unchecked((int)0x8004105A),
+ MissingGroupWithin = unchecked((int)0x8004105A),
/// <summary>
/// A GROUP BY clause was used. Aggregation on all properties
/// is not supported.
/// </summary>
- MissingAggregationList = unchecked((int)0x8004105B),
+ MissingAggregationList = unchecked((int)0x8004105B),
/// <summary>
/// <para> Dot notation was used on a property that is not an
/// embedded object. </para>
/// </summary>
- PropertyNotAnObject = unchecked((int)0x8004105C),
+ PropertyNotAnObject = unchecked((int)0x8004105C),
/// <summary>
/// A GROUP BY clause references a property that is an
/// embedded object without using dot notation.
/// </summary>
- AggregatingByObject = unchecked((int)0x8004105D),
+ AggregatingByObject = unchecked((int)0x8004105D),
/// <summary>
/// An event provider registration query
/// (<see langword='__EventProviderRegistration'/>) did not specify the classes for which
/// events were provided.
/// </summary>
- UninterpretableProviderQuery = unchecked((int)0x8004105F),
+ UninterpretableProviderQuery = unchecked((int)0x8004105F),
/// <summary>
/// <para> An request was made to back up or restore the repository
/// while WinMgmt.exe was using it. </para>
/// </summary>
- BackupRestoreWinmgmtRunning = unchecked((int)0x80041060),
+ BackupRestoreWinmgmtRunning = unchecked((int)0x80041060),
/// <summary>
/// <para> The asynchronous delivery queue overflowed from the
/// event consumer being too slow. </para>
/// The operation failed because the client did not have the
/// necessary security privilege.
/// </summary>
- PrivilegeNotHeld = unchecked((int)0x80041062),
+ PrivilegeNotHeld = unchecked((int)0x80041062),
/// <summary>
/// <para>The operator is not valid for this property type.</para>
/// </summary>
/// <para> The class was made abstract when its base class is not
/// abstract. </para>
/// </summary>
- CannotBeAbstract = unchecked((int)0x80041065),
+ CannotBeAbstract = unchecked((int)0x80041065),
/// <summary>
/// <para> An amended object was used in a put operation without the
/// WBEM_FLAG_USE_AMENDED_QUALIFIERS flag being specified. </para>
/// </summary>
- AmendedObject = unchecked((int)0x80041066),
+ AmendedObject = unchecked((int)0x80041066),
/// <summary>
/// The client was not retrieving objects quickly enough from
/// an enumeration.
/// </summary>
- ClientTooSlow = unchecked((int)0x80041067),
+ ClientTooSlow = unchecked((int)0x80041067),
/// <summary>
/// <para> The provider registration overlaps with the system event
/// domain. </para>
/// </summary>
- RegistrationTooBroad = unchecked((int)0x80042001),
+ RegistrationTooBroad = unchecked((int)0x80042001),
/// <summary>
/// <para> A WITHIN clause was not used in this query. </para>
/// </summary>
- RegistrationTooPrecise = unchecked((int)0x80042002)
+ RegistrationTooPrecise = unchecked((int)0x80042002)
}
/// <summary>
[Serializable]
public class ManagementException : SystemException
{
- private ManagementBaseObject errorObject = null;
- private ManagementStatus errorCode = 0;
+ private ManagementBaseObject errorObject = null;
+ private ManagementStatus errorCode = 0;
internal static void ThrowWithExtendedInfo(ManagementStatus errorCode)
{
/// block that handles the inner exception.</param>
/// </summary>
public ManagementException(string message,Exception innerException):this(innerException, message, null)
- {
+ {
// if the exception passed is not a ManagementException, then initialize the ErrorCode to Failed
if (!(innerException is ManagementException))
errorCode = ManagementStatus.Failed;
namespace System.Management
{
- //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
+ //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
/// <summary>
/// <para> Represents a collection of named values
/// suitable for use as context information to WMI operations. The
/// </summary>
/// <param name=' name'>The name of the value to be returned.</param>
/// <value>
- /// <para>An <see cref='System.Object'/> containing the
+ /// <para>An <see cref='object'/> containing the
/// value of the specified item in this collection.</para>
/// </value>
public object this[string name]
/// </returns>
/// <remarks>
/// <para> Gets the object containing the input parameters to a
- /// method, and then fills in the values and passes the object to the <see cref='System.Management.ManagementObject.InvokeMethod(String, ManagementBaseObject, InvokeMethodOptions)'/> call.</para>
+ /// method, and then fills in the values and passes the object to the <see cref='System.Management.ManagementObject.InvokeMethod(string, ManagementBaseObject, InvokeMethodOptions)'/> call.</para>
/// </remarks>
public ManagementBaseObject GetMethodParameters(
string methodName)
/// <para>Initializes a new instance of the <see cref='System.Management.InvokeMethodOptions'/> class.</para>
/// </overload>
/// <summary>
- /// <para>Initializes a new instance of the <see cref='System.Management.InvokeMethodOptions'/> class for the <see cref='System.Management.ManagementObject.InvokeMethod(String, ManagementBaseObject, InvokeMethodOptions) '/> operation, using default values.
+ /// <para>Initializes a new instance of the <see cref='System.Management.InvokeMethodOptions'/> class for the <see cref='System.Management.ManagementObject.InvokeMethod(string, ManagementBaseObject, InvokeMethodOptions) '/> operation, using default values.
/// This is the default constructor.</para>
/// </summary>
public InvokeMethodOptions() : base () {}
namespace System.Management
{
- //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
+ //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
/// <summary>
/// <para> Provides an abstract base class for all management query objects.</para>
/// </summary>
public abstract class ManagementQuery : ICloneable
{
internal const string DEFAULTQUERYLANGUAGE = "WQL";
- internal const string TokenSelect = "select "; // Keep trailing space char.
+ internal const string TokenSelect = "select "; // Keep trailing space char.
//Used when any public property on this object is changed, to signal
//to the containing object that it needs to be refreshed.
get {return (null != queryString) ? queryString : string.Empty;}
set {
if (queryString != value) {
- ParseQuery (value); // this may throw
+ ParseQuery (value); // this may throw
queryString = value;
FireIdentifierChanged ();
}
internal static void ParseToken (ref string q, string token, string op, ref bool bTokenFound, ref string tokenValue)
{
if (bTokenFound)
- throw new ArgumentException (SR.InvalidQueryDuplicatedToken); // Invalid query - duplicate token
+ throw new ArgumentException (SR.InvalidQueryDuplicatedToken); // Invalid query - duplicate token
bTokenFound = true;
q = q.Remove (0, token.Length).TrimStart (null);
if (op != null)
{
if (0 != q.IndexOf(op, StringComparison.Ordinal))
- throw new ArgumentException(SR.InvalidQuery); // Invalid query
+ throw new ArgumentException(SR.InvalidQuery); // Invalid query
// Strip off the op and any leading WS
q = q.Remove(0, op.Length).TrimStart(null);
}
if (0 == q.Length)
- throw new ArgumentException (SR.InvalidQueryNullToken); // Invalid query - token has no value
+ throw new ArgumentException (SR.InvalidQueryNullToken); // Invalid query - token has no value
// Next token should be the token value - look for terminating WS
// or end of string
int i;
if (-1 == (i = q.IndexOf (' ')))
- i = q.Length; // No WS => consume entire string
+ i = q.Length; // No WS => consume entire string
tokenValue = q.Substring (0, i);
q = q.Remove (0, tokenValue.Length).TrimStart(null);
internal static void ParseToken (ref string q, string token, ref bool bTokenFound)
{
if (bTokenFound)
- throw new ArgumentException (SR.InvalidQueryDuplicatedToken); // Invalid query - duplicate token
+ throw new ArgumentException (SR.InvalidQueryDuplicatedToken); // Invalid query - duplicate token
bTokenFound = true;
q = q.Remove (0, token.Length).TrimStart (null);
}//ManagementQuery
- //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
+ //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
/// <summary>
/// <para> Represents a management query that returns instances or classes.</para>
/// </summary>
}//ObjectQuery
- //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
+ //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
/// <summary>
/// <para> Represents a WMI event query.</para>
/// </summary>
}//EventQuery
- //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
+ //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
/// <summary>
/// <para> Represents a WMI data query in WQL format.</para>
/// </summary>
- //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
+ //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
/// <summary>
/// <para> Represents a WQL SELECT data query.</para>
/// </summary>
{
// Looks to be a query - do further checking.
//
- QueryString = queryOrClassName; // Parse/validate; may throw.
+ QueryString = queryOrClassName; // Parse/validate; may throw.
}
else
{
// Must be some white space next
if ((0 == q.Length) || !char.IsWhiteSpace (q[0]))
- throw new ArgumentException(SR.InvalidQuery); // Invalid query
+ throw new ArgumentException(SR.InvalidQuery); // Invalid query
- q = q.TrimStart(null); // Remove the leading whitespace
+ q = q.TrimStart(null); // Remove the leading whitespace
condition = q;
}
}//SelectQuery
- //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
+ //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
/// <summary>
/// <para> Represents a WQL ASSOCIATORS OF data query.
/// It can be used for both instances and schema queries.</para>
{
// Looks to be a query - do further checking.
//
- QueryString = queryOrSourceObject; // Parse/validate; may throw.
+ QueryString = queryOrSourceObject; // Parse/validate; may throw.
}
else
{
//Find "associators" clause
if (0 != string.Compare(q, 0, TokenAssociators, 0, TokenAssociators.Length, StringComparison.OrdinalIgnoreCase))
- throw new ArgumentException(SR.InvalidQuery,"associators"); // Invalid query
+ throw new ArgumentException(SR.InvalidQuery,"associators"); // Invalid query
// Strip off the clause
q = q.Remove(0, TokenAssociators.Length);
// Must be some white space next
if ((0 == q.Length) || !char.IsWhiteSpace (q[0]))
- throw new ArgumentException(SR.InvalidQuery); // Invalid query
+ throw new ArgumentException(SR.InvalidQuery); // Invalid query
- q = q.TrimStart(null); // Remove the leading whitespace
+ q = q.TrimStart(null); // Remove the leading whitespace
// Next token should be "of"
if (0 != string.Compare(q, 0, TokenOf, 0, TokenOf.Length, StringComparison.OrdinalIgnoreCase))
- throw new ArgumentException(SR.InvalidQuery,"of"); // Invalid query
+ throw new ArgumentException(SR.InvalidQuery,"of"); // Invalid query
// Strip off the clause and leading WS
q = q.Remove(0, TokenOf.Length).TrimStart (null);
// Next character should be "{"
if (0 != q.IndexOf('{'))
- throw new ArgumentException(SR.InvalidQuery); // Invalid query
+ throw new ArgumentException(SR.InvalidQuery); // Invalid query
// Strip off the "{" and any leading WS
q = q.Remove(0, 1).TrimStart(null);
// Next item should be the source object
if (-1 == (i = q.IndexOf('}')))
- throw new ArgumentException(SR.InvalidQuery); // Invalid query
+ throw new ArgumentException(SR.InvalidQuery); // Invalid query
tempSourceObject = q.Substring(0, i).TrimEnd(null);
q = q.Remove(0, i+1).TrimStart(null);
{
// Next should be the "where" clause
if (0 != string.Compare (q, 0, TokenWhere, 0, TokenWhere.Length, StringComparison.OrdinalIgnoreCase))
- throw new ArgumentException(SR.InvalidQuery,"where"); // Invalid query
+ throw new ArgumentException(SR.InvalidQuery,"where"); // Invalid query
q = q.Remove (0, TokenWhere.Length);
// Must be some white space next
if ((0 == q.Length) || !char.IsWhiteSpace (q[0]))
- throw new ArgumentException(SR.InvalidQuery); // Invalid query
+ throw new ArgumentException(SR.InvalidQuery); // Invalid query
- q = q.TrimStart(null); // Remove the leading whitespace
+ q = q.TrimStart(null); // Remove the leading whitespace
// Remaining tokens can appear in any order
bool bResultClassFound = false;
tempClassDefsOnly = true;
}
else if (0 == q.Length)
- break; // done
+ break; // done
else
- throw new ArgumentException(SR.InvalidQuery); // Unrecognized token
+ throw new ArgumentException(SR.InvalidQuery); // Unrecognized token
}
//Can't have both classDefsOnly and schemaOnly
}//RelatedObjectQuery
- //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
+ //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
/// <summary>
/// <para> Represents a WQL REFERENCES OF data query.</para>
/// </summary>
{
// Looks to be a query - do further checking.
//
- QueryString = queryOrSourceObject; // Parse/validate; may throw.
+ QueryString = queryOrSourceObject; // Parse/validate; may throw.
}
else
{
//Find "references" clause
if (0 != string.Compare(q, 0, TokenReferences, 0, TokenReferences.Length, StringComparison.OrdinalIgnoreCase))
- throw new ArgumentException(SR.InvalidQuery,"references"); // Invalid query
+ throw new ArgumentException(SR.InvalidQuery,"references"); // Invalid query
// Strip off the clause
q = q.Remove(0, TokenReferences.Length);
// Must be some white space next
if ((0 == q.Length) || !char.IsWhiteSpace (q[0]))
- throw new ArgumentException(SR.InvalidQuery); // Invalid query
+ throw new ArgumentException(SR.InvalidQuery); // Invalid query
- q = q.TrimStart(null); // Remove the leading whitespace
+ q = q.TrimStart(null); // Remove the leading whitespace
// Next token should be "of"
if (0 != string.Compare(q, 0, TokenOf, 0, TokenOf.Length, StringComparison.OrdinalIgnoreCase))
- throw new ArgumentException(SR.InvalidQuery,"of"); // Invalid query
+ throw new ArgumentException(SR.InvalidQuery,"of"); // Invalid query
// Strip off the clause and leading WS
q = q.Remove(0, TokenOf.Length).TrimStart (null);
// Next character should be "{"
if (0 != q.IndexOf('{'))
- throw new ArgumentException(SR.InvalidQuery); // Invalid query
+ throw new ArgumentException(SR.InvalidQuery); // Invalid query
// Strip off the "{" and any leading WS
q = q.Remove(0, 1).TrimStart(null);
// Next item should be the source object
if (-1 == (i = q.IndexOf('}')))
- throw new ArgumentException(SR.InvalidQuery); // Invalid query
+ throw new ArgumentException(SR.InvalidQuery); // Invalid query
tempSourceObject = q.Substring(0, i).TrimEnd(null);
q = q.Remove(0, i+1).TrimStart(null);
{
// Next should be the "where" clause
if (0 != string.Compare (q, 0, TokenWhere, 0, TokenWhere.Length, StringComparison.OrdinalIgnoreCase))
- throw new ArgumentException(SR.InvalidQuery,"where"); // Invalid query
+ throw new ArgumentException(SR.InvalidQuery,"where"); // Invalid query
q = q.Remove (0, TokenWhere.Length);
// Must be some white space next
if ((0 == q.Length) || !char.IsWhiteSpace (q[0]))
- throw new ArgumentException(SR.InvalidQuery); // Invalid query
+ throw new ArgumentException(SR.InvalidQuery); // Invalid query
- q = q.TrimStart(null); // Remove the leading whitespace
+ q = q.TrimStart(null); // Remove the leading whitespace
// Remaining tokens can appear in any order
bool bResultClassFound = false;
tempSchemaOnly = true;
}
else if (0 == q.Length)
- break; // done
+ break; // done
else
- throw new ArgumentException(SR.InvalidQuery); // Unrecognized token
+ throw new ArgumentException(SR.InvalidQuery); // Unrecognized token
}
//Can't have both classDefsOnly and schemaOnly
}//RelationshipQuery
- //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
+ //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
/// <summary>
/// <para> Represents a WMI event query in WQL format.</para>
/// </summary>
//
if (queryOrEventClassName.TrimStart().StartsWith(TokenSelectAll, StringComparison.OrdinalIgnoreCase))
{
- QueryString = queryOrEventClassName; // Parse/validate; may throw.
+ QueryString = queryOrEventClassName; // Parse/validate; may throw.
}
else
{
}
//Select clause
- string s = TokenSelectAll; //no property list allowed here...
+ string s = TokenSelectAll; //no property list allowed here...
//From clause
s = s + "from " + eventClassName;
string keyword = TokenSelect;
if ((q.Length < keyword.Length) || (0 != string.Compare (q, 0, keyword, 0, keyword.Length, StringComparison.OrdinalIgnoreCase)))
throw new ArgumentException(SR.InvalidQuery);
- q = q.Remove(0, keyword.Length).TrimStart(null);
+ q = q.Remove(0, keyword.Length).TrimStart(null);
if (!q.StartsWith("*", StringComparison.Ordinal))
throw new ArgumentException(SR.InvalidQuery,"*");
keyword = "where ";
if ((w.Length >= keyword.Length) && (0 == string.Compare (w, 0, keyword, 0, keyword.Length, StringComparison.OrdinalIgnoreCase))) //where clause exists
{
- condition = w.Substring(keyword.Length);
+ condition = w.Substring(keyword.Length);
}
}//ParseQuery()
{
return new InstanceDescriptor(ctor, new object[] {obj.QueryString});
}
- }
+ }
if (value is ObjectQuery && destinationType == typeof(InstanceDescriptor))
{
}
}
- //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
+ //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
/// <summary>
/// <para> Represents information about a WMI property.</para>
/// </summary>
//This private function is used to refresh the information from the Wmi object before returning the requested data
private void RefreshPropertyInfo()
{
- propertyValue = null; // Needed so we don't leak this in/out parameter...
+ propertyValue = null; // Needed so we don't leak this in/out parameter...
int status = parent.wbemObject.Get_(propertyName, 0, ref propertyValue, ref propertyType, ref propertyFlavor);
if (status < 0)
{
if (status == (int)tag_WBEMSTATUS.WBEM_E_INVALID_OBJECT)
- className = string.Empty; // Interpret as an unspecified property - return ""
+ className = string.Empty; // Interpret as an unspecified property - return ""
else if ((status & 0xfffff000) == 0x80041000)
ManagementException.ThrowWithExtendedInfo((ManagementStatus)status);
else
wmiValue = new int [length];
for (int i = 0; i < length; i++)
((int[])(wmiValue))[i] = Convert.ToInt32(valArray.GetValue(i),(IFormatProvider)culInfo.GetFormat(typeof(int)));
- }
+ }
break;
case CimType.UInt32:
case CimType.SInt64:
wmiValue = new string [length];
for (int i = 0; i < length; i++)
- ((string[])(wmiValue))[i] = (Convert.ToInt64(valArray.GetValue(i),(IFormatProvider)culInfo.GetFormat(typeof(System.Int64)))).ToString((IFormatProvider)culInfo.GetFormat(typeof(long)));
+ ((string[])(wmiValue))[i] = (Convert.ToInt64(valArray.GetValue(i),(IFormatProvider)culInfo.GetFormat(typeof(long)))).ToString((IFormatProvider)culInfo.GetFormat(typeof(long)));
break;
case CimType.UInt64:
wmiValue = new string [length];
for (int i = 0; i < length; i++)
- ((string[])(wmiValue))[i] = (Convert.ToUInt64(valArray.GetValue(i),(IFormatProvider)culInfo.GetFormat(typeof(System.UInt64)))).ToString((IFormatProvider)culInfo.GetFormat(typeof(ulong)));
+ ((string[])(wmiValue))[i] = (Convert.ToUInt64(valArray.GetValue(i),(IFormatProvider)culInfo.GetFormat(typeof(ulong)))).ToString((IFormatProvider)culInfo.GetFormat(typeof(ulong)));
break;
case CimType.Real32:
wmiValue = new float [length];
for (int i = 0; i < length; i++)
((float[])(wmiValue))[i] = Convert.ToSingle(valArray.GetValue(i),(IFormatProvider)culInfo.GetFormat(typeof(float)));
- }
+ }
break;
case CimType.Real64:
wmiValue = new double [length];
for (int i = 0; i < length; i++)
((double[])(wmiValue))[i] = Convert.ToDouble(valArray.GetValue(i),(IFormatProvider)culInfo.GetFormat(typeof(double)));
- }
+ }
break;
case CimType.Char16:
break;
case CimType.SInt64:
- wmiValue = (Convert.ToInt64(val,(IFormatProvider)culInfo.GetFormat(typeof(System.Int64)))).ToString((IFormatProvider)culInfo.GetFormat(typeof(long)));
+ wmiValue = (Convert.ToInt64(val,(IFormatProvider)culInfo.GetFormat(typeof(long)))).ToString((IFormatProvider)culInfo.GetFormat(typeof(long)));
break;
case CimType.UInt64:
- wmiValue = (Convert.ToUInt64(val,(IFormatProvider)culInfo.GetFormat(typeof(System.UInt64)))).ToString((IFormatProvider)culInfo.GetFormat(typeof(ulong)));
+ wmiValue = (Convert.ToUInt64(val,(IFormatProvider)culInfo.GetFormat(typeof(ulong)))).ToString((IFormatProvider)culInfo.GetFormat(typeof(ulong)));
break;
case CimType.Real32:
wmiValue = new short[length];
for (int i = 0; i < length; i++)
- ((short[])wmiValue) [i] = ((IConvertible)((System.Byte)(arrayValue[i]))).ToInt16(null);
+ ((short[])wmiValue) [i] = ((IConvertible)((byte)(arrayValue[i]))).ToInt16(null);
}
else if (elementType == typeof(sbyte))
{
wmiValue = new short[length];
for (int i = 0; i < length; i++)
- ((short[])wmiValue) [i] = ((IConvertible)((System.SByte)(arrayValue[i]))).ToInt16(null);
+ ((short[])wmiValue) [i] = ((IConvertible)((sbyte)(arrayValue[i]))).ToInt16(null);
}
else if (elementType == typeof(bool))
{
type = CimType.Boolean;
wmiValue = (bool[])val;
- }
+ }
else if (elementType == typeof(ushort))
{
ushort[] arrayValue = (ushort[])val;
wmiValue = new int[length];
for (int i = 0; i < length; i++)
- ((int[])wmiValue) [i] = ((IConvertible)((System.UInt16)(arrayValue[i]))).ToInt32(null);
+ ((int[])wmiValue) [i] = ((IConvertible)((ushort)(arrayValue[i]))).ToInt32(null);
}
else if (elementType == typeof(short))
{
wmiValue = new string[length];
for (int i = 0; i < length; i++)
- ((string[])wmiValue) [i] = ((System.UInt32)(arrayValue[i])).ToString((IFormatProvider)culInfo.GetFormat(typeof(uint)));
+ ((string[])wmiValue) [i] = ((uint)(arrayValue[i])).ToString((IFormatProvider)culInfo.GetFormat(typeof(uint)));
}
else if (elementType == typeof(ulong))
{
wmiValue = new string[length];
for (int i = 0; i < length; i++)
- ((string[])wmiValue) [i] = ((System.UInt64)(arrayValue[i])).ToString((IFormatProvider)culInfo.GetFormat(typeof(ulong)));
+ ((string[])wmiValue) [i] = ((ulong)(arrayValue[i])).ToString((IFormatProvider)culInfo.GetFormat(typeof(ulong)));
}
else if (elementType == typeof(long))
{
wmiValue = new short[length];
for (int i = 0; i < length; i++)
- ((short[])wmiValue) [i] = ((IConvertible)((System.Char)(arrayValue[i]))).ToInt16(null);
+ ((short[])wmiValue) [i] = ((IConvertible)((char)(arrayValue[i]))).ToInt16(null);
}
}
else
}
}
}
- else // Non-array values
+ else // Non-array values
{
if (valueType == typeof(ushort))
{
type = CimType.UInt16;
- wmiValue = ((IConvertible)((System.UInt16)val)).ToInt32(null);
+ wmiValue = ((IConvertible)((ushort)val)).ToInt32(null);
}
else if (valueType == typeof(uint))
{
else if (valueType == typeof(ulong))
{
type = CimType.UInt64;
- wmiValue = ((System.UInt64)val).ToString((IFormatProvider)culInfo.GetFormat(typeof(ulong)));
+ wmiValue = ((ulong)val).ToString((IFormatProvider)culInfo.GetFormat(typeof(ulong)));
}
else if (valueType == typeof(sbyte))
{
type = CimType.SInt8;
- wmiValue = ((IConvertible)((System.SByte)val)).ToInt16(null);
+ wmiValue = ((IConvertible)((sbyte)val)).ToInt16(null);
}
else if (valueType == typeof(byte))
{
else if (valueType == typeof(char))
{
type = CimType.Char16;
- wmiValue = ((IConvertible)((System.Char)val)).ToInt16(null);
+ wmiValue = ((IConvertible)((char)val)).ToInt16(null);
}
else if (valueType == typeof(string))
{
namespace System.Management
{
- //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
+ //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
/// <summary>
/// <para> Represents the set of properties of a WMI object.</para>
/// </summary>
/// <param name=' index'>The index in the destination array from which to start copying.</param>
public void CopyTo(PropertyData[] propertyArray, int index)
{
- CopyTo((Array)propertyArray, index);
+ CopyTo((Array)propertyArray, index);
}
//
// IEnumerable
namespace System.Management
{
- //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
+ //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
/// <summary>
/// <para> Contains information about a WMI qualifier.</para>
/// </summary>
private int qualifierFlavor;
private IWbemQualifierSetFreeThreaded qualifierSet;
- internal QualifierData(ManagementBaseObject parent, string propName, string qualName, QualifierType type)
+ internal QualifierData(ManagementBaseObject parent, string propName, string qualName, QualifierType type)
{
this.parent = parent;
this.propertyOrMethodName = propName;
namespace System.Management
{
- //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
+ //CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC//
/// <summary>
/// <para> Represents a collection of <see cref='System.Management.QualifierData'/> objects.</para>
/// </summary>
/// </summary>
private IWbemQualifierSetFreeThreaded GetTypeQualifierSet(QualifierType qualifierSetType)
{
- IWbemQualifierSetFreeThreaded qualifierSet = null;
- int status = (int)ManagementStatus.NoError;
+ IWbemQualifierSetFreeThreaded qualifierSet = null;
+ int status = (int)ManagementStatus.NoError;
switch (qualifierSetType)
{
status = parent.wbemObject.GetMethodQualifierSet_(propertyOrMethodName, out qualifierSet);
break;
default :
- throw new ManagementException(ManagementStatus.Unexpected, null, null); // Is this the best fit error ??
+ throw new ManagementException(ManagementStatus.Unexpected, null, null); // Is this the best fit error ??
}
if (status < 0)
internal QualifierDataEnumerator(ManagementBaseObject parent, string propertyOrMethodName,
QualifierType qualifierType)
{
- this.parent = parent;
- this.propertyOrMethodName = propertyOrMethodName;
- this.qualifierType = qualifierType;
- this.qualifierNames = null;
+ this.parent = parent;
+ this.propertyOrMethodName = propertyOrMethodName;
+ this.qualifierType = qualifierType;
+ this.qualifierNames = null;
- IWbemQualifierSetFreeThreaded qualifierSet = null;
- int status = (int)ManagementStatus.NoError;
+ IWbemQualifierSetFreeThreaded qualifierSet = null;
+ int status = (int)ManagementStatus.NoError;
switch (qualifierType)
{
status = parent.wbemObject.GetMethodQualifierSet_(propertyOrMethodName, out qualifierSet);
break;
default :
- throw new ManagementException(ManagementStatus.Unexpected, null, null); // Is this the best fit error ??
+ throw new ManagementException(ManagementStatus.Unexpected, null, null); // Is this the best fit error ??
}
// If we got an error code back, assume there are NO qualifiers for this object/property/method
if(status < 0)
{
- qualifierNames = Array.Empty<String>();
+ qualifierNames = Array.Empty<string>();
}
else
{
PublicNamesUsed.Add("Boolean","System.Boolean");
PublicNamesUsed.Add("ValueType", "System.ValueType");
PublicNamesUsed.Add("Events1", "Events");
- PublicNamesUsed.Add("Component1", "Component");
+ PublicNamesUsed.Add("Component1", "Component");
//Initialize the Private Members
PrivateNamesUsed.Add("SystemPropertiesObject","PrivateSystemProperties");
}
/// <summary>
- /// Reads an <see cref="Int16"/> as little endian.
+ /// Reads an <see cref="short"/> as little endian.
/// </summary>
- /// <returns>False if there wasn't enough data for an <see cref="Int16"/>.</returns>
+ /// <returns>False if there wasn't enough data for an <see cref="short"/>.</returns>
public static bool TryReadLittleEndian(ref this SequenceReader<byte> reader, out short value)
{
if (BitConverter.IsLittleEndian)
}
/// <summary>
- /// Reads an <see cref="Int16"/> as big endian.
+ /// Reads an <see cref="short"/> as big endian.
/// </summary>
- /// <returns>False if there wasn't enough data for an <see cref="Int16"/>.</returns>
+ /// <returns>False if there wasn't enough data for an <see cref="short"/>.</returns>
public static bool TryReadBigEndian(ref this SequenceReader<byte> reader, out short value)
{
if (!BitConverter.IsLittleEndian)
}
/// <summary>
- /// Reads an <see cref="Int32"/> as little endian.
+ /// Reads an <see cref="int"/> as little endian.
/// </summary>
- /// <returns>False if there wasn't enough data for an <see cref="Int32"/>.</returns>
+ /// <returns>False if there wasn't enough data for an <see cref="int"/>.</returns>
public static bool TryReadLittleEndian(ref this SequenceReader<byte> reader, out int value)
{
if (BitConverter.IsLittleEndian)
}
/// <summary>
- /// Reads an <see cref="Int32"/> as big endian.
+ /// Reads an <see cref="int"/> as big endian.
/// </summary>
- /// <returns>False if there wasn't enough data for an <see cref="Int32"/>.</returns>
+ /// <returns>False if there wasn't enough data for an <see cref="int"/>.</returns>
public static bool TryReadBigEndian(ref this SequenceReader<byte> reader, out int value)
{
if (!BitConverter.IsLittleEndian)
}
/// <summary>
- /// Reads an <see cref="Int64"/> as little endian.
+ /// Reads an <see cref="long"/> as little endian.
/// </summary>
- /// <returns>False if there wasn't enough data for an <see cref="Int64"/>.</returns>
+ /// <returns>False if there wasn't enough data for an <see cref="long"/>.</returns>
public static bool TryReadLittleEndian(ref this SequenceReader<byte> reader, out long value)
{
if (BitConverter.IsLittleEndian)
}
/// <summary>
- /// Reads an <see cref="Int64"/> as big endian.
+ /// Reads an <see cref="long"/> as big endian.
/// </summary>
- /// <returns>False if there wasn't enough data for an <see cref="Int64"/>.</returns>
+ /// <returns>False if there wasn't enough data for an <see cref="long"/>.</returns>
public static bool TryReadBigEndian(ref this SequenceReader<byte> reader, out long value)
{
if (!BitConverter.IsLittleEndian)
public static TheoryData<Action<ReadOnlySequence<byte>>> OutOfRangeSliceCases => new TheoryData<Action<ReadOnlySequence<byte>>>
{
- // negative start
+ // negative start
b => b.Slice(-1), // no length
b => b.Slice(-1, -1), // negative length
b => b.Slice(-1, 0), // zero length
public static TheoryData<Action<ReadOnlySequence<char>>> OutOfRangeSliceCases => new TheoryData<Action<ReadOnlySequence<char>>>
{
- // negative start
+ // negative start
b => b.Slice(-1), // no length
b => b.Slice(-1, -1), // negative length
b => b.Slice(-1, 0), // zero length
[Fact]
[OuterLoop]
[PlatformSpecific(TestPlatforms.Windows | TestPlatforms.OSX)]
- public unsafe static void BinarySearch_MaxLength_NoOverflow()
+ public static unsafe void BinarySearch_MaxLength_NoOverflow()
{
if (sizeof(IntPtr) == sizeof(long))
{
}
[Fact]
- public unsafe static void ClearByteUnalignedFixed()
+ public static unsafe void ClearByteUnalignedFixed()
{
const byte initial = 5;
const int length = 32;
[Fact]
[OuterLoop]
[PlatformSpecific(TestPlatforms.Windows | TestPlatforms.OSX)]
- unsafe static void ClearLongerThanUintMaxValueBytes()
+ static unsafe void ClearLongerThanUintMaxValueBytes()
{
if (sizeof(IntPtr) == sizeof(long))
{
return null;
}
- internal unsafe static KnownHeader TryGetKnownHeader(ReadOnlySpan<byte> name)
+ internal static unsafe KnownHeader TryGetKnownHeader(ReadOnlySpan<byte> name)
{
fixed (byte* p = &MemoryMarshal.GetReference(name))
{
// System.Net.ChunkStream
//
// Authors:
-// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (C) 2003 Ximian, Inc (http://www.ximian.com)
//
// System.Net.ChunkedInputStream
//
// Authors:
-// Gonzalo Paniagua Javier (gonzalo@novell.com)
+// Gonzalo Paniagua Javier (gonzalo@novell.com)
//
// Copyright (c) 2005 Novell, Inc (http://www.novell.com)
//
// System.Net.HttpConnection
//
// Author:
-// Gonzalo Paniagua Javier (gonzalo.mono@gmail.com)
+// Gonzalo Paniagua Javier (gonzalo.mono@gmail.com)
//
// Copyright (c) 2005-2009 Novell, Inc. (http://www.novell.com)
// Copyright (c) 2012 Xamarin, Inc. (http://xamarin.com)
// System.Net.HttpEndPointListener
//
// Author:
-// Gonzalo Paniagua Javier (gonzalo.mono@gmail.com)
+// Gonzalo Paniagua Javier (gonzalo.mono@gmail.com)
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
// Copyright (c) 2012 Xamarin, Inc. (http://xamarin.com)
// System.Net.HttpEndPointManager
//
// Author:
-// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
// System.Net.HttpListenerRequest
//
// Authors:
-// Gonzalo Paniagua Javier (gonzalo.mono@gmail.com)
-// Marek Safar (marek.safar@gmail.com)
+// Gonzalo Paniagua Javier (gonzalo.mono@gmail.com)
+// Marek Safar (marek.safar@gmail.com)
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
// Copyright (c) 2011-2012 Xamarin, Inc. (http://xamarin.com)
// System.Net.HttpListenerResponse
//
// Author:
-// Gonzalo Paniagua Javier (gonzalo@novell.com)
+// Gonzalo Paniagua Javier (gonzalo@novell.com)
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
}
/* Apache forces closing the connection for these status codes:
- * HttpStatusCode.BadRequest 400
- * HttpStatusCode.RequestTimeout 408
- * HttpStatusCode.LengthRequired 411
- * HttpStatusCode.RequestEntityTooLarge 413
- * HttpStatusCode.RequestUriTooLong 414
- * HttpStatusCode.InternalServerError 500
- * HttpStatusCode.ServiceUnavailable 503
+ * HttpStatusCode.BadRequest 400
+ * HttpStatusCode.RequestTimeout 408
+ * HttpStatusCode.LengthRequired 411
+ * HttpStatusCode.RequestEntityTooLarge 413
+ * HttpStatusCode.RequestUriTooLong 414
+ * HttpStatusCode.InternalServerError 500
+ * HttpStatusCode.ServiceUnavailable 503
*/
bool conn_close = (_statusCode == (int)HttpStatusCode.BadRequest || _statusCode == (int)HttpStatusCode.RequestTimeout
|| _statusCode == (int)HttpStatusCode.LengthRequired || _statusCode == (int)HttpStatusCode.RequestEntityTooLarge
// System.Net.RequestStream
//
// Author:
-// Gonzalo Paniagua Javier (gonzalo@novell.com)
+// Gonzalo Paniagua Javier (gonzalo@novell.com)
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
// System.Net.ResponseStream
//
// Author:
-// Gonzalo Paniagua Javier (gonzalo@novell.com)
+// Gonzalo Paniagua Javier (gonzalo@novell.com)
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
// System.Net.HttpStreamAsyncResult
//
// Authors:
-// Gonzalo Paniagua Javier (gonzalo@novell.com)
+// Gonzalo Paniagua Javier (gonzalo@novell.com)
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// System.Net.ListenerAsyncResult
//
// Authors:
-// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// Copyright (c) 2005 Ximian, Inc (http://www.ximian.com)
//
// System.Net.ListenerPrefix
//
// Author:
-// Gonzalo Paniagua Javier (gonzalo@novell.com)
-// Oleg Mihailik (mihailik gmail co_m)
+// Gonzalo Paniagua Javier (gonzalo@novell.com)
+// Oleg Mihailik (mihailik gmail co_m)
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
// or the query fails for some reason, don't add an SPN.
try
{
- string machineName = Dns.GetHostEntry(String.Empty).HostName;
+ string machineName = Dns.GetHostEntry(string.Empty).HostName;
return new string[] { "HTTP/" + machineName };
}
catch (System.Net.Sockets.SocketException)
// SmtpExceptionTest.cs - NUnit Test Cases for System.Net.Mail.SmtpException
//
// Authors:
-// Gert Driesen (drieseng@users.sourceforge.net)
+// Gert Driesen (drieseng@users.sourceforge.net)
//
// (C) 2008 Gert Driesen
//
{
internal static class IPv6AddressHelper
{
- internal unsafe static (int longestSequenceStart, int longestSequenceLength) FindCompressionRange(
+ internal static unsafe (int longestSequenceStart, int longestSequenceLength) FindCompressionRange(
ReadOnlySpan<ushort> numbers) => (-1, -1);
- internal unsafe static bool ShouldHaveIpv4Embedded(ReadOnlySpan<ushort> numbers) => false;
- internal unsafe static bool IsValidStrict(char* name, int start, ref int end) => false;
+ internal static unsafe bool ShouldHaveIpv4Embedded(ReadOnlySpan<ushort> numbers) => false;
+ internal static unsafe bool IsValidStrict(char* name, int start, ref int end) => false;
internal static unsafe bool Parse(ReadOnlySpan<char> ipSpan, Span<ushort> numbers, int start, ref string scopeId) => false;
}
}
private const int ProtocolVersionSize = 2;
private const int UInt24Size = 3;
private const int RandomSize = 32;
- private readonly static IdnMapping s_idnMapping = CreateIdnMapping();
- private readonly static Encoding s_encoding = CreateEncoding();
+ private static readonly IdnMapping s_idnMapping = CreateIdnMapping();
+ private static readonly Encoding s_encoding = CreateEncoding();
public static string GetServerName(byte[] clientHello)
{
_buffer = null;
_numBytes = 0;
- if (errorCode == SocketError.Success)
- {
- Internals.SocketAddress remoteSocketAddress = IPEndPointExtensions.Serialize(_listenSocket._rightEndPoint);
- System.Buffer.BlockCopy(socketAddress, 0, remoteSocketAddress.Buffer, 0, socketAddressLen);
-
- _acceptedSocket = _listenSocket.CreateAcceptSocket(
- SafeSocketHandle.CreateSocket(acceptedFileDescriptor),
- _listenSocket._rightEndPoint.Create(remoteSocketAddress));
- }
+ if (errorCode == SocketError.Success)
+ {
+ Internals.SocketAddress remoteSocketAddress = IPEndPointExtensions.Serialize(_listenSocket._rightEndPoint);
+ System.Buffer.BlockCopy(socketAddress, 0, remoteSocketAddress.Buffer, 0, socketAddressLen);
+
+ _acceptedSocket = _listenSocket.CreateAcceptSocket(
+ SafeSocketHandle.CreateSocket(acceptedFileDescriptor),
+ _listenSocket._rightEndPoint.Create(remoteSocketAddress));
+ }
base.CompletionCallback(0, errorCode);
}
public partial class SocketOptionNameTest
{
[DllImport("libc", SetLastError = true)]
- private unsafe static extern int setsockopt(int socket, int level, int option_name, void* option_value, uint option_len);
+ private static extern unsafe int setsockopt(int socket, int level, int option_name, void* option_value, uint option_len);
}
}
{
public partial class SocketOptionNameTest
{
- private unsafe static int setsockopt(int socket, int level, int option_name, void* option_value, uint option_len)
+ private static unsafe int setsockopt(int socket, int level, int option_name, void* option_value, uint option_len)
{
throw new PlatformNotSupportedException();
}
Uri.HexUnescape("%75", ref index);
Assert.Throws<ArgumentOutOfRangeException>(() => Uri.HexUnescape("%75", ref index));
}
- }
+ }
}
/// <param name="obj">The node to hash.</param>
/// <returns>A value-based hash code for the node.</returns>
/// <remarks>
- /// The <see cref="XNode"/> class's implementation of <see cref="Object.GetHashCode"/>
+ /// The <see cref="XNode"/> class's implementation of <see cref="object.GetHashCode"/>
/// is based on the referential identity of the node. This method computes a
/// hash code based on the value of the node.
/// </remarks>
/// <param name="obj">The node to hash.</param>
/// <returns>A value-based hash code for the node.</returns>
/// <remarks>
- /// The <see cref="XNode"/> class's implementation of <see cref="Object.GetHashCode"/>
+ /// The <see cref="XNode"/> class's implementation of <see cref="object.GetHashCode"/>
/// is based on the referential identity of the node. This method computes a
/// hash code based on the value of the node.
/// </remarks>
attr.Verify();
}
- // 21. The empty string cannot be used as a namespace name (exception is default ns redef.)
+ // 21. The empty string cannot be used as a namespace name (exception is default ns redef.)
//[Variation(Priority = 1, Desc = "XAttribute - default namespace decl & empty value", Params = new object[] { false, "xmlns" })]
public void CreateXAttribute6()
{
}
}
- // 21. The empty string cannot be used as a namespace name (exception is default ns redef.)
+ // 21. The empty string cannot be used as a namespace name (exception is default ns redef.)
//[Variation(Priority = 1, Desc = "XAttribute - prefixed namespace decl & empty value", Params = new object[] { true, "p" })]
public void CreateXAttribute7()
{
}
}
- // 22. Xml prefix: Enforce
- // � http://www.w3.org/XML/1998/namespace
- // � Must not be bound to any other namespace name.
- // � No other prefix may be bound to this namespace name.
- // 23. Xmlns prefix: Enforce, but some concern about performance
- // � http://www.w3.org/2000/xmlns/
- // � It must not be declared
- // � No other prefix may be bound to this namespace name.
+ // 22. Xml prefix: Enforce
+ // � http://www.w3.org/XML/1998/namespace
+ // � Must not be bound to any other namespace name.
+ // � No other prefix may be bound to this namespace name.
+ // 23. Xmlns prefix: Enforce, but some concern about performance
+ // � http://www.w3.org/2000/xmlns/
+ // � It must not be declared
+ // � No other prefix may be bound to this namespace name.
//[Variation(Priority = 1, Desc = "XAttribute - xml namespace - prefix redef", Params = new object[] { "xml", "another", true })]
//[Variation(Priority = 1, Desc = "XAttribute - xml namespace - bound to diff. prefix", Params = new object[] { "p", "http://www.w3.org/XML/1998/namespace", true })]
//[Variation(Priority = 1, Desc = "XAttribute - xml namespace - redeclared (positive).", Params = new object[] { "xml", "http://www.w3.org/XML/1998/namespace", false })]
}
else
{
- rNewNode.peFlags |= NodeFlags.Indent; // Turn on Indent for current Node
+ rNewNode.peFlags |= NodeFlags.Indent; // Turn on Indent for current Node
}
// Set all Depth 0 nodes to No Mixed Content and Indent True
if (prXmlReader.Depth == 0)
{
- rNewNode.peFlags |= NodeFlags.Indent; // Turn on Indent
- rNewNode.peFlags &= ~NodeFlags.MixedContent; // Turn off MixedContent
+ rNewNode.peFlags |= NodeFlags.Indent; // Turn on Indent
+ rNewNode.peFlags &= ~NodeFlags.MixedContent; // Turn off MixedContent
}
rParentNode.InsertNode(rNewNode);
{
rNewNode.peFlags = _eDefaultFlags | NodeFlags.AttributeTextNode;
}
- rNewNode.peFlags |= NodeFlags.MixedContent; // turn on Mixed Content for current node
- rNewNode.peFlags &= ~NodeFlags.Indent; // turn off Indent for current node
- rParentNode.peFlags |= NodeFlags.MixedContent; // turn on Mixed Content for Parent Node
+ rNewNode.peFlags |= NodeFlags.MixedContent; // turn on Mixed Content for current node
+ rNewNode.peFlags &= ~NodeFlags.Indent; // turn off Indent for current node
+ rParentNode.peFlags |= NodeFlags.MixedContent; // turn on Mixed Content for Parent Node
break;
case XmlNodeType.Whitespace:
case XmlNodeType.SignificantWhitespace:
case XmlNodeType.CDATA:
- rNewNode.peFlags |= NodeFlags.MixedContent; // turn on Mixed Content for current node
- rNewNode.peFlags &= ~NodeFlags.Indent; // turn off Indent for current node
- rParentNode.peFlags |= NodeFlags.MixedContent; // turn on Mixed Content for Parent Node
+ rNewNode.peFlags |= NodeFlags.MixedContent; // turn on Mixed Content for current node
+ rNewNode.peFlags &= ~NodeFlags.Indent; // turn off Indent for current node
+ rParentNode.peFlags |= NodeFlags.MixedContent; // turn on Mixed Content for Parent Node
break;
case XmlNodeType.Comment:
private const string COMMENT = "COMMENT_";
private long _eCount = 0; //element indexer
- private long _aCount = 0; //attribute indexer
+ private long _aCount = 0; //attribute indexer
private long _cCount = 0; //Cdata indexer
- private long _tCount = 0; //Text indexer
- private long _pCount = 0; //PI Indexer
+ private long _tCount = 0; //Text indexer
+ private long _pCount = 0; //PI Indexer
private long _mCount = 0; //Comment Indexer
private StreamWriter _textWriter = null;
/// Writing text.
/// Note : This is basically equivalent to WriteRaw and the string may contain any number of embedded tags.
- /// No checking is performed on them either.
+ /// No checking is performed on them either.
public void PutText(string myStr)
{
_nodeQueue.Append(myStr);
/// <summary>
/// This method is a convenience method and a shortcut to create an XML string. Each character in the pattern
- /// maps to a particular Put/Open function and calls it for you. For e.g. XEAA/ will call PutDecl, OpenElement,
- /// PutAttribute, PutAttribute and CloseElement for you.
- /// The following is the list of all allowed characters and their function mappings :
+ /// maps to a particular Put/Open function and calls it for you. For e.g. XEAA/ will call PutDecl, OpenElement,
+ /// PutAttribute, PutAttribute and CloseElement for you.
+ /// The following is the list of all allowed characters and their function mappings :
///
- ///'X' : PutDecl()
- ///'E' : OpenElement()
- ///'M' : CloseEmptyElement()
- ///'/' : CloseElement()
- ///'e' : PutEndElement()
- ///'A' : PutAttribute()
- ///'P' : PutPI()
- ///'T' : PutText()
- ///'C' : PutComment()
- ///'R' : PutRoot()
- ///'r' : PutEndRoot()
- ///'B' : PutEndRoot()
- ///'W' : PutWhiteSpace()
+ ///'X' : PutDecl()
+ ///'E' : OpenElement()
+ ///'M' : CloseEmptyElement()
+ ///'/' : CloseElement()
+ ///'e' : PutEndElement()
+ ///'A' : PutAttribute()
+ ///'P' : PutPI()
+ ///'T' : PutText()
+ ///'C' : PutComment()
+ ///'R' : PutRoot()
+ ///'r' : PutEndRoot()
+ ///'B' : PutEndRoot()
+ ///'W' : PutWhiteSpace()
///
/// </summary>
/// <param name="pattern">String containing the pattern which you want to use to create
ITestItems Children { get; }
// Execution
- // Control Flow: Init->Execute->(recurse into children)->Terminate
+ // Control Flow: Init->Execute->(recurse into children)->Terminate
TestResult Init();
TestResult Execute();
TestResult Terminate();
base.DetermineChildren();
//Sort
- //Default sort is based upon IComparable of each item
+ //Default sort is based upon IComparable of each item
Children.Sort();
}
if (Internal != null)
{
Internal.Error(result,
- TestLogFlags.Text, //flags
- StringEx.Format(actual), //actual
- StringEx.Format(expected), //expected
- source, //source
- message, //message
- stack, //stack
- filename, //filename
- lineno //line
+ TestLogFlags.Text, //flags
+ StringEx.Format(actual), //actual
+ StringEx.Format(expected), //expected
+ source, //source
+ message, //message
+ stack, //stack
+ filename, //filename
+ lineno //line
);
}
else
// See the LICENSE file in the project root for more information.
using System;
-using System.Collections; //IEnumerator
-using System.Collections.Generic; //List<T>
+using System.Collections;
+using System.Collections.Generic;
namespace Microsoft.Test.ModuleCore
{
//plus this allows both teams to have a identical (similar as possible) queries/filters.
//Xml Spec Format:
- // Example:
+ // Example:
/*
<TestModule Name="Functional" Created="10 October 2001" Modified="10 October 2001" Version="1">
<-- Owner type is an enum, "test", "dev" or "pm" -->
/// information about that node's page. The other fields in the 0th node are undefined and should never
/// be used.
/// </summary>
- sealed internal class XPathNodePageInfo
+ internal sealed class XPathNodePageInfo
{
private int _pageNum;
private int _nodeCount;
/// string.Intern() operation. If a node's name, type, or parent/sibling pages are modified, then a new
/// InfoAtom needs to be obtained, since other nodes may still be referencing the old InfoAtom.
/// </summary>
- sealed internal class XPathNodeInfoAtom : IEquatable<XPathNodeInfoAtom>
+ internal sealed class XPathNodeInfoAtom : IEquatable<XPathNodeInfoAtom>
{
private string _localName;
private string _namespaceUri;
/// <summary>
/// An atomization table for XPathNodeInfoAtom.
/// </summary>
- sealed internal class XPathNodeInfoTable
+ internal sealed class XPathNodeInfoTable
{
private XPathNodeInfoAtom[] _hashTable;
private int _sizeTable;
//
// Following table shows what will happen with new line characters in detail:
//
- // | In text node value | In attribute value |
- // input to XmlWriter.WriteString() | \r\n \n \r \t | \r\n \n \r \t |
- // ------------------------------------------------------------------------------------------------------------
- // NewLineHandling.Replace (default) | \r\n \r\n \r\n \t | &#D;&#A; &#A; &#D; 	 |
- // NewLineHandling.Entitize | &#D; \n &#D; \t | &#D;&#A; &#A; &#D; 	 |
- // NewLineHandling.None | \r\n \n \r \t | \r\n \n \r \t |
- // ------------------------------------------------------------------------------------------------------------
+ // | In text node value | In attribute value |
+ // input to XmlWriter.WriteString() | \r\n \n \r \t | \r\n \n \r \t |
+ // ---------------------------------------------------------------------------------------------------
+ // NewLineHandling.Replace (default) | \r\n \r\n \r\n \t | &#D;&#A; &#A; &#D; 	 |
+ // NewLineHandling.Entitize | &#D; \n &#D; \t | &#D;&#A; &#A; &#D; 	 |
+ // NewLineHandling.None | \r\n \n \r \t | \r\n \n \r \t |
+ // ---------------------------------------------------------------------------------------------------
// Specifies how end of line is handled in XmlWriter.
public enum NewLineHandling
if (ofObjectToReturn == null || ofObjectToReturn == typeof(Stream) || ofObjectToReturn == typeof(object))
{
- return Task.FromResult<Object>(data.AsStream());
+ return Task.FromResult<object>(data.AsStream());
}
else if (ofObjectToReturn == typeof(TextReader))
{
- return Task.FromResult<Object>(data.AsTextReader());
+ return Task.FromResult<object>(data.AsTextReader());
}
else
{
{ //attribute group is the redefinition of existingObject
if (existingAttGroup.AttributeUses.Count == 0)
{ //If the existing one is not already compiled, then replace.
- table.Insert(attGroup.QualifiedName, attGroup); //Update with redefined entry
+ table.Insert(attGroup.QualifiedName, attGroup); //Update with redefined entry
return true;
}
}
{ //group is the redefinition of existingObject
if (existingGroup.CanonicalParticle == null)
{ //If the existing one is not already compiled, then replace.
- table.Insert(group.QualifiedName, group); //Update with redefined entry
+ table.Insert(group.QualifiedName, group); //Update with redefined entry
return true;
}
}
{ //schemaType is the redefinition of existingObject
if (existingType.ElementDecl == null)
{ //If the existing one is not already compiled, then replace.
- table.Insert(schemaType.QualifiedName, schemaType); //Update with redefined entry
+ table.Insert(schemaType.QualifiedName, schemaType); //Update with redefined entry
return true;
}
}
return Add(schema, _xmlResolver);
}
- public XmlSchema Add(XmlSchema schema, XmlResolver resolver)
+ public XmlSchema Add(XmlSchema schema, XmlResolver resolver)
{
if (schema == null)
throw new ArgumentNullException(nameof(schema));
if (_internalSyncObject == null)
{
object o = new object();
- Interlocked.CompareExchange<Object>(ref _internalSyncObject, o, null);
+ Interlocked.CompareExchange<object>(ref _internalSyncObject, o, null);
}
return _internalSyncObject;
}
Type itemTypeDst = destinationType.GetElementType();
// Different StringSplitOption needs to be used because of following bugs:
- // 566053: Behavior change between SL2 and Dev10 in the way string arrays are deserialized by the XmlReader.ReadContentsAs method
- // 643697: Deserialization of typed arrays by the XmlReader.ReadContentsAs method fails
+ // 566053: Behavior change between SL2 and Dev10 in the way string arrays are deserialized by the XmlReader.ReadContentsAs method
+ // 643697: Deserialization of typed arrays by the XmlReader.ReadContentsAs method fails
//
// In Silverligt 2 the XmlConvert.SplitString was not using the StringSplitOptions, which is the same as using StringSplitOptions.None.
// What it meant is that whenever there is a double space between two values in the input string it turned into
Ldstr((string)o);
break;
case TypeCode.Decimal:
- ConstructorInfo Decimal_ctor = typeof(Decimal).GetConstructor(
+ ConstructorInfo Decimal_ctor = typeof(decimal).GetConstructor(
CodeGenerator.InstanceBindingFlags,
new Type[] { typeof(int), typeof(int), typeof(int), typeof(bool), typeof(byte) }
);
// the given char is already a valid name character
#if DEBUG
// use exception in the place of Debug.Assert to avoid throwing asserts from a server process such as aspnet_ewp.exe
- if (!IsValid(c)) throw new ArgumentException(SR.Format(SR.XmlInternalErrorDetails, "Invalid identifier character " + ((Int16)c).ToString(CultureInfo.InvariantCulture)), nameof(c));
+ if (!IsValid(c)) throw new ArgumentException(SR.Format(SR.XmlInternalErrorDetails, "Invalid identifier character " + ((short)c).ToString(CultureInfo.InvariantCulture)), nameof(c));
#endif
// First char cannot be a number
"CollapseWhitespace",
CodeGenerator.InstanceBindingFlags,
null,
- new Type[] { typeof(String) },
+ new Type[] { typeof(string) },
null
);
ilg.Call(XmlSerializationReader_CollapseWhitespace);
CodeGenerator.InstanceBindingFlags,
new Type[] { typeof(string), typeof(string) }
);
- MethodInfo String_get_Length = typeof(String).GetMethod(
+ MethodInfo String_get_Length = typeof(string).GetMethod(
"get_Length",
CodeGenerator.InstanceBindingFlags,
Array.Empty<Type>()
{
LocalBuilder locListValues = ilg.DeclareOrGetLocal(typeof(string), "listValues");
LocalBuilder locVals = ilg.DeclareOrGetLocal(typeof(string[]), "vals");
- MethodInfo String_Split = typeof(String).GetMethod(
+ MethodInfo String_Split = typeof(string).GetMethod(
"Split",
CodeGenerator.InstanceBindingFlags,
new Type[] { typeof(char[]) }
ConstructorInfo TimeSpan_ctor = typeof(TimeSpan).GetConstructor(
CodeGenerator.InstanceBindingFlags,
null,
- new Type[] { typeof(Int64) },
+ new Type[] { typeof(long) },
null
);
ilg.Ldc(default(TimeSpan).Ticks);
Writer.Write('\'');
}
else if (type == typeof(int))
- Writer.Write(((Int32)value).ToString(null, NumberFormatInfo.InvariantInfo));
+ Writer.Write(((int)value).ToString(null, NumberFormatInfo.InvariantInfo));
else if (type == typeof(double))
{
if (double.IsNaN((double)value))
}
else
{
- Writer.Write(((Double)value).ToString("R", NumberFormatInfo.InvariantInfo));
+ Writer.Write(((double)value).ToString("R", NumberFormatInfo.InvariantInfo));
}
}
else if (type == typeof(bool))
}
else
{
- Writer.Write(((Single)value).ToString("R", NumberFormatInfo.InvariantInfo));
+ Writer.Write(((float)value).ToString("R", NumberFormatInfo.InvariantInfo));
Writer.Write("f");
}
}
else if (type == typeof(decimal))
{
- Writer.Write(((Decimal)value).ToString(null, NumberFormatInfo.InvariantInfo));
+ Writer.Write(((decimal)value).ToString(null, NumberFormatInfo.InvariantInfo));
Writer.Write("m");
}
else if (type == typeof(DateTime))
CodeGenerator.StaticBindingFlags,
Array.Empty<Type>()
);
- MethodInfo Int64_ToString = typeof(Int64).GetMethod(
+ MethodInfo Int64_ToString = typeof(long).GetMethod(
"ToString",
CodeGenerator.InstanceBindingFlags,
new Type[] { typeof(IFormatProvider) }
ilg.Ldstr(GetCSharpString(ns));
argTypes.Add(typeof(string));
}
- MethodInfo Object_ToString = typeof(Object).GetMethod(
+ MethodInfo Object_ToString = typeof(object).GetMethod(
"ToString",
CodeGenerator.InstanceBindingFlags,
Array.Empty<Type>()
}
else
{
- bufBld.Append(((Int32)name[0]).ToString("X4", CultureInfo.InvariantCulture));
+ bufBld.Append(((int)name[0]).ToString("X4", CultureInfo.InvariantCulture));
copyPosition = 1;
}
}
else
{
- bufBld.Append(((Int32)name[position]).ToString("X4", CultureInfo.InvariantCulture));
+ bufBld.Append(((int)name[position]).ToString("X4", CultureInfo.InvariantCulture));
copyPosition = position + 1;
}
bufBld.Append('_');
/// <summary>
/// A bit vector holding a set of rewrites.
/// </summary>
- sealed internal class QilPatterns
+ internal sealed class QilPatterns
{
private readonly BitArray _bits;
/// <summary>
/// This internal class implements the XmlRawWriter interface by passing all calls to a wrapped XmlWriter implementation.
/// </summary>
- sealed internal class XmlRawWriterWrapper : XmlRawWriter
+ internal sealed class XmlRawWriterWrapper : XmlRawWriter
{
private XmlWriter _wrapped;
{
long bits;
- if (Double.IsNaN(x))
+ if (double.IsNaN(x))
{
return x;
}
- if (Double.IsNaN(y))
+ if (double.IsNaN(y))
{
return y;
}
public static double Succ(double x)
{
- return NextAfter(x, Double.PositiveInfinity);
+ return NextAfter(x, double.PositiveInfinity);
}
public static double Pred(double x)
{
- return NextAfter(x, Double.NegativeInfinity);
+ return NextAfter(x, double.NegativeInfinity);
}
#endif
}
else
{
- dblLowPrec = Double.NaN;
+ dblLowPrec = double.NaN;
}
#else
goto LDone;
#if DEBUG
Debug.Assert(dbl == (double)num);
dblLo = dec.AdjustDbl(dbl);
- Debug.Assert(dbl == dblLo || Double.IsNaN(dblLo));
+ Debug.Assert(dbl == dblLo || double.IsNaN(dblLo));
#endif
goto LDone;
}
}
////////////////////////////////////////////////////////////////
- // TestCase TCRecord NameTable.Get
+ // TestCase TCRecord NameTable.Get
//
////////////////////////////////////////////////////////////////
//[TestCase(Name="NameTable(Get) VerifyWGetChar", Desc="VerifyWGetChar")]
}
////////////////////////////////////////////////////////////////
- // TestCase TCRecord NameTable.Add
+ // TestCase TCRecord NameTable.Add
//
////////////////////////////////////////////////////////////////
//[TestCase(Name="NameTable(Add) VerifyWGetString", Desc="VerifyWGetString")]
Initial, //At Start.
PreTest, //After PreTest is called and finished successfully.
CreateSuccess, //After Create method is called.
- Consume, //Before starting to use the object.
+ Consume, //Before starting to use the object.
Skip, //The case is skipped.
- Error, // In case of an error. Should throw CTestFailedException anyways.
- Pass, // Test() is successful.
+ Error, // In case of an error. Should throw CTestFailedException anyways.
+ Pass, // Test() is successful.
Complete //After Successful PostTest.
};
/// <ReaderType>Dtd</ReaderType>
/// <NameTable>new</NameTable>
/// <LineNumberOffset>1</LineNumberOffset>
- /// <LinePositionOffset>0</LinePositionOffset>
+ /// <LinePositionOffset>0</LinePositionOffset>
/// <IgnoreInlineSchema>false</IgnoreInlineSchema>
/// <IgnoreSchemaLocation>true</IgnoreSchemaLocation>
/// <IgnoreIdentityConstraints>false</IgnoreIdentityConstraints>
- /// <IgnoreValidationWarnings>true</IgnoreValidationWarnings>
+ /// <IgnoreValidationWarnings>true</IgnoreValidationWarnings>
/// <Schemas>2</Schemas>
/// <ValidationEventHandler>0</ValidationEventHandler>
/// <ProhibitDtd>true</ProhibitDtd>
[XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "EntityRef", true)]
[XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "Name", true)]
[XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "NmToken", true)]
- [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "QName", true)]
+ [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "QName", true)]
public void checkChars_4(XmlWriterUtils utils, string tokenType, bool checkCharacters)
{
XmlWriterSettings wSettings = new XmlWriterSettings();
}
/*
- * Attribute Wildcards
+ * Attribute Wildcards
*/
[Theory]
//[Variation(Desc = "v8.1.1- Attributes Wildcards(1), allowXmlAttribute=false", Priority = 1, id = 59, Params = new object[] { "v9-1.xml", "v9-1.xsd", false, 0, 0, 2 })]
[InlineData("v9-1.xml", "v9-1.xsd", false, 0, 0, 2)]
/*
- * Required and Prohibited Attributes
+ * Required and Prohibited Attributes
*/
//[Variation(Desc = "v7.1.8- Required and Prohibited Attributes(4), allowXmlAttribute=true", Priority = 1, id = 58, Params = new object[] { "v8-4.xml", "v8-3.xsd", true, 0, 1, 2 })]
[InlineData("v8-4.xml", "v8-3.xsd", true, 0, 1, 2)]
CError.Compare(sc.IsCompiled, true, "CompileIsCompiled");
XmlSchema sch_B = sc.Add(null, Path.Combine(TestData._Root, "import_v9_b.xsd")); // should be already present in the set
- sc.Add(null, Path.Combine(TestData._Root, "import_v9_c.xsd")); // should be already present in the set
+ sc.Add(null, Path.Combine(TestData._Root, "import_v9_c.xsd")); // should be already present in the set
CError.Compare(sc.Count, 3, "Count");
CError.Compare(sc.IsCompiled, true, "IsCompiled");
CError.Compare(sc.IsCompiled, true, "CompileIsCompiled");
XmlSchema sch_B = sc.Add(null, Path.Combine(TestData._Root, "import_v10_b.xsd")); // should be already present in the set
- sc.Add(null, Path.Combine(TestData._Root, "import_v10_c.xsd")); // should be already present in the set
+ sc.Add(null, Path.Combine(TestData._Root, "import_v10_c.xsd")); // should be already present in the set
CError.Compare(sc.Count, 3, "Count");
CError.Compare(sc.IsCompiled, true, "IsCompiled");
CError.Compare(sc.IsCompiled, true, "CompileIsCompiled");
XmlSchema sch_B = sc.Add(null, Path.Combine(TestData._Root, "import_v9_b.xsd")); // should be already present in the set
- sc.Add(null, Path.Combine(TestData._Root, "import_v9_c.xsd")); // should be already present in the set
+ sc.Add(null, Path.Combine(TestData._Root, "import_v9_c.xsd")); // should be already present in the set
CError.Compare(sc.Count, 3, "Count");
CError.Compare(sc.IsCompiled, true, "IsCompiled");
CError.Compare(sc.IsCompiled, true, "CompileIsCompiled");
XmlSchema sch_B = sc.Add(null, Path.Combine(TestData._Root, "import_v10_b.xsd")); // should be already present in the set
- sc.Add(null, Path.Combine(TestData._Root, "import_v10_c.xsd")); // should be already present in the set
+ sc.Add(null, Path.Combine(TestData._Root, "import_v10_c.xsd")); // should be already present in the set
CError.Compare(sc.Count, 3, "Count");
CError.Compare(sc.IsCompiled, true, "IsCompiled");
CError.Compare(sc.Count, 3, "ReprocessCount");
XmlSchema sch_B = sc.Add(null, Path.Combine(TestData._Root, "import_v9_b.xsd")); // should be already present in the set
- sc.Add(null, Path.Combine(TestData._Root, "import_v9_c.xsd")); // should be already present in the set
+ sc.Add(null, Path.Combine(TestData._Root, "import_v9_c.xsd")); // should be already present in the set
CError.Compare(sc.Count, 3, "Count");
CError.Compare(sc.IsCompiled, false, "IsCompiled");
CError.Compare(sc.Count, 3, "ReprocessCount");
XmlSchema sch_B = sc.Add(null, Path.Combine(TestData._Root, "import_v10_b.xsd")); // should be already present in the set
- sc.Add(null, Path.Combine(TestData._Root, "import_v10_c.xsd")); // should be already present in the set
+ sc.Add(null, Path.Combine(TestData._Root, "import_v10_c.xsd")); // should be already present in the set
CError.Compare(sc.Count, 3, "Count");
CError.Compare(sc.IsCompiled, false, "IsCompiled");
}
}
- public static class FilePathUtil
- {
- public static XmlTestSettings TestSettings = new XmlTestSettings();
+ public static class FilePathUtil
+ {
+ public static XmlTestSettings TestSettings = new XmlTestSettings();
- public static string GetDataPath()
+ public static string GetDataPath()
{
return TestSettings.DataPath;
}
{
return Path.Combine(GetDataPath(), "TestFiles", "StandardTests");
}
- }
+ }
}
XmlWriter xw = XmlWriter.Create(stm2, os);
//Transform to XmlWriter
- _output.WriteLine("Transforming to XmlWriter over Stream2 with XSLT OutputSettings - 'out2.xml'");
+ _output.WriteLine("Transforming to XmlWriter over Stream2 with XSLT OutputSettings - 'out2.xml'");
_xsl.Transform(_xmlFile, null, xw);
//Close the streams
public class SameInstanceXslTransformTestCase : XsltApiTestCaseBase2
{
// Variables from init string
- protected string _strPath; // Path of the data files
+ protected string _strPath; // Path of the data files
// Other global variables
- public XslCompiledTransform xsltSameInstance; // Used for same instance testing of XsltArgumentList
+ public XslCompiledTransform xsltSameInstance; // Used for same instance testing of XsltArgumentList
private ITestOutputHelper _output;
public SameInstanceXslTransformTestCase(ITestOutputHelper output) : base(output)
//[TestCase(Name = "Same instance testing: Transform() - READER")]
public class SameInstanceXslTransformReader : SameInstanceXslTransformTestCase
{
- private XPathDocument _xd; // Loads XML file
+ private XPathDocument _xd; // Loads XML file
private XmlReader _xrData; // Loads XML File
private ITestOutputHelper _output;
//[TestCase(Name = "Same instance testing: Transform() - TEXTWRITER")]
public class SameInstanceXslTransformWriter : SameInstanceXslTransformTestCase
{
- private XPathDocument _xd; // Loads XML file
- private XmlReader _xrData; // Loads XML file
+ private XPathDocument _xd; // Loads XML file
+ private XmlReader _xrData; // Loads XML file
private ITestOutputHelper _output;
public SameInstanceXslTransformWriter(ITestOutputHelper output) : base(output)
public class CSameInstanceXsltArgTestCase2 : XsltApiTestCaseBase2
{
// Variables from init string
- protected string _strPath; // Path of the data files
+ protected string _strPath; // Path of the data files
// Other global variables
- public XsltArgumentList xsltArg1; // Shared XsltArgumentList for same instance testing
+ public XsltArgumentList xsltArg1; // Shared XsltArgumentList for same instance testing
private ITestOutputHelper _output;
public CSameInstanceXsltArgTestCase2(ITestOutputHelper output) : base(output)
}
else
{
- rNewNode._eFlags |= NodeFlags.Indent; // Turn on Indent for current Node
+ rNewNode._eFlags |= NodeFlags.Indent; // Turn on Indent for current Node
}
// Set all Depth 0 nodes to No Mixed Content and Indent True
if (_rXmlReader.Depth == 0)
{
- rNewNode._eFlags |= NodeFlags.Indent; // Turn on Indent
- rNewNode._eFlags &= ~NodeFlags.MixedContent; // Turn off MixedContent
+ rNewNode._eFlags |= NodeFlags.Indent; // Turn on Indent
+ rNewNode._eFlags &= ~NodeFlags.MixedContent; // Turn off MixedContent
}
rParentNode.InsertNode(rNewNode);
{
int nEnd;
- nPos = strValue.IndexOf("=", nPos); //Find the = sign
- nEnd = strValue.IndexOf("\"", nPos) + 1; //Find the next " character
- nPos = strValue.IndexOf("'", nPos) + 1; //Find the next ' character
- if (nEnd == 0 || (nPos < nEnd && nPos > 0)) //Pick the one that's closer to the = sign
+ nPos = strValue.IndexOf("=", nPos); //Find the = sign
+ nEnd = strValue.IndexOf("\"", nPos) + 1; //Find the next " character
+ nPos = strValue.IndexOf("'", nPos) + 1; //Find the next ' character
+ if (nEnd == 0 || (nPos < nEnd && nPos > 0)) //Pick the one that's closer to the = sign
{
nEnd = strValue.IndexOf("'", nPos);
}
{
rNewNode._eFlags = _eDefaultFlags | NodeFlags.AttributeTextNode;
}
- rNewNode._eFlags |= NodeFlags.MixedContent; // turn on Mixed Content for current node
- rNewNode._eFlags &= ~NodeFlags.Indent; // turn off Indent for current node
- rParentNode._eFlags |= NodeFlags.MixedContent; // turn on Mixed Content for Parent Node
+ rNewNode._eFlags |= NodeFlags.MixedContent; // turn on Mixed Content for current node
+ rNewNode._eFlags &= ~NodeFlags.Indent; // turn off Indent for current node
+ rParentNode._eFlags |= NodeFlags.MixedContent; // turn on Mixed Content for Parent Node
break;
case XmlNodeType.Whitespace:
case XmlNodeType.SignificantWhitespace:
case XmlNodeType.CDATA:
- rNewNode._eFlags |= NodeFlags.MixedContent; // turn on Mixed Content for current node
- rNewNode._eFlags &= ~NodeFlags.Indent; // turn off Indent for current node
- rParentNode._eFlags |= NodeFlags.MixedContent; // turn on Mixed Content for Parent Node
+ rNewNode._eFlags |= NodeFlags.MixedContent; // turn on Mixed Content for current node
+ rNewNode._eFlags &= ~NodeFlags.Indent; // turn off Indent for current node
+ rParentNode._eFlags |= NodeFlags.MixedContent; // turn on Mixed Content for Parent Node
break;
case XmlNodeType.Comment:
private void ValidationCallback(object sender, ValidationEventArgs args)
{
// commented by ROCHOA -- don't know where ValidationEventArgs comes from
- // _hr = Convert.ToInt16(args.ErrorCode);
+ // _hr = Convert.ToInt16(args.ErrorCode);
throw (new Exception("[" + Convert.ToString(_hr) + "] " + args.Message));
}
}
public class CSameInstanceXslTransformTestCase : XsltApiTestCaseBase
{
// Variables from init string
- protected string _strPath; // Path of the data files
+ protected string _strPath; // Path of the data files
// Other global variables
#pragma warning disable 0618
- public XslTransform xsltSameInstance; // Used for same instance testing of XsltArgumentList
+ public XslTransform xsltSameInstance; // Used for same instance testing of XsltArgumentList
#pragma warning restore 0618
protected int threadCount = 5;
//[TestCase(Name = "Same instance testing: Transform() - READER")]
public class SameInstanceXslTransformReader : CSameInstanceXslTransformTestCase
{
- private XPathDocument _xd; // Loads XML file
+ private XPathDocument _xd; // Loads XML file
private ITestOutputHelper _output;
public SameInstanceXslTransformReader(ITestOutputHelper output) : base(output)
//[TestCase(Name = "Same instance testing: Transform() - TEXTWRITER")]
public class SameInstanceXslTransformWriter : CSameInstanceXslTransformTestCase
{
- private XPathDocument _xd; // Loads XML file
+ private XPathDocument _xd; // Loads XML file
private ITestOutputHelper _output;
public SameInstanceXslTransformWriter(ITestOutputHelper output) : base(output)
return 1;
}
}
-}
\ No newline at end of file
+}
public class CSameInstanceXsltArgTestCase : XsltApiTestCaseBase
{
// Variables from init string
- protected string _strPath; // Path of the data files
+ protected string _strPath; // Path of the data files
// Other global variables
- public XsltArgumentList xsltArg1; // Shared XsltArgumentList for same instance testing
+ public XsltArgumentList xsltArg1; // Shared XsltArgumentList for same instance testing
private ITestOutputHelper _output;
public CSameInstanceXsltArgTestCase(ITestOutputHelper output) : base(output)
{
//Note: We have a "wrapper" thread function thats always called.
//This allows us much greater control than the normal System.Thread class.
- // 1. It allows us to call the function repeatedly (iterations)
+ // 1. It allows us to call the function repeatedly (iterations)
// 2. It allows parameters to be passed into the thread function
- // 3. It allows a return code from the thread function
- // 4. etc...
+ // 3. It allows a return code from the thread function
+ // 4. etc...
//Iterate the specified number of times
for (int i = 0; i < Iterations; i++)
return eResult;
}
}
-}
\ No newline at end of file
+}
{
return UnderlyingParameter.ToString();
}
- }
+ }
}
{
get { return _projector.ProjectAssembly(base.ReferencedAssembly); }
}
- }
+ }
}
Position.GetHashCode() ^
ParameterType.GetHashCode();
}
- }
+ }
}
return GetCustomAttributes(attributeType, inherit).Length > 0;
}
}
- }
+ }
}
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Coreclr fixed an issue where IntPtr/UIntPtr in fieldValues causes a corrupt created binary.")]
public static void NotSupportedPrimitiveInFieldValues_ThrowsArgumentException(object value)
{
- // Used to assert in CustomAttributeBuilder.EmitType(), not writing any CustomAttributeEncoding.
- // This created a blob that (probably) generates a CustomAttributeFormatException. In theory, this
- // could have been something more uncontrolled, so was fixed. See issue #11703.
+ // Used to assert in CustomAttributeBuilder.EmitType(), not writing any CustomAttributeEncoding.
+ // This created a blob that (probably) generates a CustomAttributeFormatException. In theory, this
+ // could have been something more uncontrolled, so was fixed. See issue #11703.
ConstructorInfo con = typeof(TestAttribute).GetConstructor(new Type[0]);
FieldInfo[] namedFields = Helpers.GetFields(typeof(TestAttribute), nameof(TestAttribute.ObjectField));
object[] fieldValues = new object[] { value };
// Invalid unicode
yield return new object[] { "\uDC00", (PropertyAttributes)0x8000, typeof(EmptyGenericStruct<string>), new Type[] { typeof(EmptyGenericClass<string>) }, "\uFFFD", PropertyAttributes.None };
- yield return new object[] { "\uD800", PropertyAttributes.None, typeof(int).MakeByRefType(), new Type[] { typeof(int).MakeByRefType() }, "\uFFFD", PropertyAttributes.None };
- yield return new object[] { "1A\0\t\v\r\n\n\uDC81\uDC91", PropertyAttributes.None, typeof(int).MakePointerType(), new Type[] { typeof(int).MakePointerType() }, "1A", PropertyAttributes.None };
- }
+ yield return new object[] { "\uD800", PropertyAttributes.None, typeof(int).MakeByRefType(), new Type[] { typeof(int).MakeByRefType() }, "\uFFFD", PropertyAttributes.None };
+ yield return new object[] { "1A\0\t\v\r\n\n\uDC81\uDC91", PropertyAttributes.None, typeof(int).MakePointerType(), new Type[] { typeof(int).MakePointerType() }, "1A", PropertyAttributes.None };
+ }
- [Theory]
+ [Theory]
[MemberData(nameof(TestData))]
public void DefineProperty(string name, PropertyAttributes attributes, Type returnType, Type[] parameterTypes, string expectedName, PropertyAttributes expectedPropertyAttributes)
{
public static string[] InheritedButHiddenEvents = new string[] { };
public static string[] PublicEvents = new string[] { "EventPublic", "EventPublicStatic" };
- public event EventHandler EventPublic; // inherited
- public static event EventHandler EventPublicStatic; // static members are not inherited
+ public event EventHandler EventPublic; // inherited
+ public static event EventHandler EventPublicStatic; // static members are not inherited
- internal event EventHandler EventInternal; // not inherited
- internal static event EventHandler EventInternalStatic; // not inherited
+ internal event EventHandler EventInternal; // not inherited
+ internal static event EventHandler EventInternalStatic; // not inherited
- private event EventHandler EventPrivate; // not inherited
+ private event EventHandler EventPrivate; // not inherited
- protected event EventHandler EventProtected; // inherited
- protected static event EventHandler EventProtectedStatic; // not inherited
+ protected event EventHandler EventProtected; // inherited
+ protected static event EventHandler EventProtectedStatic; // not inherited
}
public class EventTestSubClass : EventTestBaseClass
new public static string[] InheritedButHiddenEvents = new string[] { "EventProtected" };
new public static string[] PublicEvents = new string[] { "EventPublic", "EventPublicNew" };
- new protected event EventHandler EventProtected; // overrides the ProEvent from EventFieldTest parent
+ new protected event EventHandler EventProtected; // overrides the ProEvent from EventFieldTest parent
public event EventHandler EventPublicNew;
}
new public static string[] InheritedButHiddenEvents = new string[] { "EventProtected" };
new public static string[] PublicEvents = new string[] { "eVentPublicNew", "EventPublic", "EventPublicNew" };
- protected event EventHandler eVentProtected; // overrides the ProEvent from EventFieldTest parent
+ protected event EventHandler eVentProtected; // overrides the ProEvent from EventFieldTest parent
public event EventHandler eVentPublicNew;
internal static event EventHandler eVENTInternal;
private event EventHandler eVentPriVate;
{
internal MetadataReaderProvider() { }
public void Dispose() { }
- public unsafe static System.Reflection.Metadata.MetadataReaderProvider FromMetadataImage(byte* start, int size) { throw null; }
+ public static unsafe System.Reflection.Metadata.MetadataReaderProvider FromMetadataImage(byte* start, int size) { throw null; }
public static System.Reflection.Metadata.MetadataReaderProvider FromMetadataImage(System.Collections.Immutable.ImmutableArray<byte> image) { throw null; }
public static System.Reflection.Metadata.MetadataReaderProvider FromMetadataStream(System.IO.Stream stream, System.Reflection.Metadata.MetadataStreamOptions options = System.Reflection.Metadata.MetadataStreamOptions.Default, int size = 0) { throw null; }
- public unsafe static System.Reflection.Metadata.MetadataReaderProvider FromPortablePdbImage(byte* start, int size) { throw null; }
+ public static unsafe System.Reflection.Metadata.MetadataReaderProvider FromPortablePdbImage(byte* start, int size) { throw null; }
public static System.Reflection.Metadata.MetadataReaderProvider FromPortablePdbImage(System.Collections.Immutable.ImmutableArray<byte> image) { throw null; }
public static System.Reflection.Metadata.MetadataReaderProvider FromPortablePdbStream(System.IO.Stream stream, System.Reflection.Metadata.MetadataStreamOptions options = System.Reflection.Metadata.MetadataStreamOptions.Default, int size = 0) { throw null; }
public System.Reflection.Metadata.MetadataReader GetMetadataReader(System.Reflection.Metadata.MetadataReaderOptions options = System.Reflection.Metadata.MetadataReaderOptions.Default, System.Reflection.Metadata.MetadataStringDecoder utf8Decoder = null) { throw null; }
// However, on .NET < 4.6, there isn't no-op fast path for zero-initialization case so we'd slow down.
// Plus, mutating a System.String is no better than the reflection here.
- IEnumerable<MethodInfo> createStringInfos = typeof(String).GetTypeInfo().GetDeclaredMethods("CreateStringFromEncoding");
+ IEnumerable<MethodInfo> createStringInfos = typeof(string).GetTypeInfo().GetDeclaredMethods("CreateStringFromEncoding");
foreach (var methodInfo in createStringInfos)
{
var parameters = methodInfo.GetParameters();
[DllImport(@"kernel32.dll", EntryPoint = "ReadFile", ExactSpelling = true, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static unsafe extern bool ReadFile(
+ internal static extern unsafe bool ReadFile(
SafeHandle fileHandle,
byte* buffer,
int byteCount,
[DllImport(@"kernel32.dll", EntryPoint = "ReadFile", ExactSpelling = true, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static unsafe extern bool ReadFile(
+ internal static extern unsafe bool ReadFile(
SafeHandle fileHandle,
byte* buffer,
int byteCount,
{
// header (skip local signature rid):
_reader.ReadCompressedInteger();
-
+
if (document.IsNil)
{
document = ReadDocumentHandle();
Void = CorElementType.ELEMENT_TYPE_VOID,
/// <summary>
- /// Represents <see cref="System.Boolean"/> in signatures.
+ /// Represents <see cref="bool"/> in signatures.
/// </summary>
Boolean = CorElementType.ELEMENT_TYPE_BOOLEAN,
/// <summary>
- /// Represents <see cref="System.Char"/> in signatures.
+ /// Represents <see cref="char"/> in signatures.
/// </summary>
Char = CorElementType.ELEMENT_TYPE_CHAR,
/// <summary>
- /// Represents <see cref="System.SByte"/> in signatures.
+ /// Represents <see cref="sbyte"/> in signatures.
/// </summary>
SByte = CorElementType.ELEMENT_TYPE_I1,
/// <summary>
- /// Represents <see cref="System.Byte"/> in signatures.
+ /// Represents <see cref="byte"/> in signatures.
/// </summary>
Byte = CorElementType.ELEMENT_TYPE_U1,
/// <summary>
- /// Represents <see cref="System.Int16"/> in signatures.
+ /// Represents <see cref="short"/> in signatures.
/// </summary>
Int16 = CorElementType.ELEMENT_TYPE_I2,
/// <summary>
- /// Represents <see cref="System.UInt16"/> in signatures.
+ /// Represents <see cref="ushort"/> in signatures.
/// </summary>
UInt16 = CorElementType.ELEMENT_TYPE_U2,
/// <summary>
- /// Represents <see cref="System.Int32"/> in signatures.
+ /// Represents <see cref="int"/> in signatures.
/// </summary>
Int32 = CorElementType.ELEMENT_TYPE_I4,
/// <summary>
- /// Represents <see cref="System.UInt32"/> in signatures.
+ /// Represents <see cref="uint"/> in signatures.
/// </summary>
UInt32 = CorElementType.ELEMENT_TYPE_U4,
/// <summary>
- /// Represents <see cref="System.Int64"/> in signatures.
+ /// Represents <see cref="long"/> in signatures.
/// </summary>
Int64 = CorElementType.ELEMENT_TYPE_I8,
/// <summary>
- /// Represents <see cref="System.UInt64"/> in signatures.
+ /// Represents <see cref="ulong"/> in signatures.
/// </summary>
UInt64 = CorElementType.ELEMENT_TYPE_U8,
/// <summary>
- /// Represents <see cref="System.Single"/> in signatures.
+ /// Represents <see cref="float"/> in signatures.
/// </summary>
Single = CorElementType.ELEMENT_TYPE_R4,
/// <summary>
- /// Represents <see cref="System.Double"/> in signatures.
+ /// Represents <see cref="double"/> in signatures.
/// </summary>
Double = CorElementType.ELEMENT_TYPE_R8,
/// <summary>
- /// Represents <see cref="System.String"/> in signatures.
+ /// Represents <see cref="string"/> in signatures.
/// </summary>
String = CorElementType.ELEMENT_TYPE_STRING,
FunctionPointer = CorElementType.ELEMENT_TYPE_FNPTR, // FNPTR <complete sig for the function including calling convention>
/// <summary>
- /// Represents <see cref="System.Object"/>
+ /// Represents <see cref="object"/>
/// </summary>
Object = CorElementType.ELEMENT_TYPE_OBJECT,
public class C
{
- public void MC1() { }
- public void MC2() { }
-
- event System.Action EC1;
- event System.Action EC2;
- event System.Action EC3;
+ public void MC1() { }
+ public void MC2() { }
+
+ event System.Action EC1;
+ event System.Action EC2;
+ event System.Action EC3;
}
public class D
{
- public void MD1() { }
- public int FD1;
+ public void MD1() { }
+ public int FD1;
- public int PE1 { get { return 1; } set { } }
-
- event System.Action ED1;
+ public int PE1 { get { return 1; } set { } }
+
+ event System.Action ED1;
}
public class E
{
- public int FE1;
- public int FE2;
- public int FE3;
- public int FE4;
-
- public int PE1 { get { return 1; } set { } }
- public int PE2 { get { return 1; } set { } }
+ public int FE1;
+ public int FE2;
+ public int FE3;
+ public int FE4;
+
+ public int PE1 { get { return 1; } set { } }
+ public int PE2 { get { return 1; } set { } }
}
if (t.Equals(typeof(FieldInfo)))
{
MemberTypeIndex = BindingFlagSupport.MemberTypeIndex.Field;
- Default = (MemberPolicies<M>)(Object)(new FieldPolicies());
+ Default = (MemberPolicies<M>)(object)(new FieldPolicies());
}
else if (t.Equals(typeof(MethodInfo)))
{
MemberTypeIndex = BindingFlagSupport.MemberTypeIndex.Method;
- Default = (MemberPolicies<M>)(Object)(new MethodPolicies());
+ Default = (MemberPolicies<M>)(object)(new MethodPolicies());
}
else if (t.Equals(typeof(ConstructorInfo)))
{
MemberTypeIndex = BindingFlagSupport.MemberTypeIndex.Constructor;
- Default = (MemberPolicies<M>)(Object)(new ConstructorPolicies());
+ Default = (MemberPolicies<M>)(object)(new ConstructorPolicies());
}
else if (t.Equals(typeof(PropertyInfo)))
{
MemberTypeIndex = BindingFlagSupport.MemberTypeIndex.Property; ;
- Default = (MemberPolicies<M>)(Object)(new PropertyPolicies());
+ Default = (MemberPolicies<M>)(object)(new PropertyPolicies());
}
else if (t.Equals(typeof(EventInfo)))
{
MemberTypeIndex = BindingFlagSupport.MemberTypeIndex.Event;
- Default = (MemberPolicies<M>)(Object)(new EventPolicies());
+ Default = (MemberPolicies<M>)(object)(new EventPolicies());
}
else if (t.Equals(typeof(Type)))
{
MemberTypeIndex = BindingFlagSupport.MemberTypeIndex.NestedType;
- Default = (MemberPolicies<M>)(Object)(new NestedTypePolicies());
+ Default = (MemberPolicies<M>)(object)(new NestedTypePolicies());
}
else
{
return _items;
}
- public void CopyTo(Object[] array, int index)
+ public void CopyTo(object[] array, int index)
{
if (_count == 0)
return;
result.PointerToResource = blobReader.CurrentPointer;
// Length check the size of the resource to ensure it fits in the PE file section, note, this is only safe as its in a checked region
- if (length + sizeof(Int32) > blobReader.Length)
+ if (length + sizeof(int) > blobReader.Length)
throw new BadImageFormatException();
result.SizeOfResource = length;
}
public static partial class ConstructorTests
{
[Fact]
- public unsafe static void TestConstructors1()
+ public static unsafe void TestConstructors1()
{
TestConstructors1Worker(typeof(ClassWithConstructor1<>).Project());
TestConstructors1Worker(typeof(ClassWithConstructor1<int>).Project());
public static partial class FieldTests
{
[Fact]
- public unsafe static void TestFields1()
+ public static unsafe void TestFields1()
{
TestField1Worker(typeof(ClassWithFields1<>).Project());
TestField1Worker(typeof(ClassWithFields1<int>).Project());
}
[Fact]
- public unsafe static void TestLiteralFields1()
+ public static unsafe void TestLiteralFields1()
{
Type t = typeof(ClassWithLiteralFields).Project();
FieldInfo[] fields = t.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly);
}
[Fact]
- public unsafe static void TestCustomModifiers1()
+ public static unsafe void TestCustomModifiers1()
{
using (MetadataLoadContext lc = new MetadataLoadContext(
new FuncMetadataAssemblyResolver(
}
[Fact]
- public unsafe static void TestCustomModifiers2()
+ public static unsafe void TestCustomModifiers2()
{
using (MetadataLoadContext lc = new MetadataLoadContext(new CoreMetadataAssemblyResolver(), "mscorlib"))
{
public static partial class MethodTests
{
[Fact]
- public unsafe static void TestMethods1()
+ public static unsafe void TestMethods1()
{
TestMethods1Worker(typeof(ClassWithMethods1<>).Project());
TestMethods1Worker(typeof(ClassWithMethods1<int>).Project());
}
[Fact]
- public unsafe static void TestAllCoreTypes()
+ public static unsafe void TestAllCoreTypes()
{
const BindingFlags bf = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
MethodInfo m = typeof(ClassWithMethods1<>).Project().GetMethod("TestPrimitives1", bf);
}
[Fact]
- public unsafe static void TestCustomModifiers1()
+ public static unsafe void TestCustomModifiers1()
{
using (MetadataLoadContext lc = new MetadataLoadContext(new CoreMetadataAssemblyResolver(), "mscorlib"))
{
}
[Fact]
- public unsafe static void TestCustomModifiers1()
+ public static unsafe void TestCustomModifiers1()
{
using (MetadataLoadContext lc = new MetadataLoadContext(new CoreMetadataAssemblyResolver(), "mscorlib"))
{
[Fact]
public static void TestIsPrimitive()
{
- Assert.True(typeof(Boolean).Project().IsPrimitive);
- Assert.True(typeof(Char).Project().IsPrimitive);
- Assert.True(typeof(SByte).Project().IsPrimitive);
- Assert.True(typeof(Byte).Project().IsPrimitive);
- Assert.True(typeof(Int16).Project().IsPrimitive);
- Assert.True(typeof(UInt16).Project().IsPrimitive);
- Assert.True(typeof(Int32).Project().IsPrimitive);
- Assert.True(typeof(UInt32).Project().IsPrimitive);
- Assert.True(typeof(Int64).Project().IsPrimitive);
- Assert.True(typeof(UInt64).Project().IsPrimitive);
- Assert.True(typeof(Single).Project().IsPrimitive);
- Assert.True(typeof(Double).Project().IsPrimitive);
+ Assert.True(typeof(bool).Project().IsPrimitive);
+ Assert.True(typeof(char).Project().IsPrimitive);
+ Assert.True(typeof(sbyte).Project().IsPrimitive);
+ Assert.True(typeof(byte).Project().IsPrimitive);
+ Assert.True(typeof(short).Project().IsPrimitive);
+ Assert.True(typeof(ushort).Project().IsPrimitive);
+ Assert.True(typeof(int).Project().IsPrimitive);
+ Assert.True(typeof(uint).Project().IsPrimitive);
+ Assert.True(typeof(long).Project().IsPrimitive);
+ Assert.True(typeof(ulong).Project().IsPrimitive);
+ Assert.True(typeof(float).Project().IsPrimitive);
+ Assert.True(typeof(double).Project().IsPrimitive);
Assert.True(typeof(IntPtr).Project().IsPrimitive);
Assert.True(typeof(UIntPtr).Project().IsPrimitive);
Assert.False(typeof(void).Project().IsPrimitive);
- Assert.False(typeof(Decimal).Project().IsPrimitive);
+ Assert.False(typeof(decimal).Project().IsPrimitive);
Assert.False(typeof(BindingFlags).Project().IsPrimitive);
- Assert.False(typeof(Int32[]).Project().IsPrimitive);
+ Assert.False(typeof(int[]).Project().IsPrimitive);
return;
}
[Fact]
public static void TestIsValueType()
{
- Assert.True(typeof(Boolean).Project().IsValueType);
- Assert.False(typeof(Boolean).Project().MakeArrayType().IsValueType);
- Assert.False(typeof(Boolean).Project().MakeArrayType(1).IsValueType);
- Assert.False(typeof(Boolean).Project().MakeByRefType().IsValueType);
- Assert.False(typeof(Boolean).Project().MakePointerType().IsValueType);
+ Assert.True(typeof(bool).Project().IsValueType);
+ Assert.False(typeof(bool).Project().MakeArrayType().IsValueType);
+ Assert.False(typeof(bool).Project().MakeArrayType(1).IsValueType);
+ Assert.False(typeof(bool).Project().MakeByRefType().IsValueType);
+ Assert.False(typeof(bool).Project().MakePointerType().IsValueType);
Assert.True(typeof(KeyValuePair<,>).Project().IsValueType);
Assert.True(typeof(KeyValuePair<object, object>).Project().IsValueType);
Assert.False(typeof(object).Project().IsValueType);
//Metadata for Reflection
public class TypeInfoEventBaseClass
{
- public event EventHandler EventPublic; // inherited
+ public event EventHandler EventPublic; // inherited
public static event EventHandler EventPublicStatic;
}
public class TypeInfoEventSubClass : TypeInfoEventBaseClass
{
- public new event EventHandler EventPublic; //overrides event
+ public new event EventHandler EventPublic; //overrides event
public event EventHandler EventPublicNew; // new event
}
}
public class NestPublic { }
public class NestPublic2 { }
- private class NestPrivate { } // private, so not inherited
- internal class NestInternal { } // internal members are not inherited
+ private class NestPrivate { } // private, so not inherited
+ internal class NestInternal { } // internal members are not inherited
protected class NestProtected { }
- private class NestAssemblyPrivate { } // same as private, so not inherited
+ private class NestAssemblyPrivate { } // same as private, so not inherited
}
public class TestNestDerived : TestNest
}
if (!found)
- Assert.False(true, String.Format("Property {0} not found in Type {1}", name, t.Name));
+ Assert.False(true, string.Format("Property {0} not found in Type {1}", name, t.Name));
}
} //end class
[Fact]
public static void TestGenericArguments13()
{
- VerifyGenericTypeArguments(typeof(Test_SIG<Int32>).Project(), new string[] { "Int32" }, new string[] { "Int32" });
+ VerifyGenericTypeArguments(typeof(Test_SIG<int>).Project(), new string[] { "Int32" }, new string[] { "Int32" });
}
// Verify Generic Arguments
[Fact]
public static void TestGenericArguments15()
{
- VerifyGenericTypeArguments(typeof(Test_SIG2<Int32, string>).Project(), new string[] { "Int32", "String" }, new string[] { "Int32", "String" });
+ VerifyGenericTypeArguments(typeof(Test_SIG2<int, string>).Project(), new string[] { "Int32", "String" }, new string[] { "Int32", "String" });
}
// Verify Generic Arguments
private static void VerifyInterfaces(Type type, params Type[] expected)
{
//Fix to initialize Reflection
- string str = typeof(Object).Project().Name;
+ string str = typeof(object).Project().Name;
TypeInfo typeInfo = type.GetTypeInfo();
List<Type> list = new List<Type>();
}
//private helper methods
- private static void VerifyIsAssignableFrom(string TestName, TypeInfo left, TypeInfo right, Boolean expected)
+ private static void VerifyIsAssignableFrom(string TestName, TypeInfo left, TypeInfo right, bool expected)
{
{
//Fix to initialize Reflection
- string str = typeof(Object).Project().Name;
+ string str = typeof(object).Project().Name;
bool actual = left.IsAssignableFrom(right);
Assert.Equal(expected, actual);
[Fact]
public static void TestMakeArrayType2()
{
- TypeInfo ti = typeof(Int32).Project().GetTypeInfo();
+ TypeInfo ti = typeof(int).Project().GetTypeInfo();
Type arraytype = ti.MakeArrayType();
int[] intArray = { 1, 2, 3 };
public TI_SubClass(string s) { }
public TI_SubClass(short i2) { }
- public new event EventHandler EventPublic; // Overrides event
+ public new event EventHandler EventPublic; // Overrides event
public event EventHandler EventPublicNew; // New event
public new static string[] s_arrayField = new string[10];
private const int CHANGED = 0x02; // dependency changed
private const int INVOKED = 0x04; // OnChangedCallback has been invoked
private const int DISPOSED = 0x08; // Dispose(true) called, or about to be called
- private readonly static object s_NOT_SET = new object();
+ private static readonly object s_NOT_SET = new object();
private SafeBitVector32 _flags;
private OnChangedCallback _onChangedCallback;
<add name="Foo" physicalMemoryPercentage="0" pollingInterval="00:02:00"/>
<add name="Bar" physicalMemoryPercentage="0" pollingInterval="00:02:00"/>
</namedCaches>
- </memoryCaches>
+ </memoryCaches>
</system.caching>
*/
// The actual unique id is constructed from key names followed by the hex value of ticks of their last modifed time
Assert.False(string.IsNullOrEmpty(monitor.UniqueId));
- monitor = mc.CreateCacheEntryChangeMonitor (new string [] { "key1", "doesnotexist" });
- Assert.NotNull (monitor);
- Assert.Equal ("System.Runtime.Caching.MemoryCacheEntryChangeMonitor", monitor.GetType ().ToString ());
- Assert.Equal (2, monitor.CacheKeys.Count);
- Assert.Equal ("key1", monitor.CacheKeys [0]);
- Assert.Null (monitor.RegionName);
- Assert.True (monitor.HasChanged);
+ monitor = mc.CreateCacheEntryChangeMonitor (new string [] { "key1", "doesnotexist" });
+ Assert.NotNull (monitor);
+ Assert.Equal ("System.Runtime.Caching.MemoryCacheEntryChangeMonitor", monitor.GetType ().ToString ());
+ Assert.Equal (2, monitor.CacheKeys.Count);
+ Assert.Equal ("key1", monitor.CacheKeys [0]);
+ Assert.Null (monitor.RegionName);
+ Assert.True (monitor.HasChanged);
}
[Fact]
Assert.Equal(HEAP_RESIZE_SHORT_ENTRIES, mc.GetCount());
- // add some long duration entries
+ // add some long duration entries
for (int i = 0; i < HEAP_RESIZE_LONG_ENTRIES; i++)
{
var expireAt = DateTimeOffset.Now.AddSeconds(42);
public static partial class Unsafe
{
public static ref T AddByteOffset<T>(ref T source, System.IntPtr byteOffset) { throw null; }
- public unsafe static void* Add<T>(void* source, int elementOffset) { throw null; }
+ public static unsafe void* Add<T>(void* source, int elementOffset) { throw null; }
public static ref T Add<T>(ref T source, int elementOffset) { throw null; }
public static ref T Add<T>(ref T source, System.IntPtr elementOffset) { throw null; }
public static bool AreSame<T>(ref T left, ref T right) { throw null; }
- public unsafe static void* AsPointer<T>(ref T value) { throw null; }
- public unsafe static ref T AsRef<T>(void* source) { throw null; }
+ public static unsafe void* AsPointer<T>(ref T value) { throw null; }
+ public static unsafe ref T AsRef<T>(void* source) { throw null; }
public static ref T AsRef<T>(in T source) { throw null; }
public static T As<T>(object o) where T : class { throw null; }
public static ref TTo As<TFrom, TTo>(ref TFrom source) { throw null; }
public static System.IntPtr ByteOffset<T>(ref T origin, ref T target) { throw null; }
public static void CopyBlock(ref byte destination, ref byte source, uint byteCount) { }
- public unsafe static void CopyBlock(void* destination, void* source, uint byteCount) { }
+ public static unsafe void CopyBlock(void* destination, void* source, uint byteCount) { }
public static void CopyBlockUnaligned(ref byte destination, ref byte source, uint byteCount) { }
- public unsafe static void CopyBlockUnaligned(void* destination, void* source, uint byteCount) { }
- public unsafe static void Copy<T>(void* destination, ref T source) { }
- public unsafe static void Copy<T>(ref T destination, void* source) { }
+ public static unsafe void CopyBlockUnaligned(void* destination, void* source, uint byteCount) { }
+ public static unsafe void Copy<T>(void* destination, ref T source) { }
+ public static unsafe void Copy<T>(ref T destination, void* source) { }
public static void InitBlock(ref byte startAddress, byte value, uint byteCount) { }
- public unsafe static void InitBlock(void* startAddress, byte value, uint byteCount) { }
+ public static unsafe void InitBlock(void* startAddress, byte value, uint byteCount) { }
public static void InitBlockUnaligned(ref byte startAddress, byte value, uint byteCount) { }
- public unsafe static void InitBlockUnaligned(void* startAddress, byte value, uint byteCount) { }
+ public static unsafe void InitBlockUnaligned(void* startAddress, byte value, uint byteCount) { }
public static bool IsAddressGreaterThan<T>(ref T left, ref T right) { throw null; }
public static bool IsAddressLessThan<T>(ref T left, ref T right) { throw null; }
public static T ReadUnaligned<T>(ref byte source) { throw null; }
- public unsafe static T ReadUnaligned<T>(void* source) { throw null; }
- public unsafe static T Read<T>(void* source) { throw null; }
+ public static unsafe T ReadUnaligned<T>(void* source) { throw null; }
+ public static unsafe T Read<T>(void* source) { throw null; }
public static int SizeOf<T>() { throw null; }
public static ref T SubtractByteOffset<T>(ref T source, System.IntPtr byteOffset) { throw null; }
- public unsafe static void* Subtract<T>(void* source, int elementOffset) { throw null; }
+ public static unsafe void* Subtract<T>(void* source, int elementOffset) { throw null; }
public static ref T Subtract<T>(ref T source, int elementOffset) { throw null; }
public static ref T Subtract<T>(ref T source, System.IntPtr elementOffset) { throw null; }
public static ref T Unbox<T>(object box) where T : struct { throw null; }
public static void WriteUnaligned<T>(ref byte destination, T value) { }
- public unsafe static void WriteUnaligned<T>(void* destination, T value) { }
- public unsafe static void Write<T>(void* destination, T value) { }
+ public static unsafe void WriteUnaligned<T>(void* destination, T value) { }
+ public static unsafe void Write<T>(void* destination, T value) { }
}
}
}
}
- private unsafe static bool IsNegativeZero(double value)
+ private static unsafe bool IsNegativeZero(double value)
{
return (*(ulong*)(&value)) == 0x8000000000000000;
}
- private unsafe static bool IsNegativeZero(float value)
+ private static unsafe bool IsNegativeZero(float value)
{
return (*(uint*)(&value)) == 0x80000000;
}
- private unsafe static bool IsPositiveZero(double value)
+ private static unsafe bool IsPositiveZero(double value)
{
return (*(ulong*)(&value)) == 0x0000000000000000;
}
- private unsafe static bool IsPositiveZero(float value)
+ private static unsafe bool IsPositiveZero(float value)
{
return (*(uint*)(&value)) == 0x00000000;
}
}
}
- private unsafe static bool IsNegativeZero(float value)
+ private static unsafe bool IsNegativeZero(float value)
{
return (*(uint*)(&value)) == 0x80000000;
}
- private unsafe static bool IsPositiveZero(float value)
+ private static unsafe bool IsPositiveZero(float value)
{
return (*(uint*)(&value)) == 0x00000000;
}
public static System.Runtime.Intrinsics.Vector256<float> Blend(System.Runtime.Intrinsics.Vector256<float> left, System.Runtime.Intrinsics.Vector256<float> right, byte control) { throw null; }
public static System.Runtime.Intrinsics.Vector256<double> BlendVariable(System.Runtime.Intrinsics.Vector256<double> left, System.Runtime.Intrinsics.Vector256<double> right, System.Runtime.Intrinsics.Vector256<double> mask) { throw null; }
public static System.Runtime.Intrinsics.Vector256<float> BlendVariable(System.Runtime.Intrinsics.Vector256<float> left, System.Runtime.Intrinsics.Vector256<float> right, System.Runtime.Intrinsics.Vector256<float> mask) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<float> BroadcastScalarToVector128(float* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<double> BroadcastScalarToVector256(double* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<float> BroadcastScalarToVector256(float* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<double> BroadcastVector128ToVector256(double* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<float> BroadcastVector128ToVector256(float* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<float> BroadcastScalarToVector128(float* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<double> BroadcastScalarToVector256(double* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<float> BroadcastScalarToVector256(float* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<double> BroadcastVector128ToVector256(double* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<float> BroadcastVector128ToVector256(float* address) { throw null; }
public static System.Runtime.Intrinsics.Vector256<double> Ceiling(System.Runtime.Intrinsics.Vector256<double> value) { throw null; }
public static System.Runtime.Intrinsics.Vector256<float> Ceiling(System.Runtime.Intrinsics.Vector256<float> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<double> Compare(System.Runtime.Intrinsics.Vector128<double> left, System.Runtime.Intrinsics.Vector128<double> right, System.Runtime.Intrinsics.X86.FloatComparisonMode mode) { throw null; }
public static System.Runtime.Intrinsics.Vector256<ushort> InsertVector128(System.Runtime.Intrinsics.Vector256<ushort> value, System.Runtime.Intrinsics.Vector128<ushort> data, byte index) { throw null; }
public static System.Runtime.Intrinsics.Vector256<uint> InsertVector128(System.Runtime.Intrinsics.Vector256<uint> value, System.Runtime.Intrinsics.Vector128<uint> data, byte index) { throw null; }
public static System.Runtime.Intrinsics.Vector256<ulong> InsertVector128(System.Runtime.Intrinsics.Vector256<ulong> value, System.Runtime.Intrinsics.Vector128<ulong> data, byte index) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<byte> LoadAlignedVector256(byte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<double> LoadAlignedVector256(double* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<short> LoadAlignedVector256(short* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<int> LoadAlignedVector256(int* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> LoadAlignedVector256(long* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<sbyte> LoadAlignedVector256(sbyte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<float> LoadAlignedVector256(float* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ushort> LoadAlignedVector256(ushort* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<uint> LoadAlignedVector256(uint* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ulong> LoadAlignedVector256(ulong* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<byte> LoadDquVector256(byte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<short> LoadDquVector256(short* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<int> LoadDquVector256(int* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> LoadDquVector256(long* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<sbyte> LoadDquVector256(sbyte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ushort> LoadDquVector256(ushort* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<uint> LoadDquVector256(uint* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ulong> LoadDquVector256(ulong* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<byte> LoadVector256(byte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<double> LoadVector256(double* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<short> LoadVector256(short* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<int> LoadVector256(int* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> LoadVector256(long* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<sbyte> LoadVector256(sbyte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<float> LoadVector256(float* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ushort> LoadVector256(ushort* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<uint> LoadVector256(uint* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ulong> LoadVector256(ulong* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<double> MaskLoad(double* address, System.Runtime.Intrinsics.Vector128<double> mask) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<double> MaskLoad(double* address, System.Runtime.Intrinsics.Vector256<double> mask) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<float> MaskLoad(float* address, System.Runtime.Intrinsics.Vector128<float> mask) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<float> MaskLoad(float* address, System.Runtime.Intrinsics.Vector256<float> mask) { throw null; }
- public unsafe static void MaskStore(double* address, System.Runtime.Intrinsics.Vector128<double> mask, System.Runtime.Intrinsics.Vector128<double> source) { }
- public unsafe static void MaskStore(double* address, System.Runtime.Intrinsics.Vector256<double> mask, System.Runtime.Intrinsics.Vector256<double> source) { }
- public unsafe static void MaskStore(float* address, System.Runtime.Intrinsics.Vector128<float> mask, System.Runtime.Intrinsics.Vector128<float> source) { }
- public unsafe static void MaskStore(float* address, System.Runtime.Intrinsics.Vector256<float> mask, System.Runtime.Intrinsics.Vector256<float> source) { }
+ public static unsafe System.Runtime.Intrinsics.Vector256<byte> LoadAlignedVector256(byte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<double> LoadAlignedVector256(double* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<short> LoadAlignedVector256(short* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<int> LoadAlignedVector256(int* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> LoadAlignedVector256(long* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<sbyte> LoadAlignedVector256(sbyte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<float> LoadAlignedVector256(float* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ushort> LoadAlignedVector256(ushort* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<uint> LoadAlignedVector256(uint* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ulong> LoadAlignedVector256(ulong* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<byte> LoadDquVector256(byte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<short> LoadDquVector256(short* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<int> LoadDquVector256(int* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> LoadDquVector256(long* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<sbyte> LoadDquVector256(sbyte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ushort> LoadDquVector256(ushort* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<uint> LoadDquVector256(uint* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ulong> LoadDquVector256(ulong* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<byte> LoadVector256(byte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<double> LoadVector256(double* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<short> LoadVector256(short* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<int> LoadVector256(int* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> LoadVector256(long* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<sbyte> LoadVector256(sbyte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<float> LoadVector256(float* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ushort> LoadVector256(ushort* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<uint> LoadVector256(uint* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ulong> LoadVector256(ulong* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<double> MaskLoad(double* address, System.Runtime.Intrinsics.Vector128<double> mask) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<double> MaskLoad(double* address, System.Runtime.Intrinsics.Vector256<double> mask) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<float> MaskLoad(float* address, System.Runtime.Intrinsics.Vector128<float> mask) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<float> MaskLoad(float* address, System.Runtime.Intrinsics.Vector256<float> mask) { throw null; }
+ public static unsafe void MaskStore(double* address, System.Runtime.Intrinsics.Vector128<double> mask, System.Runtime.Intrinsics.Vector128<double> source) { }
+ public static unsafe void MaskStore(double* address, System.Runtime.Intrinsics.Vector256<double> mask, System.Runtime.Intrinsics.Vector256<double> source) { }
+ public static unsafe void MaskStore(float* address, System.Runtime.Intrinsics.Vector128<float> mask, System.Runtime.Intrinsics.Vector128<float> source) { }
+ public static unsafe void MaskStore(float* address, System.Runtime.Intrinsics.Vector256<float> mask, System.Runtime.Intrinsics.Vector256<float> source) { }
public static System.Runtime.Intrinsics.Vector256<double> Max(System.Runtime.Intrinsics.Vector256<double> left, System.Runtime.Intrinsics.Vector256<double> right) { throw null; }
public static System.Runtime.Intrinsics.Vector256<float> Max(System.Runtime.Intrinsics.Vector256<float> left, System.Runtime.Intrinsics.Vector256<float> right) { throw null; }
public static System.Runtime.Intrinsics.Vector256<double> Min(System.Runtime.Intrinsics.Vector256<double> left, System.Runtime.Intrinsics.Vector256<double> right) { throw null; }
public static System.Runtime.Intrinsics.Vector256<float> Shuffle(System.Runtime.Intrinsics.Vector256<float> value, System.Runtime.Intrinsics.Vector256<float> right, byte control) { throw null; }
public static System.Runtime.Intrinsics.Vector256<double> Sqrt(System.Runtime.Intrinsics.Vector256<double> value) { throw null; }
public static System.Runtime.Intrinsics.Vector256<float> Sqrt(System.Runtime.Intrinsics.Vector256<float> value) { throw null; }
- public unsafe static void Store(byte* address, System.Runtime.Intrinsics.Vector256<byte> source) { }
- public unsafe static void Store(double* address, System.Runtime.Intrinsics.Vector256<double> source) { }
- public unsafe static void Store(short* address, System.Runtime.Intrinsics.Vector256<short> source) { }
- public unsafe static void Store(int* address, System.Runtime.Intrinsics.Vector256<int> source) { }
- public unsafe static void Store(long* address, System.Runtime.Intrinsics.Vector256<long> source) { }
- public unsafe static void Store(sbyte* address, System.Runtime.Intrinsics.Vector256<sbyte> source) { }
- public unsafe static void Store(float* address, System.Runtime.Intrinsics.Vector256<float> source) { }
- public unsafe static void Store(ushort* address, System.Runtime.Intrinsics.Vector256<ushort> source) { }
- public unsafe static void Store(uint* address, System.Runtime.Intrinsics.Vector256<uint> source) { }
- public unsafe static void Store(ulong* address, System.Runtime.Intrinsics.Vector256<ulong> source) { }
- public unsafe static void StoreAligned(byte* address, System.Runtime.Intrinsics.Vector256<byte> source) { }
- public unsafe static void StoreAligned(double* address, System.Runtime.Intrinsics.Vector256<double> source) { }
- public unsafe static void StoreAligned(short* address, System.Runtime.Intrinsics.Vector256<short> source) { }
- public unsafe static void StoreAligned(int* address, System.Runtime.Intrinsics.Vector256<int> source) { }
- public unsafe static void StoreAligned(long* address, System.Runtime.Intrinsics.Vector256<long> source) { }
- public unsafe static void StoreAligned(sbyte* address, System.Runtime.Intrinsics.Vector256<sbyte> source) { }
- public unsafe static void StoreAligned(float* address, System.Runtime.Intrinsics.Vector256<float> source) { }
- public unsafe static void StoreAligned(ushort* address, System.Runtime.Intrinsics.Vector256<ushort> source) { }
- public unsafe static void StoreAligned(uint* address, System.Runtime.Intrinsics.Vector256<uint> source) { }
- public unsafe static void StoreAligned(ulong* address, System.Runtime.Intrinsics.Vector256<ulong> source) { }
- public unsafe static void StoreAlignedNonTemporal(byte* address, System.Runtime.Intrinsics.Vector256<byte> source) { }
- public unsafe static void StoreAlignedNonTemporal(double* address, System.Runtime.Intrinsics.Vector256<double> source) { }
- public unsafe static void StoreAlignedNonTemporal(short* address, System.Runtime.Intrinsics.Vector256<short> source) { }
- public unsafe static void StoreAlignedNonTemporal(int* address, System.Runtime.Intrinsics.Vector256<int> source) { }
- public unsafe static void StoreAlignedNonTemporal(long* address, System.Runtime.Intrinsics.Vector256<long> source) { }
- public unsafe static void StoreAlignedNonTemporal(sbyte* address, System.Runtime.Intrinsics.Vector256<sbyte> source) { }
- public unsafe static void StoreAlignedNonTemporal(float* address, System.Runtime.Intrinsics.Vector256<float> source) { }
- public unsafe static void StoreAlignedNonTemporal(ushort* address, System.Runtime.Intrinsics.Vector256<ushort> source) { }
- public unsafe static void StoreAlignedNonTemporal(uint* address, System.Runtime.Intrinsics.Vector256<uint> source) { }
- public unsafe static void StoreAlignedNonTemporal(ulong* address, System.Runtime.Intrinsics.Vector256<ulong> source) { }
+ public static unsafe void Store(byte* address, System.Runtime.Intrinsics.Vector256<byte> source) { }
+ public static unsafe void Store(double* address, System.Runtime.Intrinsics.Vector256<double> source) { }
+ public static unsafe void Store(short* address, System.Runtime.Intrinsics.Vector256<short> source) { }
+ public static unsafe void Store(int* address, System.Runtime.Intrinsics.Vector256<int> source) { }
+ public static unsafe void Store(long* address, System.Runtime.Intrinsics.Vector256<long> source) { }
+ public static unsafe void Store(sbyte* address, System.Runtime.Intrinsics.Vector256<sbyte> source) { }
+ public static unsafe void Store(float* address, System.Runtime.Intrinsics.Vector256<float> source) { }
+ public static unsafe void Store(ushort* address, System.Runtime.Intrinsics.Vector256<ushort> source) { }
+ public static unsafe void Store(uint* address, System.Runtime.Intrinsics.Vector256<uint> source) { }
+ public static unsafe void Store(ulong* address, System.Runtime.Intrinsics.Vector256<ulong> source) { }
+ public static unsafe void StoreAligned(byte* address, System.Runtime.Intrinsics.Vector256<byte> source) { }
+ public static unsafe void StoreAligned(double* address, System.Runtime.Intrinsics.Vector256<double> source) { }
+ public static unsafe void StoreAligned(short* address, System.Runtime.Intrinsics.Vector256<short> source) { }
+ public static unsafe void StoreAligned(int* address, System.Runtime.Intrinsics.Vector256<int> source) { }
+ public static unsafe void StoreAligned(long* address, System.Runtime.Intrinsics.Vector256<long> source) { }
+ public static unsafe void StoreAligned(sbyte* address, System.Runtime.Intrinsics.Vector256<sbyte> source) { }
+ public static unsafe void StoreAligned(float* address, System.Runtime.Intrinsics.Vector256<float> source) { }
+ public static unsafe void StoreAligned(ushort* address, System.Runtime.Intrinsics.Vector256<ushort> source) { }
+ public static unsafe void StoreAligned(uint* address, System.Runtime.Intrinsics.Vector256<uint> source) { }
+ public static unsafe void StoreAligned(ulong* address, System.Runtime.Intrinsics.Vector256<ulong> source) { }
+ public static unsafe void StoreAlignedNonTemporal(byte* address, System.Runtime.Intrinsics.Vector256<byte> source) { }
+ public static unsafe void StoreAlignedNonTemporal(double* address, System.Runtime.Intrinsics.Vector256<double> source) { }
+ public static unsafe void StoreAlignedNonTemporal(short* address, System.Runtime.Intrinsics.Vector256<short> source) { }
+ public static unsafe void StoreAlignedNonTemporal(int* address, System.Runtime.Intrinsics.Vector256<int> source) { }
+ public static unsafe void StoreAlignedNonTemporal(long* address, System.Runtime.Intrinsics.Vector256<long> source) { }
+ public static unsafe void StoreAlignedNonTemporal(sbyte* address, System.Runtime.Intrinsics.Vector256<sbyte> source) { }
+ public static unsafe void StoreAlignedNonTemporal(float* address, System.Runtime.Intrinsics.Vector256<float> source) { }
+ public static unsafe void StoreAlignedNonTemporal(ushort* address, System.Runtime.Intrinsics.Vector256<ushort> source) { }
+ public static unsafe void StoreAlignedNonTemporal(uint* address, System.Runtime.Intrinsics.Vector256<uint> source) { }
+ public static unsafe void StoreAlignedNonTemporal(ulong* address, System.Runtime.Intrinsics.Vector256<ulong> source) { }
public static System.Runtime.Intrinsics.Vector256<double> Subtract(System.Runtime.Intrinsics.Vector256<double> left, System.Runtime.Intrinsics.Vector256<double> right) { throw null; }
public static System.Runtime.Intrinsics.Vector256<float> Subtract(System.Runtime.Intrinsics.Vector256<float> left, System.Runtime.Intrinsics.Vector256<float> right) { throw null; }
public static bool TestC(System.Runtime.Intrinsics.Vector128<double> left, System.Runtime.Intrinsics.Vector128<double> right) { throw null; }
public static System.Runtime.Intrinsics.Vector256<ushort> BlendVariable(System.Runtime.Intrinsics.Vector256<ushort> left, System.Runtime.Intrinsics.Vector256<ushort> right, System.Runtime.Intrinsics.Vector256<ushort> mask) { throw null; }
public static System.Runtime.Intrinsics.Vector256<uint> BlendVariable(System.Runtime.Intrinsics.Vector256<uint> left, System.Runtime.Intrinsics.Vector256<uint> right, System.Runtime.Intrinsics.Vector256<uint> mask) { throw null; }
public static System.Runtime.Intrinsics.Vector256<ulong> BlendVariable(System.Runtime.Intrinsics.Vector256<ulong> left, System.Runtime.Intrinsics.Vector256<ulong> right, System.Runtime.Intrinsics.Vector256<ulong> mask) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<byte> BroadcastScalarToVector128(byte* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<short> BroadcastScalarToVector128(short* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> BroadcastScalarToVector128(int* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> BroadcastScalarToVector128(long* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<byte> BroadcastScalarToVector128(byte* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<short> BroadcastScalarToVector128(short* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> BroadcastScalarToVector128(int* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> BroadcastScalarToVector128(long* source) { throw null; }
public static System.Runtime.Intrinsics.Vector128<byte> BroadcastScalarToVector128(System.Runtime.Intrinsics.Vector128<byte> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<double> BroadcastScalarToVector128(System.Runtime.Intrinsics.Vector128<double> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<short> BroadcastScalarToVector128(System.Runtime.Intrinsics.Vector128<short> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<ushort> BroadcastScalarToVector128(System.Runtime.Intrinsics.Vector128<ushort> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<uint> BroadcastScalarToVector128(System.Runtime.Intrinsics.Vector128<uint> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<ulong> BroadcastScalarToVector128(System.Runtime.Intrinsics.Vector128<ulong> value) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<sbyte> BroadcastScalarToVector128(sbyte* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<ushort> BroadcastScalarToVector128(ushort* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<uint> BroadcastScalarToVector128(uint* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<ulong> BroadcastScalarToVector128(ulong* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<byte> BroadcastScalarToVector256(byte* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<short> BroadcastScalarToVector256(short* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<int> BroadcastScalarToVector256(int* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> BroadcastScalarToVector256(long* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<sbyte> BroadcastScalarToVector128(sbyte* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<ushort> BroadcastScalarToVector128(ushort* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<uint> BroadcastScalarToVector128(uint* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<ulong> BroadcastScalarToVector128(ulong* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<byte> BroadcastScalarToVector256(byte* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<short> BroadcastScalarToVector256(short* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<int> BroadcastScalarToVector256(int* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> BroadcastScalarToVector256(long* source) { throw null; }
public static System.Runtime.Intrinsics.Vector256<byte> BroadcastScalarToVector256(System.Runtime.Intrinsics.Vector128<byte> value) { throw null; }
public static System.Runtime.Intrinsics.Vector256<double> BroadcastScalarToVector256(System.Runtime.Intrinsics.Vector128<double> value) { throw null; }
public static System.Runtime.Intrinsics.Vector256<short> BroadcastScalarToVector256(System.Runtime.Intrinsics.Vector128<short> value) { throw null; }
public static System.Runtime.Intrinsics.Vector256<ushort> BroadcastScalarToVector256(System.Runtime.Intrinsics.Vector128<ushort> value) { throw null; }
public static System.Runtime.Intrinsics.Vector256<uint> BroadcastScalarToVector256(System.Runtime.Intrinsics.Vector128<uint> value) { throw null; }
public static System.Runtime.Intrinsics.Vector256<ulong> BroadcastScalarToVector256(System.Runtime.Intrinsics.Vector128<ulong> value) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<sbyte> BroadcastScalarToVector256(sbyte* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ushort> BroadcastScalarToVector256(ushort* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<uint> BroadcastScalarToVector256(uint* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ulong> BroadcastScalarToVector256(ulong* source) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<byte> BroadcastVector128ToVector256(byte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<short> BroadcastVector128ToVector256(short* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<int> BroadcastVector128ToVector256(int* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> BroadcastVector128ToVector256(long* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<sbyte> BroadcastVector128ToVector256(sbyte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ushort> BroadcastVector128ToVector256(ushort* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<uint> BroadcastVector128ToVector256(uint* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ulong> BroadcastVector128ToVector256(ulong* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<sbyte> BroadcastScalarToVector256(sbyte* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ushort> BroadcastScalarToVector256(ushort* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<uint> BroadcastScalarToVector256(uint* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ulong> BroadcastScalarToVector256(ulong* source) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<byte> BroadcastVector128ToVector256(byte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<short> BroadcastVector128ToVector256(short* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<int> BroadcastVector128ToVector256(int* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> BroadcastVector128ToVector256(long* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<sbyte> BroadcastVector128ToVector256(sbyte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ushort> BroadcastVector128ToVector256(ushort* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<uint> BroadcastVector128ToVector256(uint* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ulong> BroadcastVector128ToVector256(ulong* address) { throw null; }
public static System.Runtime.Intrinsics.Vector256<byte> CompareEqual(System.Runtime.Intrinsics.Vector256<byte> left, System.Runtime.Intrinsics.Vector256<byte> right) { throw null; }
public static System.Runtime.Intrinsics.Vector256<short> CompareEqual(System.Runtime.Intrinsics.Vector256<short> left, System.Runtime.Intrinsics.Vector256<short> right) { throw null; }
public static System.Runtime.Intrinsics.Vector256<int> CompareEqual(System.Runtime.Intrinsics.Vector256<int> left, System.Runtime.Intrinsics.Vector256<int> right) { throw null; }
public static System.Runtime.Intrinsics.Vector256<sbyte> CompareGreaterThan(System.Runtime.Intrinsics.Vector256<sbyte> left, System.Runtime.Intrinsics.Vector256<sbyte> right) { throw null; }
public static int ConvertToInt32(System.Runtime.Intrinsics.Vector256<int> value) { throw null; }
public static uint ConvertToUInt32(System.Runtime.Intrinsics.Vector256<uint> value) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<short> ConvertToVector256Int16(byte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<short> ConvertToVector256Int16(byte* address) { throw null; }
public static System.Runtime.Intrinsics.Vector256<short> ConvertToVector256Int16(System.Runtime.Intrinsics.Vector128<byte> value) { throw null; }
public static System.Runtime.Intrinsics.Vector256<short> ConvertToVector256Int16(System.Runtime.Intrinsics.Vector128<sbyte> value) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<short> ConvertToVector256Int16(sbyte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<int> ConvertToVector256Int32(byte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<int> ConvertToVector256Int32(short* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<short> ConvertToVector256Int16(sbyte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<int> ConvertToVector256Int32(byte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<int> ConvertToVector256Int32(short* address) { throw null; }
public static System.Runtime.Intrinsics.Vector256<int> ConvertToVector256Int32(System.Runtime.Intrinsics.Vector128<byte> value) { throw null; }
public static System.Runtime.Intrinsics.Vector256<int> ConvertToVector256Int32(System.Runtime.Intrinsics.Vector128<short> value) { throw null; }
public static System.Runtime.Intrinsics.Vector256<int> ConvertToVector256Int32(System.Runtime.Intrinsics.Vector128<sbyte> value) { throw null; }
public static System.Runtime.Intrinsics.Vector256<int> ConvertToVector256Int32(System.Runtime.Intrinsics.Vector128<ushort> value) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<int> ConvertToVector256Int32(sbyte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<int> ConvertToVector256Int32(ushort* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(byte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(short* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(int* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<int> ConvertToVector256Int32(sbyte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<int> ConvertToVector256Int32(ushort* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(byte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(short* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(int* address) { throw null; }
public static System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(System.Runtime.Intrinsics.Vector128<byte> value) { throw null; }
public static System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(System.Runtime.Intrinsics.Vector128<short> value) { throw null; }
public static System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(System.Runtime.Intrinsics.Vector128<int> value) { throw null; }
public static System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(System.Runtime.Intrinsics.Vector128<sbyte> value) { throw null; }
public static System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(System.Runtime.Intrinsics.Vector128<ushort> value) { throw null; }
public static System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(System.Runtime.Intrinsics.Vector128<uint> value) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(sbyte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(ushort* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(uint* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(sbyte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(ushort* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> ConvertToVector256Int64(uint* address) { throw null; }
public static new System.Runtime.Intrinsics.Vector128<byte> ExtractVector128(System.Runtime.Intrinsics.Vector256<byte> value, byte index) { throw null; }
public static new System.Runtime.Intrinsics.Vector128<short> ExtractVector128(System.Runtime.Intrinsics.Vector256<short> value, byte index) { throw null; }
public static new System.Runtime.Intrinsics.Vector128<int> ExtractVector128(System.Runtime.Intrinsics.Vector256<int> value, byte index) { throw null; }
public static new System.Runtime.Intrinsics.Vector128<ushort> ExtractVector128(System.Runtime.Intrinsics.Vector256<ushort> value, byte index) { throw null; }
public static new System.Runtime.Intrinsics.Vector128<uint> ExtractVector128(System.Runtime.Intrinsics.Vector256<uint> value, byte index) { throw null; }
public static new System.Runtime.Intrinsics.Vector128<ulong> ExtractVector128(System.Runtime.Intrinsics.Vector256<ulong> value, byte index) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<double> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<double> source, double* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector128<double> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<double> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<double> source, double* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, System.Runtime.Intrinsics.Vector128<double> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<int> source, int* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector128<int> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<int> source, int* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, System.Runtime.Intrinsics.Vector128<int> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<int> source, int* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, System.Runtime.Intrinsics.Vector128<int> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<long> source, long* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector128<long> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<long> source, long* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, System.Runtime.Intrinsics.Vector128<long> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<float> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<float> source, float* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector128<float> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<float> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<float> source, float* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, System.Runtime.Intrinsics.Vector128<float> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<float> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<float> source, float* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, System.Runtime.Intrinsics.Vector128<float> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<uint> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<uint> source, uint* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector128<uint> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<uint> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<uint> source, uint* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, System.Runtime.Intrinsics.Vector128<uint> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<uint> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<uint> source, uint* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, System.Runtime.Intrinsics.Vector128<uint> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<ulong> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<ulong> source, ulong* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector128<ulong> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<ulong> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<ulong> source, ulong* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, System.Runtime.Intrinsics.Vector128<ulong> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<double> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<double> source, double* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector256<double> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<double> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<double> source, double* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, System.Runtime.Intrinsics.Vector256<double> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<int> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<int> source, int* baseAddress, System.Runtime.Intrinsics.Vector256<int> index, System.Runtime.Intrinsics.Vector256<int> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<long> source, long* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector256<long> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<long> source, long* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, System.Runtime.Intrinsics.Vector256<long> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<float> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<float> source, float* baseAddress, System.Runtime.Intrinsics.Vector256<int> index, System.Runtime.Intrinsics.Vector256<float> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<uint> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<uint> source, uint* baseAddress, System.Runtime.Intrinsics.Vector256<int> index, System.Runtime.Intrinsics.Vector256<uint> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ulong> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<ulong> source, ulong* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector256<ulong> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ulong> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<ulong> source, ulong* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, System.Runtime.Intrinsics.Vector256<ulong> mask, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<double> GatherVector128(double* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<double> GatherVector128(double* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> GatherVector128(int* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> GatherVector128(int* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> GatherVector128(int* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> GatherVector128(long* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> GatherVector128(long* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<float> GatherVector128(float* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<float> GatherVector128(float* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<float> GatherVector128(float* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<uint> GatherVector128(uint* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<uint> GatherVector128(uint* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<uint> GatherVector128(uint* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<ulong> GatherVector128(ulong* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<ulong> GatherVector128(ulong* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<double> GatherVector256(double* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<double> GatherVector256(double* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<int> GatherVector256(int* baseAddress, System.Runtime.Intrinsics.Vector256<int> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> GatherVector256(long* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> GatherVector256(long* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<float> GatherVector256(float* baseAddress, System.Runtime.Intrinsics.Vector256<int> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<uint> GatherVector256(uint* baseAddress, System.Runtime.Intrinsics.Vector256<int> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ulong> GatherVector256(ulong* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ulong> GatherVector256(ulong* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<double> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<double> source, double* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector128<double> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<double> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<double> source, double* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, System.Runtime.Intrinsics.Vector128<double> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<int> source, int* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector128<int> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<int> source, int* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, System.Runtime.Intrinsics.Vector128<int> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<int> source, int* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, System.Runtime.Intrinsics.Vector128<int> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<long> source, long* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector128<long> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<long> source, long* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, System.Runtime.Intrinsics.Vector128<long> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<float> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<float> source, float* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector128<float> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<float> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<float> source, float* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, System.Runtime.Intrinsics.Vector128<float> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<float> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<float> source, float* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, System.Runtime.Intrinsics.Vector128<float> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<uint> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<uint> source, uint* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector128<uint> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<uint> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<uint> source, uint* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, System.Runtime.Intrinsics.Vector128<uint> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<uint> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<uint> source, uint* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, System.Runtime.Intrinsics.Vector128<uint> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<ulong> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<ulong> source, ulong* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector128<ulong> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<ulong> GatherMaskVector128(System.Runtime.Intrinsics.Vector128<ulong> source, ulong* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, System.Runtime.Intrinsics.Vector128<ulong> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<double> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<double> source, double* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector256<double> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<double> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<double> source, double* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, System.Runtime.Intrinsics.Vector256<double> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<int> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<int> source, int* baseAddress, System.Runtime.Intrinsics.Vector256<int> index, System.Runtime.Intrinsics.Vector256<int> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<long> source, long* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector256<long> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<long> source, long* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, System.Runtime.Intrinsics.Vector256<long> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<float> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<float> source, float* baseAddress, System.Runtime.Intrinsics.Vector256<int> index, System.Runtime.Intrinsics.Vector256<float> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<uint> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<uint> source, uint* baseAddress, System.Runtime.Intrinsics.Vector256<int> index, System.Runtime.Intrinsics.Vector256<uint> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ulong> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<ulong> source, ulong* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, System.Runtime.Intrinsics.Vector256<ulong> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ulong> GatherMaskVector256(System.Runtime.Intrinsics.Vector256<ulong> source, ulong* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, System.Runtime.Intrinsics.Vector256<ulong> mask, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<double> GatherVector128(double* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<double> GatherVector128(double* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> GatherVector128(int* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> GatherVector128(int* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> GatherVector128(int* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> GatherVector128(long* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> GatherVector128(long* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<float> GatherVector128(float* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<float> GatherVector128(float* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<float> GatherVector128(float* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<uint> GatherVector128(uint* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<uint> GatherVector128(uint* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<uint> GatherVector128(uint* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<ulong> GatherVector128(ulong* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<ulong> GatherVector128(ulong* baseAddress, System.Runtime.Intrinsics.Vector128<long> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<double> GatherVector256(double* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<double> GatherVector256(double* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<int> GatherVector256(int* baseAddress, System.Runtime.Intrinsics.Vector256<int> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> GatherVector256(long* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> GatherVector256(long* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<float> GatherVector256(float* baseAddress, System.Runtime.Intrinsics.Vector256<int> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<uint> GatherVector256(uint* baseAddress, System.Runtime.Intrinsics.Vector256<int> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ulong> GatherVector256(ulong* baseAddress, System.Runtime.Intrinsics.Vector128<int> index, byte scale) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ulong> GatherVector256(ulong* baseAddress, System.Runtime.Intrinsics.Vector256<long> index, byte scale) { throw null; }
public static System.Runtime.Intrinsics.Vector256<short> HorizontalAdd(System.Runtime.Intrinsics.Vector256<short> left, System.Runtime.Intrinsics.Vector256<short> right) { throw null; }
public static System.Runtime.Intrinsics.Vector256<int> HorizontalAdd(System.Runtime.Intrinsics.Vector256<int> left, System.Runtime.Intrinsics.Vector256<int> right) { throw null; }
public static System.Runtime.Intrinsics.Vector256<short> HorizontalAddSaturate(System.Runtime.Intrinsics.Vector256<short> left, System.Runtime.Intrinsics.Vector256<short> right) { throw null; }
public static new System.Runtime.Intrinsics.Vector256<ushort> InsertVector128(System.Runtime.Intrinsics.Vector256<ushort> value, System.Runtime.Intrinsics.Vector128<ushort> data, byte index) { throw null; }
public static new System.Runtime.Intrinsics.Vector256<uint> InsertVector128(System.Runtime.Intrinsics.Vector256<uint> value, System.Runtime.Intrinsics.Vector128<uint> data, byte index) { throw null; }
public static new System.Runtime.Intrinsics.Vector256<ulong> InsertVector128(System.Runtime.Intrinsics.Vector256<ulong> value, System.Runtime.Intrinsics.Vector128<ulong> data, byte index) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<byte> LoadAlignedVector256NonTemporal(byte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<short> LoadAlignedVector256NonTemporal(short* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<int> LoadAlignedVector256NonTemporal(int* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> LoadAlignedVector256NonTemporal(long* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<sbyte> LoadAlignedVector256NonTemporal(sbyte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ushort> LoadAlignedVector256NonTemporal(ushort* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<uint> LoadAlignedVector256NonTemporal(uint* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ulong> LoadAlignedVector256NonTemporal(ulong* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> MaskLoad(int* address, System.Runtime.Intrinsics.Vector128<int> mask) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<int> MaskLoad(int* address, System.Runtime.Intrinsics.Vector256<int> mask) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> MaskLoad(long* address, System.Runtime.Intrinsics.Vector128<long> mask) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<long> MaskLoad(long* address, System.Runtime.Intrinsics.Vector256<long> mask) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<uint> MaskLoad(uint* address, System.Runtime.Intrinsics.Vector128<uint> mask) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<uint> MaskLoad(uint* address, System.Runtime.Intrinsics.Vector256<uint> mask) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<ulong> MaskLoad(ulong* address, System.Runtime.Intrinsics.Vector128<ulong> mask) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector256<ulong> MaskLoad(ulong* address, System.Runtime.Intrinsics.Vector256<ulong> mask) { throw null; }
- public unsafe static void MaskStore(int* address, System.Runtime.Intrinsics.Vector128<int> mask, System.Runtime.Intrinsics.Vector128<int> source) { }
- public unsafe static void MaskStore(int* address, System.Runtime.Intrinsics.Vector256<int> mask, System.Runtime.Intrinsics.Vector256<int> source) { }
- public unsafe static void MaskStore(long* address, System.Runtime.Intrinsics.Vector128<long> mask, System.Runtime.Intrinsics.Vector128<long> source) { }
- public unsafe static void MaskStore(long* address, System.Runtime.Intrinsics.Vector256<long> mask, System.Runtime.Intrinsics.Vector256<long> source) { }
- public unsafe static void MaskStore(uint* address, System.Runtime.Intrinsics.Vector128<uint> mask, System.Runtime.Intrinsics.Vector128<uint> source) { }
- public unsafe static void MaskStore(uint* address, System.Runtime.Intrinsics.Vector256<uint> mask, System.Runtime.Intrinsics.Vector256<uint> source) { }
- public unsafe static void MaskStore(ulong* address, System.Runtime.Intrinsics.Vector128<ulong> mask, System.Runtime.Intrinsics.Vector128<ulong> source) { }
- public unsafe static void MaskStore(ulong* address, System.Runtime.Intrinsics.Vector256<ulong> mask, System.Runtime.Intrinsics.Vector256<ulong> source) { }
+ public static unsafe System.Runtime.Intrinsics.Vector256<byte> LoadAlignedVector256NonTemporal(byte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<short> LoadAlignedVector256NonTemporal(short* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<int> LoadAlignedVector256NonTemporal(int* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> LoadAlignedVector256NonTemporal(long* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<sbyte> LoadAlignedVector256NonTemporal(sbyte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ushort> LoadAlignedVector256NonTemporal(ushort* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<uint> LoadAlignedVector256NonTemporal(uint* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ulong> LoadAlignedVector256NonTemporal(ulong* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> MaskLoad(int* address, System.Runtime.Intrinsics.Vector128<int> mask) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<int> MaskLoad(int* address, System.Runtime.Intrinsics.Vector256<int> mask) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> MaskLoad(long* address, System.Runtime.Intrinsics.Vector128<long> mask) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<long> MaskLoad(long* address, System.Runtime.Intrinsics.Vector256<long> mask) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<uint> MaskLoad(uint* address, System.Runtime.Intrinsics.Vector128<uint> mask) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<uint> MaskLoad(uint* address, System.Runtime.Intrinsics.Vector256<uint> mask) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<ulong> MaskLoad(ulong* address, System.Runtime.Intrinsics.Vector128<ulong> mask) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector256<ulong> MaskLoad(ulong* address, System.Runtime.Intrinsics.Vector256<ulong> mask) { throw null; }
+ public static unsafe void MaskStore(int* address, System.Runtime.Intrinsics.Vector128<int> mask, System.Runtime.Intrinsics.Vector128<int> source) { }
+ public static unsafe void MaskStore(int* address, System.Runtime.Intrinsics.Vector256<int> mask, System.Runtime.Intrinsics.Vector256<int> source) { }
+ public static unsafe void MaskStore(long* address, System.Runtime.Intrinsics.Vector128<long> mask, System.Runtime.Intrinsics.Vector128<long> source) { }
+ public static unsafe void MaskStore(long* address, System.Runtime.Intrinsics.Vector256<long> mask, System.Runtime.Intrinsics.Vector256<long> source) { }
+ public static unsafe void MaskStore(uint* address, System.Runtime.Intrinsics.Vector128<uint> mask, System.Runtime.Intrinsics.Vector128<uint> source) { }
+ public static unsafe void MaskStore(uint* address, System.Runtime.Intrinsics.Vector256<uint> mask, System.Runtime.Intrinsics.Vector256<uint> source) { }
+ public static unsafe void MaskStore(ulong* address, System.Runtime.Intrinsics.Vector128<ulong> mask, System.Runtime.Intrinsics.Vector128<ulong> source) { }
+ public static unsafe void MaskStore(ulong* address, System.Runtime.Intrinsics.Vector256<ulong> mask, System.Runtime.Intrinsics.Vector256<ulong> source) { }
public static System.Runtime.Intrinsics.Vector256<byte> Max(System.Runtime.Intrinsics.Vector256<byte> left, System.Runtime.Intrinsics.Vector256<byte> right) { throw null; }
public static System.Runtime.Intrinsics.Vector256<short> Max(System.Runtime.Intrinsics.Vector256<short> left, System.Runtime.Intrinsics.Vector256<short> right) { throw null; }
public static System.Runtime.Intrinsics.Vector256<int> Max(System.Runtime.Intrinsics.Vector256<int> left, System.Runtime.Intrinsics.Vector256<int> right) { throw null; }
internal Bmi2() { }
public static bool IsSupported { get { throw null; } }
public static uint MultiplyNoFlags(uint left, uint right) { throw null; }
- public unsafe static uint MultiplyNoFlags(uint left, uint right, uint* low) { throw null; }
+ public static unsafe uint MultiplyNoFlags(uint left, uint right, uint* low) { throw null; }
public static uint ParallelBitDeposit(uint value, uint mask) { throw null; }
public static uint ParallelBitExtract(uint value, uint mask) { throw null; }
public static uint ZeroHighBits(uint value, uint index) { throw null; }
internal X64() { }
public static bool IsSupported { get { throw null; } }
public static ulong MultiplyNoFlags(ulong left, ulong right) { throw null; }
- public unsafe static ulong MultiplyNoFlags(ulong left, ulong right, ulong* low) { throw null; }
+ public static unsafe ulong MultiplyNoFlags(ulong left, ulong right, ulong* low) { throw null; }
public static ulong ParallelBitDeposit(ulong value, ulong mask) { throw null; }
public static ulong ParallelBitExtract(ulong value, ulong mask) { throw null; }
public static ulong ZeroHighBits(ulong value, ulong index) { throw null; }
public static int ConvertToInt32WithTruncation(System.Runtime.Intrinsics.Vector128<float> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> Divide(System.Runtime.Intrinsics.Vector128<float> left, System.Runtime.Intrinsics.Vector128<float> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> DivideScalar(System.Runtime.Intrinsics.Vector128<float> left, System.Runtime.Intrinsics.Vector128<float> right) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<float> LoadAlignedVector128(float* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<float> LoadHigh(System.Runtime.Intrinsics.Vector128<float> lower, float* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<float> LoadLow(System.Runtime.Intrinsics.Vector128<float> upper, float* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<float> LoadScalarVector128(float* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<float> LoadVector128(float* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<float> LoadAlignedVector128(float* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<float> LoadHigh(System.Runtime.Intrinsics.Vector128<float> lower, float* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<float> LoadLow(System.Runtime.Intrinsics.Vector128<float> upper, float* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<float> LoadScalarVector128(float* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<float> LoadVector128(float* address) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> Max(System.Runtime.Intrinsics.Vector128<float> left, System.Runtime.Intrinsics.Vector128<float> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> MaxScalar(System.Runtime.Intrinsics.Vector128<float> left, System.Runtime.Intrinsics.Vector128<float> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> Min(System.Runtime.Intrinsics.Vector128<float> left, System.Runtime.Intrinsics.Vector128<float> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> Multiply(System.Runtime.Intrinsics.Vector128<float> left, System.Runtime.Intrinsics.Vector128<float> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> MultiplyScalar(System.Runtime.Intrinsics.Vector128<float> left, System.Runtime.Intrinsics.Vector128<float> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> Or(System.Runtime.Intrinsics.Vector128<float> left, System.Runtime.Intrinsics.Vector128<float> right) { throw null; }
- public unsafe static void Prefetch0(void* address) { }
- public unsafe static void Prefetch1(void* address) { }
- public unsafe static void Prefetch2(void* address) { }
- public unsafe static void PrefetchNonTemporal(void* address) { }
+ public static unsafe void Prefetch0(void* address) { }
+ public static unsafe void Prefetch1(void* address) { }
+ public static unsafe void Prefetch2(void* address) { }
+ public static unsafe void PrefetchNonTemporal(void* address) { }
public static System.Runtime.Intrinsics.Vector128<float> Reciprocal(System.Runtime.Intrinsics.Vector128<float> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> ReciprocalScalar(System.Runtime.Intrinsics.Vector128<float> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> ReciprocalScalar(System.Runtime.Intrinsics.Vector128<float> upper, System.Runtime.Intrinsics.Vector128<float> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> Sqrt(System.Runtime.Intrinsics.Vector128<float> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> SqrtScalar(System.Runtime.Intrinsics.Vector128<float> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> SqrtScalar(System.Runtime.Intrinsics.Vector128<float> upper, System.Runtime.Intrinsics.Vector128<float> value) { throw null; }
- public unsafe static void Store(float* address, System.Runtime.Intrinsics.Vector128<float> source) { }
- public unsafe static void StoreAligned(float* address, System.Runtime.Intrinsics.Vector128<float> source) { }
- public unsafe static void StoreAlignedNonTemporal(float* address, System.Runtime.Intrinsics.Vector128<float> source) { }
+ public static unsafe void Store(float* address, System.Runtime.Intrinsics.Vector128<float> source) { }
+ public static unsafe void StoreAligned(float* address, System.Runtime.Intrinsics.Vector128<float> source) { }
+ public static unsafe void StoreAlignedNonTemporal(float* address, System.Runtime.Intrinsics.Vector128<float> source) { }
public static void StoreFence() { }
- public unsafe static void StoreHigh(float* address, System.Runtime.Intrinsics.Vector128<float> source) { }
- public unsafe static void StoreLow(float* address, System.Runtime.Intrinsics.Vector128<float> source) { }
- public unsafe static void StoreScalar(float* address, System.Runtime.Intrinsics.Vector128<float> source) { }
+ public static unsafe void StoreHigh(float* address, System.Runtime.Intrinsics.Vector128<float> source) { }
+ public static unsafe void StoreLow(float* address, System.Runtime.Intrinsics.Vector128<float> source) { }
+ public static unsafe void StoreScalar(float* address, System.Runtime.Intrinsics.Vector128<float> source) { }
public static System.Runtime.Intrinsics.Vector128<float> Subtract(System.Runtime.Intrinsics.Vector128<float> left, System.Runtime.Intrinsics.Vector128<float> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> SubtractScalar(System.Runtime.Intrinsics.Vector128<float> left, System.Runtime.Intrinsics.Vector128<float> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> UnpackHigh(System.Runtime.Intrinsics.Vector128<float> left, System.Runtime.Intrinsics.Vector128<float> right) { throw null; }
public static ushort Extract(System.Runtime.Intrinsics.Vector128<ushort> value, byte index) { throw null; }
public static System.Runtime.Intrinsics.Vector128<short> Insert(System.Runtime.Intrinsics.Vector128<short> value, short data, byte index) { throw null; }
public static System.Runtime.Intrinsics.Vector128<ushort> Insert(System.Runtime.Intrinsics.Vector128<ushort> value, ushort data, byte index) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<byte> LoadAlignedVector128(byte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<double> LoadAlignedVector128(double* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<short> LoadAlignedVector128(short* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> LoadAlignedVector128(int* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> LoadAlignedVector128(long* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<sbyte> LoadAlignedVector128(sbyte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<ushort> LoadAlignedVector128(ushort* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<uint> LoadAlignedVector128(uint* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<ulong> LoadAlignedVector128(ulong* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<byte> LoadAlignedVector128(byte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<double> LoadAlignedVector128(double* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<short> LoadAlignedVector128(short* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> LoadAlignedVector128(int* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> LoadAlignedVector128(long* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<sbyte> LoadAlignedVector128(sbyte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<ushort> LoadAlignedVector128(ushort* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<uint> LoadAlignedVector128(uint* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<ulong> LoadAlignedVector128(ulong* address) { throw null; }
public static void LoadFence() { }
- public unsafe static System.Runtime.Intrinsics.Vector128<double> LoadHigh(System.Runtime.Intrinsics.Vector128<double> lower, double* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<double> LoadLow(System.Runtime.Intrinsics.Vector128<double> upper, double* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<double> LoadScalarVector128(double* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> LoadScalarVector128(int* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> LoadScalarVector128(long* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<uint> LoadScalarVector128(uint* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<ulong> LoadScalarVector128(ulong* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<byte> LoadVector128(byte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<double> LoadVector128(double* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<short> LoadVector128(short* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> LoadVector128(int* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> LoadVector128(long* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<sbyte> LoadVector128(sbyte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<ushort> LoadVector128(ushort* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<uint> LoadVector128(uint* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<ulong> LoadVector128(ulong* address) { throw null; }
- public unsafe static void MaskMove(System.Runtime.Intrinsics.Vector128<byte> source, System.Runtime.Intrinsics.Vector128<byte> mask, byte* address) { }
- public unsafe static void MaskMove(System.Runtime.Intrinsics.Vector128<sbyte> source, System.Runtime.Intrinsics.Vector128<sbyte> mask, sbyte* address) { }
+ public static unsafe System.Runtime.Intrinsics.Vector128<double> LoadHigh(System.Runtime.Intrinsics.Vector128<double> lower, double* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<double> LoadLow(System.Runtime.Intrinsics.Vector128<double> upper, double* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<double> LoadScalarVector128(double* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> LoadScalarVector128(int* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> LoadScalarVector128(long* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<uint> LoadScalarVector128(uint* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<ulong> LoadScalarVector128(ulong* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<byte> LoadVector128(byte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<double> LoadVector128(double* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<short> LoadVector128(short* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> LoadVector128(int* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> LoadVector128(long* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<sbyte> LoadVector128(sbyte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<ushort> LoadVector128(ushort* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<uint> LoadVector128(uint* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<ulong> LoadVector128(ulong* address) { throw null; }
+ public static unsafe void MaskMove(System.Runtime.Intrinsics.Vector128<byte> source, System.Runtime.Intrinsics.Vector128<byte> mask, byte* address) { }
+ public static unsafe void MaskMove(System.Runtime.Intrinsics.Vector128<sbyte> source, System.Runtime.Intrinsics.Vector128<sbyte> mask, sbyte* address) { }
public static System.Runtime.Intrinsics.Vector128<byte> Max(System.Runtime.Intrinsics.Vector128<byte> left, System.Runtime.Intrinsics.Vector128<byte> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<double> Max(System.Runtime.Intrinsics.Vector128<double> left, System.Runtime.Intrinsics.Vector128<double> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<short> Max(System.Runtime.Intrinsics.Vector128<short> left, System.Runtime.Intrinsics.Vector128<short> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<double> Sqrt(System.Runtime.Intrinsics.Vector128<double> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<double> SqrtScalar(System.Runtime.Intrinsics.Vector128<double> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<double> SqrtScalar(System.Runtime.Intrinsics.Vector128<double> upper, System.Runtime.Intrinsics.Vector128<double> value) { throw null; }
- public unsafe static void Store(byte* address, System.Runtime.Intrinsics.Vector128<byte> source) { }
- public unsafe static void Store(double* address, System.Runtime.Intrinsics.Vector128<double> source) { }
- public unsafe static void Store(short* address, System.Runtime.Intrinsics.Vector128<short> source) { }
- public unsafe static void Store(int* address, System.Runtime.Intrinsics.Vector128<int> source) { }
- public unsafe static void Store(long* address, System.Runtime.Intrinsics.Vector128<long> source) { }
- public unsafe static void Store(sbyte* address, System.Runtime.Intrinsics.Vector128<sbyte> source) { }
- public unsafe static void Store(ushort* address, System.Runtime.Intrinsics.Vector128<ushort> source) { }
- public unsafe static void Store(uint* address, System.Runtime.Intrinsics.Vector128<uint> source) { }
- public unsafe static void Store(ulong* address, System.Runtime.Intrinsics.Vector128<ulong> source) { }
- public unsafe static void StoreAligned(byte* address, System.Runtime.Intrinsics.Vector128<byte> source) { }
- public unsafe static void StoreAligned(double* address, System.Runtime.Intrinsics.Vector128<double> source) { }
- public unsafe static void StoreAligned(short* address, System.Runtime.Intrinsics.Vector128<short> source) { }
- public unsafe static void StoreAligned(int* address, System.Runtime.Intrinsics.Vector128<int> source) { }
- public unsafe static void StoreAligned(long* address, System.Runtime.Intrinsics.Vector128<long> source) { }
- public unsafe static void StoreAligned(sbyte* address, System.Runtime.Intrinsics.Vector128<sbyte> source) { }
- public unsafe static void StoreAligned(ushort* address, System.Runtime.Intrinsics.Vector128<ushort> source) { }
- public unsafe static void StoreAligned(uint* address, System.Runtime.Intrinsics.Vector128<uint> source) { }
- public unsafe static void StoreAligned(ulong* address, System.Runtime.Intrinsics.Vector128<ulong> source) { }
- public unsafe static void StoreAlignedNonTemporal(byte* address, System.Runtime.Intrinsics.Vector128<byte> source) { }
- public unsafe static void StoreAlignedNonTemporal(double* address, System.Runtime.Intrinsics.Vector128<double> source) { }
- public unsafe static void StoreAlignedNonTemporal(short* address, System.Runtime.Intrinsics.Vector128<short> source) { }
- public unsafe static void StoreAlignedNonTemporal(int* address, System.Runtime.Intrinsics.Vector128<int> source) { }
- public unsafe static void StoreAlignedNonTemporal(long* address, System.Runtime.Intrinsics.Vector128<long> source) { }
- public unsafe static void StoreAlignedNonTemporal(sbyte* address, System.Runtime.Intrinsics.Vector128<sbyte> source) { }
- public unsafe static void StoreAlignedNonTemporal(ushort* address, System.Runtime.Intrinsics.Vector128<ushort> source) { }
- public unsafe static void StoreAlignedNonTemporal(uint* address, System.Runtime.Intrinsics.Vector128<uint> source) { }
- public unsafe static void StoreAlignedNonTemporal(ulong* address, System.Runtime.Intrinsics.Vector128<ulong> source) { }
- public unsafe static void StoreHigh(double* address, System.Runtime.Intrinsics.Vector128<double> source) { }
- public unsafe static void StoreLow(double* address, System.Runtime.Intrinsics.Vector128<double> source) { }
- public unsafe static void StoreNonTemporal(int* address, int value) { }
- public unsafe static void StoreNonTemporal(uint* address, uint value) { }
- public unsafe static void StoreScalar(double* address, System.Runtime.Intrinsics.Vector128<double> source) { }
- public unsafe static void StoreScalar(long* address, System.Runtime.Intrinsics.Vector128<long> source) { }
- public unsafe static void StoreScalar(ulong* address, System.Runtime.Intrinsics.Vector128<ulong> source) { }
+ public static unsafe void Store(byte* address, System.Runtime.Intrinsics.Vector128<byte> source) { }
+ public static unsafe void Store(double* address, System.Runtime.Intrinsics.Vector128<double> source) { }
+ public static unsafe void Store(short* address, System.Runtime.Intrinsics.Vector128<short> source) { }
+ public static unsafe void Store(int* address, System.Runtime.Intrinsics.Vector128<int> source) { }
+ public static unsafe void Store(long* address, System.Runtime.Intrinsics.Vector128<long> source) { }
+ public static unsafe void Store(sbyte* address, System.Runtime.Intrinsics.Vector128<sbyte> source) { }
+ public static unsafe void Store(ushort* address, System.Runtime.Intrinsics.Vector128<ushort> source) { }
+ public static unsafe void Store(uint* address, System.Runtime.Intrinsics.Vector128<uint> source) { }
+ public static unsafe void Store(ulong* address, System.Runtime.Intrinsics.Vector128<ulong> source) { }
+ public static unsafe void StoreAligned(byte* address, System.Runtime.Intrinsics.Vector128<byte> source) { }
+ public static unsafe void StoreAligned(double* address, System.Runtime.Intrinsics.Vector128<double> source) { }
+ public static unsafe void StoreAligned(short* address, System.Runtime.Intrinsics.Vector128<short> source) { }
+ public static unsafe void StoreAligned(int* address, System.Runtime.Intrinsics.Vector128<int> source) { }
+ public static unsafe void StoreAligned(long* address, System.Runtime.Intrinsics.Vector128<long> source) { }
+ public static unsafe void StoreAligned(sbyte* address, System.Runtime.Intrinsics.Vector128<sbyte> source) { }
+ public static unsafe void StoreAligned(ushort* address, System.Runtime.Intrinsics.Vector128<ushort> source) { }
+ public static unsafe void StoreAligned(uint* address, System.Runtime.Intrinsics.Vector128<uint> source) { }
+ public static unsafe void StoreAligned(ulong* address, System.Runtime.Intrinsics.Vector128<ulong> source) { }
+ public static unsafe void StoreAlignedNonTemporal(byte* address, System.Runtime.Intrinsics.Vector128<byte> source) { }
+ public static unsafe void StoreAlignedNonTemporal(double* address, System.Runtime.Intrinsics.Vector128<double> source) { }
+ public static unsafe void StoreAlignedNonTemporal(short* address, System.Runtime.Intrinsics.Vector128<short> source) { }
+ public static unsafe void StoreAlignedNonTemporal(int* address, System.Runtime.Intrinsics.Vector128<int> source) { }
+ public static unsafe void StoreAlignedNonTemporal(long* address, System.Runtime.Intrinsics.Vector128<long> source) { }
+ public static unsafe void StoreAlignedNonTemporal(sbyte* address, System.Runtime.Intrinsics.Vector128<sbyte> source) { }
+ public static unsafe void StoreAlignedNonTemporal(ushort* address, System.Runtime.Intrinsics.Vector128<ushort> source) { }
+ public static unsafe void StoreAlignedNonTemporal(uint* address, System.Runtime.Intrinsics.Vector128<uint> source) { }
+ public static unsafe void StoreAlignedNonTemporal(ulong* address, System.Runtime.Intrinsics.Vector128<ulong> source) { }
+ public static unsafe void StoreHigh(double* address, System.Runtime.Intrinsics.Vector128<double> source) { }
+ public static unsafe void StoreLow(double* address, System.Runtime.Intrinsics.Vector128<double> source) { }
+ public static unsafe void StoreNonTemporal(int* address, int value) { }
+ public static unsafe void StoreNonTemporal(uint* address, uint value) { }
+ public static unsafe void StoreScalar(double* address, System.Runtime.Intrinsics.Vector128<double> source) { }
+ public static unsafe void StoreScalar(long* address, System.Runtime.Intrinsics.Vector128<long> source) { }
+ public static unsafe void StoreScalar(ulong* address, System.Runtime.Intrinsics.Vector128<ulong> source) { }
public static System.Runtime.Intrinsics.Vector128<byte> Subtract(System.Runtime.Intrinsics.Vector128<byte> left, System.Runtime.Intrinsics.Vector128<byte> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<double> Subtract(System.Runtime.Intrinsics.Vector128<double> left, System.Runtime.Intrinsics.Vector128<double> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<short> Subtract(System.Runtime.Intrinsics.Vector128<short> left, System.Runtime.Intrinsics.Vector128<short> right) { throw null; }
public static long ConvertToInt64(System.Runtime.Intrinsics.Vector128<long> value) { throw null; }
public static long ConvertToInt64WithTruncation(System.Runtime.Intrinsics.Vector128<double> value) { throw null; }
public static ulong ConvertToUInt64(System.Runtime.Intrinsics.Vector128<ulong> value) { throw null; }
- public unsafe static void StoreNonTemporal(long* address, long value) { }
- public unsafe static void StoreNonTemporal(ulong* address, ulong value) { }
+ public static unsafe void StoreNonTemporal(long* address, long value) { }
+ public static unsafe void StoreNonTemporal(ulong* address, ulong value) { }
}
}
[System.CLSCompliantAttribute(false)]
public static System.Runtime.Intrinsics.Vector128<float> HorizontalAdd(System.Runtime.Intrinsics.Vector128<float> left, System.Runtime.Intrinsics.Vector128<float> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<double> HorizontalSubtract(System.Runtime.Intrinsics.Vector128<double> left, System.Runtime.Intrinsics.Vector128<double> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> HorizontalSubtract(System.Runtime.Intrinsics.Vector128<float> left, System.Runtime.Intrinsics.Vector128<float> right) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<double> LoadAndDuplicateToVector128(double* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<byte> LoadDquVector128(byte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<short> LoadDquVector128(short* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> LoadDquVector128(int* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> LoadDquVector128(long* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<sbyte> LoadDquVector128(sbyte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<ushort> LoadDquVector128(ushort* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<uint> LoadDquVector128(uint* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<ulong> LoadDquVector128(ulong* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<double> LoadAndDuplicateToVector128(double* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<byte> LoadDquVector128(byte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<short> LoadDquVector128(short* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> LoadDquVector128(int* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> LoadDquVector128(long* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<sbyte> LoadDquVector128(sbyte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<ushort> LoadDquVector128(ushort* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<uint> LoadDquVector128(uint* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<ulong> LoadDquVector128(ulong* address) { throw null; }
public static System.Runtime.Intrinsics.Vector128<double> MoveAndDuplicate(System.Runtime.Intrinsics.Vector128<double> source) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> MoveHighAndDuplicate(System.Runtime.Intrinsics.Vector128<float> source) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> MoveLowAndDuplicate(System.Runtime.Intrinsics.Vector128<float> source) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> CeilingScalar(System.Runtime.Intrinsics.Vector128<float> upper, System.Runtime.Intrinsics.Vector128<float> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<long> CompareEqual(System.Runtime.Intrinsics.Vector128<long> left, System.Runtime.Intrinsics.Vector128<long> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<ulong> CompareEqual(System.Runtime.Intrinsics.Vector128<ulong> left, System.Runtime.Intrinsics.Vector128<ulong> right) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<short> ConvertToVector128Int16(byte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<short> ConvertToVector128Int16(byte* address) { throw null; }
public static System.Runtime.Intrinsics.Vector128<short> ConvertToVector128Int16(System.Runtime.Intrinsics.Vector128<byte> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<short> ConvertToVector128Int16(System.Runtime.Intrinsics.Vector128<sbyte> value) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<short> ConvertToVector128Int16(sbyte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> ConvertToVector128Int32(byte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> ConvertToVector128Int32(short* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<short> ConvertToVector128Int16(sbyte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> ConvertToVector128Int32(byte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> ConvertToVector128Int32(short* address) { throw null; }
public static System.Runtime.Intrinsics.Vector128<int> ConvertToVector128Int32(System.Runtime.Intrinsics.Vector128<byte> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<int> ConvertToVector128Int32(System.Runtime.Intrinsics.Vector128<short> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<int> ConvertToVector128Int32(System.Runtime.Intrinsics.Vector128<sbyte> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<int> ConvertToVector128Int32(System.Runtime.Intrinsics.Vector128<ushort> value) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> ConvertToVector128Int32(sbyte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> ConvertToVector128Int32(ushort* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(byte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(short* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(int* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> ConvertToVector128Int32(sbyte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> ConvertToVector128Int32(ushort* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(byte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(short* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(int* address) { throw null; }
public static System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(System.Runtime.Intrinsics.Vector128<byte> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(System.Runtime.Intrinsics.Vector128<short> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(System.Runtime.Intrinsics.Vector128<int> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(System.Runtime.Intrinsics.Vector128<sbyte> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(System.Runtime.Intrinsics.Vector128<ushort> value) { throw null; }
public static System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(System.Runtime.Intrinsics.Vector128<uint> value) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(sbyte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(ushort* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(uint* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(sbyte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(ushort* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> ConvertToVector128Int64(uint* address) { throw null; }
public static System.Runtime.Intrinsics.Vector128<double> DotProduct(System.Runtime.Intrinsics.Vector128<double> left, System.Runtime.Intrinsics.Vector128<double> right, byte control) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> DotProduct(System.Runtime.Intrinsics.Vector128<float> left, System.Runtime.Intrinsics.Vector128<float> right, byte control) { throw null; }
public static byte Extract(System.Runtime.Intrinsics.Vector128<byte> value, byte index) { throw null; }
public static System.Runtime.Intrinsics.Vector128<sbyte> Insert(System.Runtime.Intrinsics.Vector128<sbyte> value, sbyte data, byte index) { throw null; }
public static System.Runtime.Intrinsics.Vector128<float> Insert(System.Runtime.Intrinsics.Vector128<float> value, System.Runtime.Intrinsics.Vector128<float> data, byte index) { throw null; }
public static System.Runtime.Intrinsics.Vector128<uint> Insert(System.Runtime.Intrinsics.Vector128<uint> value, uint data, byte index) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<byte> LoadAlignedVector128NonTemporal(byte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<short> LoadAlignedVector128NonTemporal(short* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<int> LoadAlignedVector128NonTemporal(int* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<long> LoadAlignedVector128NonTemporal(long* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<sbyte> LoadAlignedVector128NonTemporal(sbyte* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<ushort> LoadAlignedVector128NonTemporal(ushort* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<uint> LoadAlignedVector128NonTemporal(uint* address) { throw null; }
- public unsafe static System.Runtime.Intrinsics.Vector128<ulong> LoadAlignedVector128NonTemporal(ulong* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<byte> LoadAlignedVector128NonTemporal(byte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<short> LoadAlignedVector128NonTemporal(short* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<int> LoadAlignedVector128NonTemporal(int* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<long> LoadAlignedVector128NonTemporal(long* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<sbyte> LoadAlignedVector128NonTemporal(sbyte* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<ushort> LoadAlignedVector128NonTemporal(ushort* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<uint> LoadAlignedVector128NonTemporal(uint* address) { throw null; }
+ public static unsafe System.Runtime.Intrinsics.Vector128<ulong> LoadAlignedVector128NonTemporal(ulong* address) { throw null; }
public static System.Runtime.Intrinsics.Vector128<int> Max(System.Runtime.Intrinsics.Vector128<int> left, System.Runtime.Intrinsics.Vector128<int> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<sbyte> Max(System.Runtime.Intrinsics.Vector128<sbyte> left, System.Runtime.Intrinsics.Vector128<sbyte> right) { throw null; }
public static System.Runtime.Intrinsics.Vector128<ushort> Max(System.Runtime.Intrinsics.Vector128<ushort> left, System.Runtime.Intrinsics.Vector128<ushort> right) { throw null; }
public static partial class AssemblyExtensions
{
[System.CLSCompliantAttribute(false)]
- public unsafe static bool TryGetRawMetadata(this System.Reflection.Assembly assembly, out byte* blob, out int length) { throw null; }
+ public static unsafe bool TryGetRawMetadata(this System.Reflection.Assembly assembly, out byte* blob, out int length) { throw null; }
}
}
namespace System.Runtime.Loader
{
public class TestClass
{
- public static Assembly LoadFromDefaultContext(string assemblyNameStr)
- {
- var assemblyName = new AssemblyName(assemblyNameStr);
+ public static Assembly LoadFromDefaultContext(string assemblyNameStr)
+ {
+ var assemblyName = new AssemblyName(assemblyNameStr);
return Assembly.Load(assemblyName);
- }
+ }
public static Assembly GetRefEmitAssembly(string assemblyNameStr, AssemblyBuilderAccess builderType)
{
{
StackCalc sc1 = new StackCalc(opstring1);
while (sc1.DoNextOperation())
- {
+ {
//Run the full calculation
sc1.DoNextOperation();
}
StackCalc sc2 = new StackCalc(opstring2);
while (sc2.DoNextOperation())
- {
+ {
//Run the full calculation
sc2.DoNextOperation();
}
StackCalc sc2 = new StackCalc(opstring2);
while (sc2.DoNextOperation())
- {
+ {
//Run the full calculation
sc2.DoNextOperation();
}
{
StackCalc sc1 = new StackCalc(opstring1);
while (sc1.DoNextOperation())
- {
+ {
//Run the full calculation
sc1.DoNextOperation();
}
StackCalc sc2 = new StackCalc(opstring2);
while (sc2.DoNextOperation())
- {
+ {
//Run the full calculation
sc2.DoNextOperation();
}
StackCalc sc2 = new StackCalc(opstring2);
while (sc2.DoNextOperation())
- {
+ {
//Run the full calculation
sc2.DoNextOperation();
}
{
public partial class parseTest
{
- private readonly static int s_samples = 10;
- private readonly static Random s_random = new Random(100);
+ private static readonly int s_samples = 10;
+ private static readonly Random s_random = new Random(100);
// Invariant culture is commonly used for (de-)serialization and similar to en-US
// Ukrainian (Ukraine) added to catch regressions (issue #1642)
StackCalc sc2 = new StackCalc(opstring2);
while (sc2.DoNextOperation())
- {
+ {
//Run the full calculation
sc2.DoNextOperation();
}
{
StackCalc sc1 = new StackCalc(opstring1);
while (sc1.DoNextOperation())
- {
+ {
//Run the full calculation
sc1.DoNextOperation();
}
TestObjectInObjectContainerWithSimpleResolver(new SerializationTestTypes.EmptyDCType(), @"<ObjectContainer xmlns=""http://schemas.datacontract.org/2004/07/SerializationTestTypes"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance""><_data i:type=""a:SerializationTestTypes.EmptyDCType***"" xmlns:a=""http://schemas.datacontract.org/2004/07/SerializationTestTypes.EmptyDCType***""/><_data2 i:type=""a:SerializationTestTypes.EmptyDCType***"" xmlns:a=""http://schemas.datacontract.org/2004/07/SerializationTestTypes.EmptyDCType***""/></ObjectContainer>");
TestObjectInObjectContainerWithSimpleResolver(new SerializationTestTypes.ObjectContainer(true), @"<ObjectContainer xmlns=""http://schemas.datacontract.org/2004/07/SerializationTestTypes"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance""><_data i:type=""a:SerializationTestTypes.ObjectContainer***"" xmlns:a=""http://schemas.datacontract.org/2004/07/SerializationTestTypes.ObjectContainer***""><_data i:type=""b:boolean"" xmlns:b=""http://www.w3.org/2001/XMLSchema"">true</_data><_data2 i:type=""b:boolean"" xmlns:b=""http://www.w3.org/2001/XMLSchema"">true</_data2></_data><_data2 i:type=""a:SerializationTestTypes.ObjectContainer***"" xmlns:a=""http://schemas.datacontract.org/2004/07/SerializationTestTypes.ObjectContainer***""><_data i:type=""b:boolean"" xmlns:b=""http://www.w3.org/2001/XMLSchema"">true</_data><_data2 i:type=""b:boolean"" xmlns:b=""http://www.w3.org/2001/XMLSchema"">true</_data2></_data2></ObjectContainer>");
-
+
TestObjectInObjectContainerWithSimpleResolver(new SerializationTestTypes.POCOObjectContainer(true), @"<ObjectContainer xmlns=""http://schemas.datacontract.org/2004/07/SerializationTestTypes"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance""><_data i:type=""a:SerializationTestTypes.POCOObjectContainer***"" xmlns:a=""http://schemas.datacontract.org/2004/07/SerializationTestTypes.POCOObjectContainer***""><Data i:type=""b:boolean"" xmlns:b=""http://www.w3.org/2001/XMLSchema"">true</Data></_data><_data2 i:type=""a:SerializationTestTypes.POCOObjectContainer***"" xmlns:a=""http://schemas.datacontract.org/2004/07/SerializationTestTypes.POCOObjectContainer***""><Data i:type=""b:boolean"" xmlns:b=""http://www.w3.org/2001/XMLSchema"">true</Data></_data2></ObjectContainer>");
TestObjectInObjectContainerWithSimpleResolver(new SerializationTestTypes.CircularLink(true), @"<ObjectContainer xmlns=""http://schemas.datacontract.org/2004/07/SerializationTestTypes"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance""><_data z:Id=""i1"" i:type=""a:SerializationTestTypes.CircularLink***"" xmlns:z=""http://schemas.microsoft.com/2003/10/Serialization/"" xmlns:a=""http://schemas.datacontract.org/2004/07/SerializationTestTypes.CircularLink***""><Link z:Id=""i2""><Link z:Id=""i3""><Link z:Ref=""i1""/><RandomHangingLink i:nil=""true""/></Link><RandomHangingLink i:nil=""true""/></Link><RandomHangingLink z:Id=""i4""><Link z:Id=""i5""><Link z:Id=""i6"" i:type=""b:SerializationTestTypes.CircularLinkDerived***"" xmlns:b=""http://schemas.datacontract.org/2004/07/SerializationTestTypes.CircularLinkDerived***""><Link z:Ref=""i4""/><RandomHangingLink i:nil=""true""/></Link><RandomHangingLink i:nil=""true""/></Link><RandomHangingLink i:nil=""true""/></RandomHangingLink></_data><_data2 z:Ref=""i1"" xmlns:z=""http://schemas.microsoft.com/2003/10/Serialization/""/></ObjectContainer>");
string corelibAssemblyName = typeof(String).Assembly.FullName;
TestObjectInObjectContainerWithSimpleResolver(new SerializationTestTypes.ContainsLinkedList(true), "<ObjectContainer xmlns=\"http://schemas.datacontract.org/2004/07/SerializationTestTypes\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><_data i:type=\"a:SerializationTestTypes.ContainsLinkedList***\" xmlns:a=\"http://schemas.datacontract.org/2004/07/SerializationTestTypes.ContainsLinkedList***\"><Data><SimpleDCWithRef z:Id=\"i1\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"><Data z:Id=\"i2\"><Data>This is a string</Data></Data><RefData z:Ref=\"i2\"/></SimpleDCWithRef><SimpleDCWithRef z:Id=\"i3\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"><Data z:Id=\"i4\"><Data>This is a string</Data></Data><RefData z:Ref=\"i4\"/></SimpleDCWithRef><SimpleDCWithRef z:Ref=\"i3\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"/><SimpleDCWithRef z:Ref=\"i1\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"/><SimpleDCWithRef z:Id=\"i5\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"><Data z:Id=\"i6\"><Data>This is a string</Data></Data><RefData z:Id=\"i7\"><Data>This is a string</Data></RefData></SimpleDCWithRef><SimpleDCWithRef z:Id=\"i8\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"><Data z:Ref=\"i6\"/><RefData z:Ref=\"i6\"/></SimpleDCWithRef><SimpleDCWithRef z:Id=\"i9\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"><Data z:Id=\"i10\"><Data>This is a string</Data></Data><RefData z:Id=\"i11\"><Data>This is a string</Data></RefData></SimpleDCWithRef></Data></_data><_data2 i:type=\"a:SerializationTestTypes.ContainsLinkedList***\" xmlns:a=\"http://schemas.datacontract.org/2004/07/SerializationTestTypes.ContainsLinkedList***\"><Data><SimpleDCWithRef z:Ref=\"i1\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"/><SimpleDCWithRef z:Ref=\"i3\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"/><SimpleDCWithRef z:Ref=\"i3\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"/><SimpleDCWithRef z:Ref=\"i1\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"/><SimpleDCWithRef z:Ref=\"i5\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"/><SimpleDCWithRef z:Ref=\"i8\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"/><SimpleDCWithRef z:Ref=\"i9\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"/></Data></_data2></ObjectContainer>");
-
+
TestObjectInObjectContainerWithSimpleResolver(new SerializationTestTypes.SimpleCDC(true), "<ObjectContainer xmlns=\"http://schemas.datacontract.org/2004/07/SerializationTestTypes\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><_data z:Id=\"i1\" i:type=\"a:SerializationTestTypes.SimpleCDC***\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\" xmlns:a=\"http://schemas.datacontract.org/2004/07/SerializationTestTypes.SimpleCDC***\"><Item>One</Item><Item>Two</Item><Item>two</Item></_data><_data2 z:Ref=\"i1\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"/></ObjectContainer>");
TestObjectInObjectContainerWithSimpleResolver(new SerializationTestTypes.SimpleCDC2(true), "<ObjectContainer xmlns=\"http://schemas.datacontract.org/2004/07/SerializationTestTypes\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><_data z:Id=\"i1\" i:type=\"a:SerializationTestTypes.SimpleCDC2***\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\" xmlns:a=\"http://schemas.datacontract.org/2004/07/SerializationTestTypes.SimpleCDC2***\"><Item>One</Item><Item>Two</Item><Item>two</Item></_data><_data2 z:Ref=\"i1\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"/></ObjectContainer>");
TestObjectInObjectContainerWithSimpleResolver(new SerializationTestTypes.TestInheritence14(true), "<ObjectContainer xmlns=\"http://schemas.datacontract.org/2004/07/SerializationTestTypes\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><_data i:type=\"a:SerializationTestTypes.TestInheritence14***\" xmlns:a=\"http://schemas.datacontract.org/2004/07/SerializationTestTypes.TestInheritence14***\"><baseDC><data>String1</data><data2>String2</data2><days xmlns:b=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\"><b:string>Base1</b:string><b:string>Base2</b:string><b:string>Base3</b:string><b:string>Base4</b:string><b:string>Base5</b:string><b:string>Base6</b:string><b:string>Base7</b:string></days></baseDC><derived2DC><data>TestString2</data><data2>TestString2</data2><data0>TestString0</data0><data1>TestString1</data1><data3>TestString3</data3><data00>String2</data00><data122>TestString122</data122><data4>TestString4</data4></derived2DC></_data><_data2 i:type=\"a:SerializationTestTypes.TestInheritence14***\" xmlns:a=\"http://schemas.datacontract.org/2004/07/SerializationTestTypes.TestInheritence14***\"><baseDC><data>String1</data><data2>String2</data2><days xmlns:b=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\"><b:string>Base1</b:string><b:string>Base2</b:string><b:string>Base3</b:string><b:string>Base4</b:string><b:string>Base5</b:string><b:string>Base6</b:string><b:string>Base7</b:string></days></baseDC><derived2DC><data>TestString2</data><data2>TestString2</data2><data0>TestString0</data0><data1>TestString1</data1><data3>TestString3</data3><data00>String2</data00><data122>TestString122</data122><data4>TestString4</data4></derived2DC></_data2></ObjectContainer>");
TestObjectInObjectContainerWithSimpleResolver(new SerializationTestTypes.TestInheritence8(true), "<ObjectContainer xmlns=\"http://schemas.datacontract.org/2004/07/SerializationTestTypes\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><_data z:Id=\"i1\" i:type=\"a:SerializationTestTypes.TestInheritence8***\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\" xmlns:a=\"http://schemas.datacontract.org/2004/07/SerializationTestTypes.TestInheritence8***\"><baseDC><data>String2</data><data2>TestString2</data2></baseDC><derived2DC><data>TestString</data><data2>TestString2</data2><data0>TestString0</data0><data1>TestString1</data1><data3>TestString3</data3><data11>String1</data11><data12>String2</data12><data4>TestString4</data4></derived2DC></_data><_data2 z:Ref=\"i1\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"/></ObjectContainer>");
-
+
}
[Fact]
TestObjectInObjectContainerWithSimpleResolver(new SerializationTestTypes.BB1(true), "<ObjectContainer xmlns=\"http://schemas.datacontract.org/2004/07/SerializationTestTypes\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><_data z:Id=\"i1\" i:type=\"a:SerializationTestTypes.BB1***\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\" xmlns:a=\"http://schemas.datacontract.org/2004/07/SerializationTestTypes.BB1***\"><Data z:Id=\"i2\"><Data z:Id=\"i3\"><Data z:Id=\"i4\"><Data z:Id=\"i5\"><Data z:Ref=\"i2\"/></Data><Data2 z:Id=\"i6\"><Data z:Ref=\"i4\"/></Data2></Data></Data></Data></_data><_data2 z:Ref=\"i1\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"/></ObjectContainer>");
TestObjectInObjectContainerWithSimpleResolver(new SerializationTestTypes.BBB1(true), "<ObjectContainer xmlns=\"http://schemas.datacontract.org/2004/07/SerializationTestTypes\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><_data z:Id=\"i1\" i:type=\"a:SerializationTestTypes.BBB1***\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\" xmlns:a=\"http://schemas.datacontract.org/2004/07/SerializationTestTypes.BBB1***\"><Data z:Id=\"i2\"><Data z:Id=\"i3\"><Data z:Id=\"i4\"><Data z:Ref=\"i1\"/></Data><Data2 z:Id=\"i5\"><Data z:Ref=\"i3\"/></Data2></Data></Data></_data><_data2 z:Ref=\"i1\" xmlns:z=\"http://schemas.microsoft.com/2003/10/Serialization/\"/></ObjectContainer>");
-
+
}
[Fact]
[Serializable]
public class PrimitiveTypeResolver : DataContractResolver
{
- private readonly static string s_defaultNS = "http://www.default.com";
- private readonly static ConcurrentDictionary<string, Type> s_types = new ConcurrentDictionary<string, Type>();
+ private static readonly string s_defaultNS = "http://www.default.com";
+ private static readonly ConcurrentDictionary<string, Type> s_types = new ConcurrentDictionary<string, Type>();
public override bool TryResolveType(Type dcType, Type declaredType, DataContractResolver KTResolver, out XmlDictionaryString typeName, out XmlDictionaryString typeNamespace)
{
public class ResolverDefaultCollections : DataContractResolver
{
- private readonly static string s_defaultNs = "http://www.default.com";
+ private static readonly string s_defaultNs = "http://www.default.com";
public override bool TryResolveType(Type dcType, Type declaredType, DataContractResolver KTResolver, out XmlDictionaryString typeName, out XmlDictionaryString typeNamespace)
{
string resolvedNamespace = string.Empty;
if (dataBuffer.Length > 0)
memStream.Seek(dataBuffer.Length, SeekOrigin.Current);
- return AsyncInfo.CreateCompletedOperation<IBuffer, UInt32>(dataBuffer);
+ return AsyncInfo.CreateCompletedOperation<IBuffer, uint>(dataBuffer);
}
catch (Exception ex)
{
- return AsyncInfo.CreateFaultedOperation<IBuffer, UInt32>(ex);
+ return AsyncInfo.CreateFaultedOperation<IBuffer, uint>(ex);
}
} // ReadAsync_MemoryStream
return dataBuffer;
}; // readOperation
- return AsyncInfo.Run<IBuffer, UInt32>(readOperation);
+ return AsyncInfo.Run<IBuffer, uint>(readOperation);
} // ReadAsync_AbstractStream
#endregion ReadAsync implementations
} // if-else
// Construct and run the async operation:
- return AsyncInfo.Run<UInt32, UInt32>(writeOperation);
+ return AsyncInfo.Run<uint, uint>(writeOperation);
} // WriteAsync_AbstractStream
#endregion WriteAsync implementations
};
// Construct and run the async operation:
- return AsyncInfo.Run<Boolean>(flushOperation);
+ return AsyncInfo.Run<bool>(flushOperation);
}
#endregion FlushAsync implementations
#if DEBUG
- private static void AssertValidStream(Object winRtStream)
+ private static void AssertValidStream(object winRtStream)
{
Debug.Assert(winRtStream != null,
"This to-NetFx Stream adapter must not be disposed and the underlying WinRT stream must be of compatible type for this operation");
if (valueMayBeWrappedInBufferedStream)
{
BufferedStream bufferedValueInMap = valueInMap as BufferedStream;
- Debug.Assert(Object.ReferenceEquals(value, valueInMap)
- || (bufferedValueInMap != null && Object.ReferenceEquals(value, bufferedValueInMap.UnderlyingStream)));
+ Debug.Assert(object.ReferenceEquals(value, valueInMap)
+ || (bufferedValueInMap != null && object.ReferenceEquals(value, bufferedValueInMap.UnderlyingStream)));
}
else
{
- Debug.Assert(Object.ReferenceEquals(value, valueInMap));
+ Debug.Assert(object.ReferenceEquals(value, valueInMap));
}
}
#endif // DEBUG
// In that case we do not need to put the wrapper into the map.
if (sAdptr != null)
{
- object wrappedWinRtStream = sAdptr.GetWindowsRuntimeStream<Object>();
+ object wrappedWinRtStream = sAdptr.GetWindowsRuntimeStream<object>();
if (wrappedWinRtStream == null)
throw new ObjectDisposedException(nameof(stream), SR.ObjectDisposed_CannotPerformOperation);
private static volatile CultureInfo s_globalResourceContextBestFitCultureInfo;
private static volatile global::Windows.ApplicationModel.Resources.Core.ResourceManager s_globalResourceManager;
- private static Object s_objectForLock = new Object(); // Used by InitializeStatics
+ private static object s_objectForLock = new object(); // Used by InitializeStatics
private static bool InitializeStatics()
{
#pragma warning restore 618
if (globalResourceContext != null)
{
- List<String> languages = new List<string>(globalResourceContext.Languages);
+ List<string> languages = new List<string>(globalResourceContext.Languages);
s_globalResourceContextBestFitCultureInfo = GetBestFitCultureFromLanguageList(languages);
s_globalResourceContextFallBackList = ReadOnlyListToString(languages);
return;
}
- List<String> languages = new List<string>(langs);
+ List<string> languages = new List<string>(langs);
if (languages.Count > 0 && languages[0] == c_InvariantCulturePrivateName)
{
s_globalResourceContextFallBackList = ReadOnlyListToString(languages);
}
- private static bool LibpathMatchesPackagepath(String libpath, String packagepath)
+ private static bool LibpathMatchesPackagepath(string libpath, string packagepath)
{
Debug.Assert(libpath != null);
Debug.Assert(packagepath != null);
return packagepath.Length < libpath.Length &&
- String.Compare(packagepath, 0,
+ string.Compare(packagepath, 0,
libpath, 0,
packagepath.Length,
StringComparison.OrdinalIgnoreCase) == 0 &&
#if netstandard
/* Returns true if libpath is path to an ni image and if the path contains packagename as a subfolder */
- private static bool LibpathContainsPackagename(String libpath, String packagename)
+ private static bool LibpathContainsPackagename(string libpath, string packagename)
{
Debug.Assert(libpath != null);
Debug.Assert(packagename != null);
// exceptionInfo structure at this point since we don't have any
// reliable information to include in it.
- IReadOnlyDictionary<String, ResourceMap>
+ IReadOnlyDictionary<string, ResourceMap>
resourceMapDictionary = s_globalResourceManager.AllResourceMaps;
if (resourceMapDictionary != null)
{
Debug.Assert(list != null);
- return String.Join(";", list);
+ return string.Join(";", list);
}
public override CultureInfo GlobalResourceContextBestFitCultureInfo
return true;
}
- List<String> languages = new List<String>(s_globalResourceContext.Languages);
+ List<string> languages = new List<string>(s_globalResourceContext.Languages);
languages.Insert(0, ci.Name == CultureInfo.InvariantCulture.Name ? c_InvariantCulturePrivateName : ci.Name);
// remove any duplication in the list
// continue to be thread-safe.
// Throws exceptions
- public override String GetString(String stringName,
- String startingCulture, String neutralResourcesCulture)
+ public override string GetString(string stringName,
+ string startingCulture, string neutralResourcesCulture)
{
Debug.Assert(stringName != null);
Debug.Assert(_resourceMap != null); // Should have been initialized by now
// The worst that can happen is that a string is unexpectedly missing
// or in the wrong language.
- if (!String.Equals(newResourceFallBackList, _clonedResourceContextFallBackList, StringComparison.Ordinal))
+ if (!string.Equals(newResourceFallBackList, _clonedResourceContextFallBackList, StringComparison.Ordinal))
{
_clonedResourceContext.Languages = StringToReadOnlyList(newResourceFallBackList);
_clonedResourceContextFallBackList = newResourceFallBackList;
if (source.Capacity - sourceIndex < count) throw new ArgumentException(SR.Argument_InsufficientSpaceInSourceBuffer);
if (count == 0)
- return Array.Empty<Byte>();
+ return Array.Empty<byte>();
byte[] destination = new byte[count];
source.CopyTo(sourceIndex, destination, 0, count);
public static int ByteLength(System.Array array) { throw null; }
public static byte GetByte(System.Array array, int index) { throw null; }
[System.CLSCompliantAttribute(false)]
- public unsafe static void MemoryCopy(void* source, void* destination, long destinationSizeInBytes, long sourceBytesToCopy) { }
+ public static unsafe void MemoryCopy(void* source, void* destination, long destinationSizeInBytes, long sourceBytesToCopy) { }
[System.CLSCompliantAttribute(false)]
- public unsafe static void MemoryCopy(void* source, void* destination, ulong destinationSizeInBytes, ulong sourceBytesToCopy) { }
+ public static unsafe void MemoryCopy(void* source, void* destination, ulong destinationSizeInBytes, ulong sourceBytesToCopy) { }
public static void SetByte(System.Array array, int index, byte value) { }
}
public readonly partial struct Byte : System.IComparable, System.IComparable<byte>, System.IConvertible, System.IEquatable<byte>, System.IFormattable
public static explicit operator int (System.IntPtr value) { throw null; }
public static explicit operator long (System.IntPtr value) { throw null; }
[System.CLSCompliantAttribute(false)]
- public unsafe static explicit operator void* (System.IntPtr value) { throw null; }
+ public static unsafe explicit operator void* (System.IntPtr value) { throw null; }
[System.CLSCompliantAttribute(false)]
- public unsafe static explicit operator System.IntPtr (void* value) { throw null; }
+ public static unsafe explicit operator System.IntPtr (void* value) { throw null; }
public static bool operator !=(System.IntPtr value1, System.IntPtr value2) { throw null; }
public static System.IntPtr operator -(System.IntPtr pointer, int offset) { throw null; }
public static System.IntPtr Subtract(System.IntPtr pointer, int offset) { throw null; }
public static explicit operator System.UIntPtr (ulong value) { throw null; }
public static explicit operator uint (System.UIntPtr value) { throw null; }
public static explicit operator ulong (System.UIntPtr value) { throw null; }
- public unsafe static explicit operator void* (System.UIntPtr value) { throw null; }
- public unsafe static explicit operator System.UIntPtr (void* value) { throw null; }
+ public static unsafe explicit operator void* (System.UIntPtr value) { throw null; }
+ public static unsafe explicit operator System.UIntPtr (void* value) { throw null; }
public static bool operator !=(System.UIntPtr value1, System.UIntPtr value2) { throw null; }
public static System.UIntPtr operator -(System.UIntPtr pointer, int offset) { throw null; }
public static System.UIntPtr Subtract(System.UIntPtr pointer, int offset) { throw null; }
public sealed partial class Pointer : System.Runtime.Serialization.ISerializable
{
internal Pointer() { }
- public unsafe static object Box(void* ptr, System.Type type) { throw null; }
+ public static unsafe object Box(void* ptr, System.Type type) { throw null; }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public unsafe static void* Unbox(object ptr) { throw null; }
+ public static unsafe void* Unbox(object ptr) { throw null; }
}
[System.FlagsAttribute]
public enum PortableExecutableKinds
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsArgIteratorNotSupported))]
- public unsafe static void ArgIterator_Throws_PlatformNotSupportedException()
+ public static unsafe void ArgIterator_Throws_PlatformNotSupportedException()
{
Assert.Throws<PlatformNotSupportedException>(() => new ArgIterator(new RuntimeArgumentHandle()));
Assert.Throws<PlatformNotSupportedException>(() => {
[Theory]
[InlineData("")] // empty string
[InlineData("hello")] // non-empty string
- public unsafe static void GetPinnableReference_ReturnsSameAsGCHandleAndLegacyFixed(string input)
+ public static unsafe void GetPinnableReference_ReturnsSameAsGCHandleAndLegacyFixed(string input)
{
Assert.NotNull(input); // test shouldn't have null input
}
[Fact]
- public unsafe static void GetPinnableReference_WithNullInput_ThrowsNullRef()
+ public static unsafe void GetPinnableReference_WithNullInput_ThrowsNullRef()
{
// This test uses an explicit call instead of the normal callvirt that C# would emit.
// This allows us to make sure the NullReferenceException is coming from *within*
/// <summary>
/// Returns true only if U+0020 SPACE is represented as the single byte 0x20 in the active code page.
/// </summary>
- public unsafe static bool IsSimpleActiveCodePage
+ public static unsafe bool IsSimpleActiveCodePage
{
get
{
}
[Fact]
- public unsafe static void NarrowUtf16ToAscii_EmptyInput_NullReferences()
+ public static unsafe void NarrowUtf16ToAscii_EmptyInput_NullReferences()
{
Assert.Equal(UIntPtr.Zero, _fnNarrowUtf16ToAscii.Delegate(null, null, UIntPtr.Zero));
}
gAce = new CustomAce(aceType, aceFlag, opaque);
rawAcl.InsertAce(rawAcl.Count, gAce);
- // CompoundAce
+ // CompoundAce
aceFlag = (AceFlags)2;
accessMask = 1;
compoundAceType = CompoundAceType.Impersonation;
}
}
-}
\ No newline at end of file
+}
//case 3, only three ACEs, index at Count/2
rawAcl = new RawAcl(1, 3);
- //215 has all AceFlags except InheritOnly
+ //215 has all AceFlags except InheritOnly
gAce = new CommonAce((AceFlags)(FlagsForAce.AuditFlags | FlagsForAce.OI | FlagsForAce.CI | FlagsForAce.NP | FlagsForAce.IH), AceQualifier.AccessAllowed, 1,
new SecurityIdentifier(Utils.TranslateStringConstFormatSidToStandardFormatSid(owner1)), false, null);
rawAcl.InsertAce(0, gAce);
- //199 has all AceFlags except InheritOnly and Inherited
+ //199 has all AceFlags except InheritOnly and Inherited
gAce = new CommonAce((AceFlags)(FlagsForAce.AuditFlags | FlagsForAce.OI | FlagsForAce.CI | FlagsForAce.NP), AceQualifier.AccessDenied, 1,
new SecurityIdentifier(Utils.TranslateStringConstFormatSidToStandardFormatSid(owner2)), false, null);
rawAcl.InsertAce(1, gAce);
});
}
}
-}
\ No newline at end of file
+}
rawAcl = new RawAcl(revision, capacity);
sidStr = "BG";
sid = new SecurityIdentifier(Utils.TranslateStringConstFormatSidToStandardFormatSid(sidStr));
- //199 has all aceflags but inheritonly and inherited
+ //199 has all aceflags but inheritonly and inherited
gAce = new CommonAce((AceFlags)199, AceQualifier.AccessAllowed, 1, sid, false, null);
rawAcl.InsertAce(0, gAce);
isContainer = false;
rawAcl = new RawAcl(revision, capacity);
sidStr = "BG";
sid = new SecurityIdentifier(Utils.TranslateStringConstFormatSidToStandardFormatSid(sidStr));
- //215 has all aceflags but inheritedonly
+ //215 has all aceflags but inheritedonly
gAce = new CommonAce((AceFlags)215, AceQualifier.AccessAllowed, 1, sid, false, null);
rawAcl.InsertAce(0, gAce);
isContainer = false;
rawAcl = new RawAcl(revision, capacity);
sidStr = "BG";
sid = new SecurityIdentifier(Utils.TranslateStringConstFormatSidToStandardFormatSid(sidStr));
- //207 has all AceFlags but inherited
+ //207 has all AceFlags but inherited
gAce = new CommonAce((AceFlags)207, AceQualifier.AccessAllowed, 1, sid, false, null);
rawAcl.InsertAce(0, gAce);
gAce = new CommonAce(AceFlags.None, AceQualifier.AccessDenied, 2, sid, false, null);
revision = 127;
capacity = 1;
rawAcl = new RawAcl(revision, capacity);
- //207 has all AceFlags but inherited
+ //207 has all AceFlags but inherited
aceFlag = (AceFlags)207;
accessMask = 1;
compoundAceType = CompoundAceType.Impersonation;
capacity = 1;
rawAcl = new RawAcl(revision, capacity);
sid = new SecurityIdentifier(Utils.TranslateStringConstFormatSidToStandardFormatSid("BG"));
- //207 has all AceFlags but inherited
+ //207 has all AceFlags but inherited
aceFlag = (AceFlags)207;
aceQualifier = AceQualifier.AccessAllowed;
accessMask = 1;
if (!Utils.IsBinaryFormEqual(dAclBinaryForm, rAclBinaryForm))
result = false;
- //redundant index check
+ //redundant index check
for (int i = 0; i < discretionaryAcl.Count; i++)
{
if (!Utils.IsAceEqual(discretionaryAcl[i], rawAcl[i]))
if (!Utils.IsBinaryFormEqual(dAclBinaryForm, rAclBinaryForm))
result = false;
- //redundant index check
+ //redundant index check
for (int i = 0; i < discretionaryAcl.Count; i++)
{
if (!Utils.IsAceEqual(discretionaryAcl[i], rawAcl[i]))
revision = 255;
capacity = 1;
rawAcl = new RawAcl(revision, capacity);
- //199 has all AceFlags except InheritOnly and Inherited
+ //199 has all AceFlags except InheritOnly and Inherited
gAce = new CommonAce((AceFlags)(FlagsForAce.AuditFlags | FlagsForAce.OI | FlagsForAce.CI | FlagsForAce.NP), AceQualifier.AccessDenied, 1,
new SecurityIdentifier(Utils.TranslateStringConstFormatSidToStandardFormatSid("BG")), false, null);
rawAcl.InsertAce(0, gAce);
- //215 has all AceFlags except InheritOnly
+ //215 has all AceFlags except InheritOnly
gAce = new CommonAce((AceFlags)(FlagsForAce.AuditFlags | FlagsForAce.OI | FlagsForAce.CI | FlagsForAce.NP | FlagsForAce.IH), AceQualifier.AccessAllowed, 1,
new SecurityIdentifier(Utils.TranslateStringConstFormatSidToStandardFormatSid("BA")), false, null);
rawAcl.InsertAce(1, gAce);
revision = 255;
capacity = 1;
rawAcl = new RawAcl(revision, capacity);
- //215 has all AceFlags except InheritOnly
+ //215 has all AceFlags except InheritOnly
gAce = new CommonAce((AceFlags)215, AceQualifier.AccessAllowed, 1,
new SecurityIdentifier(Utils.TranslateStringConstFormatSidToStandardFormatSid("BG")), false, null);
rawAcl.InsertAce(0, gAce);
}
}
-}
\ No newline at end of file
+}
private void Reset()
{
// Ensure we've called CryptEncrypt with the final=true flag so the handle is reset property
- EncryptData(_hKey, Array.Empty<Byte>(), 0, 0, Array.Empty<Byte>(), 0, 0, true);
+ EncryptData(_hKey, Array.Empty<byte>(), 0, 0, Array.Empty<byte>(), 0, 0, true);
}
private int Transform(byte[] input, int inputOffset, int count, byte[] output, int outputOffset, bool isFinal)
_hash.TransformBlock(_salt, 0, _salt.Length, _salt, 0);
}
- _hash.TransformFinalBlock(Array.Empty<Byte>(), 0, 0);
+ _hash.TransformFinalBlock(Array.Empty<byte>(), 0, 0);
_baseValue = _hash.Hash;
_hash.Initialize();
}
}
- internal protected bool CacheValid
+ protected internal bool CacheValid
{
get
{
// abstract class providing symmetric key wrap implementation
internal static class SymmetricKeyWrap
{
- private readonly static byte[] s_rgbTripleDES_KW_IV = { 0x4a, 0xdd, 0xa2, 0x2c, 0x79, 0xe8, 0x21, 0x05 };
- private readonly static byte[] s_rgbAES_KW_IV = { 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6 };
+ private static readonly byte[] s_rgbTripleDES_KW_IV = { 0x4a, 0xdd, 0xa2, 0x2c, 0x79, 0xe8, 0x21, 0x05 };
+ private static readonly byte[] s_rgbAES_KW_IV = { 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6 };
//
// internal static methods
// MonoTests.System.Security.Cryptography.Xml.AssertCrypto.cs
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
// DSAKeyValueTest.cs - Test Cases for DSAKeyValue
//
// Author:
-// Sebastien Pouliot (spouliot@motus.com)
+// Sebastien Pouliot (spouliot@motus.com)
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
//
// DataObjectTest.cs - Test Cases for DataObject
//
// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-// Atsushi Enomoto (atsushi@ximian.com)
+// Sebastien Pouliot (spouliot@motus.com)
+// Atsushi Enomoto (atsushi@ximian.com)
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// (C) 2004 Novell Inc.
DataObject obj = new DataObject();
XmlElement el1 = obj.GetXml();
obj.LoadXml(doc.DocumentElement);
- // obj.Id = "hogehoge";
+ // obj.Id = "hogehoge";
XmlElement el2 = obj.GetXml();
Assert.Equal(doc, el2.OwnerDocument);
}
XmlElement el1 = obj.GetXml();
Assert.Equal("<Object Id=\"hoge\" MimeType=\"application/octet-stream\" Encoding=\"euc-kr\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\">test</Object>", el1.OuterXml);
/* looks curious? but the element does not look to
- be appended to the document.
- Just commented out since it is not fixed.
- Assert.AreEqual (String.Empty, el1.OwnerDocument.OuterXml);
- */
+ be appended to the document.
+ Just commented out since it is not fixed.
+ Assert.AreEqual (String.Empty, el1.OwnerDocument.OuterXml);
+ */
}
[Fact]
// DataReferenceTest.cs
//
// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
+// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc.
//
// EncryptedXmlTest.cs
//
// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
+// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
// KeyInfoNameTest.cs - Test Cases for KeyInfoName
//
// Author:
-// Sebastien Pouliot (spouliot@motus.com)
+// Sebastien Pouliot (spouliot@motus.com)
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
//
// KeyInfoNodeTest.cs - Test Cases for KeyInfoNode
//
// Author:
-// Sebastien Pouliot (spouliot@motus.com)
+// Sebastien Pouliot (spouliot@motus.com)
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
//
// KeyInfoRetrievalMethodTest.cs - Test Cases for KeyInfoRetrievalMethod
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
// KeyInfoTest.cs - Test Cases for KeyInfo
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
// KeyInfoX509DataTest.cs - Test Cases for KeyInfoX509Data
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
// RSAKeyValueTest.cs - Test Cases for RSAKeyValue
//
// Author:
-// Sebastien Pouliot (spouliot@motus.com)
+// Sebastien Pouliot (spouliot@motus.com)
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
//
// ReferenceTest.cs - Test Cases for Reference
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// (C) 2004 Novell (http://www.novell.com)
}
const string xml = @"<player bats=""left"" id=""10012"" throws=""right"">
- <!-- Here's a comment -->
- <name>Alfonso Soriano</name>
- <position>2B</position>
- <team>New York Yankees</team>
+ <!-- Here's a comment -->
+ <name>Alfonso Soriano</name>
+ <position>2B</position>
+ <team>New York Yankees</team>
<dsig:Signature xmlns=""http://www.w3.org/2000/09/xmldsig#"" xmlns:dsig=""http://www.w3.org/2000/09/xmldsig#"">"
+ @"<dsig:SignedInfo><dsig:CanonicalizationMethod Algorithm=""http://www.w3.org/TR/2001/REC-xml-c14n-withcomments-20010315""/><dsig:SignatureMethod Algorithm=""http://www.w3.org/2000/09/xmldsig#rsa-sha1""/>"
+ @"<dsig:Reference URI=""""><dsig:Transforms><dsig:Transform Algorithm=""http://www.w3.org/2000/09/xmldsig#enveloped-signature""/></dsig:Transforms><dsig:DigestMethod Algorithm=""http://www.w3.org/2000/09/xmldsig#sha1""/><dsig:DigestValue>nDF2V/bzRd0VE3EwShWtsBzTEDc=</dsig:DigestValue></dsig:Reference></dsig:SignedInfo><dsig:SignatureValue>fbye4Xm//RPUTsLd1dwJPo0gPZYX6gVYCEB/gz2348EARNk/nCCch1fFfpuqAGMKg4ayVC0yWkUyE5V4QB33jaGlh9wuNQSjxs6TIvFwSsT+0ioDgVgFv0gVeasbyNL4rFEHuAWL8QKwDT9L6b2wUvJC90DmpBs9GMR2jTZIWlM=</dsig:SignatureValue><dsig:KeyInfo><dsig:X509Data><dsig:X509Certificate>MIIC0DCCAjmgAwIBAgIDD0JBMA0GCSqGSIb3DQEBBAUAMHwxCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhOZXcgWW9yazERMA8GA1UEBxMITmV3IFlvcmsxGTAXBgNVBAoTEFBoYW9zIFRlY2hub2xvZ3kxFDASBgNVBAsTC0VuZ2luZWVyaW5nMRYwFAYDVQQDEw1UZXN0IENBIChSU0EpMB4XDTAyMDQyOTE5MTY0MFoXDTEyMDQyNjE5MTY0MFowgYAxCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhOZXcgWW9yazERMA8GA1UEBxMITmV3IFlvcmsxGTAXBgNVBAoTEFBoYW9zIFRlY2hub2xvZ3kxFDASBgNVBAsTC0VuZ2luZWVyaW5nMRowGAYDVQQDExFUZXN0IENsaWVudCAoUlNBKTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAgIb6nAB9oS/AI5jIj6WymvQhRxiMlE07G4abmMliYi5zWzvaFE2tnU+RZIBgtoXcgDEIU/vsLQut7nzCn9mHxC8JEaV4D4U91j64AyZakShqJw7qjJfqUxxPL0yJv2oFiouPDjGuJ9JPi0NrsZq+yfWfM54s4b9SNkcOIVMybZUCAwEAAaNbMFkwDAYDVR0TAQH/BAIwADAPBgNVHQ8BAf8EBQMDB9gAMBkGA1UdEQQSMBCBDnRlY2hAcGhhb3MuY29tMB0GA1UdDgQWBBQT58rBCxPmVLeZaYGRqVROnQlFbzANBgkqhkiG9w0BAQQFAAOBgQCxbCovFST25t+ryN1RipqozxJQcguKfeCwbfgBNobzcRvoW0kSIf7zi4mtQajDM0NfslFF51/dex5Rn64HmFFshSwSvQQMyf5Cfaqv2XQ60OXq6nAFG6WbHoge6RqfIez2MWDLoSB6plsjKtMmL3mcybBhROtX5GGuLx1NtfhNFQ==</dsig:X509Certificate><dsig:X509IssuerSerial><dsig:X509IssuerName>CN=Test CA (RSA),OU=Engineering,O=Phaos Technology,L=New York,ST=New York,C=US</dsig:X509IssuerName><dsig:X509SerialNumber>1000001</dsig:X509SerialNumber></dsig:X509IssuerSerial><dsig:X509SubjectName>CN=Test Client (RSA),OU=Engineering,O=Phaos Technology,L=New York,ST=New York,C=US</dsig:X509SubjectName><dsig:X509SKI>E+fKwQsT5lS3mWmBkalUTp0JRW8=</dsig:X509SKI></dsig:X509Data></dsig:KeyInfo></dsig:Signature></player>";
// SignatureTest.cs - Test Cases for SignedXml
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
// SignedInfoTest.cs - Test Cases for SignedInfo
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2005, 2009 Novell, Inc (http://www.novell.com)
// from phaos testcase
const string xmlForGetXml = @"<player bats=""left"" id=""10012"" throws=""right"">
- <!-- Here's a comment -->
- <name>Alfonso Soriano</name>
- <position>2B</position>
- <team>New York Yankees</team>
+ <!-- Here's a comment -->
+ <name>Alfonso Soriano</name>
+ <position>2B</position>
+ <team>New York Yankees</team>
<dsig:Signature xmlns=""http://www.w3.org/2000/09/xmldsig#"" xmlns:dsig=""http://www.w3.org/2000/09/xmldsig#"">"
+ @"<dsig:SignedInfo><dsig:CanonicalizationMethod Algorithm=""http://www.w3.org/TR/2001/REC-xml-c14n-withcomments-20010315""/><dsig:SignatureMethod Algorithm=""http://www.w3.org/2000/09/xmldsig#rsa-sha1""/>"
+ @"<dsig:Reference URI=""""><dsig:Transforms><dsig:Transform Algorithm=""http://www.w3.org/2000/09/xmldsig#enveloped-signature""/></dsig:Transforms><dsig:DigestMethod Algorithm=""http://www.w3.org/2000/09/xmldsig#sha1""/><dsig:DigestValue>nDF2V/bzRd0VE3EwShWtsBzTEDc=</dsig:DigestValue></dsig:Reference></dsig:SignedInfo><dsig:SignatureValue>fbye4Xm//RPUTsLd1dwJPo0gPZYX6gVYCEB/gz2348EARNk/nCCch1fFfpuqAGMKg4ayVC0yWkUyE5V4QB33jaGlh9wuNQSjxs6TIvFwSsT+0ioDgVgFv0gVeasbyNL4rFEHuAWL8QKwDT9L6b2wUvJC90DmpBs9GMR2jTZIWlM=</dsig:SignatureValue><dsig:KeyInfo><dsig:X509Data><dsig:X509Certificate>MIIC0DCCAjmgAwIBAgIDD0JBMA0GCSqGSIb3DQEBBAUAMHwxCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhOZXcgWW9yazERMA8GA1UEBxMITmV3IFlvcmsxGTAXBgNVBAoTEFBoYW9zIFRlY2hub2xvZ3kxFDASBgNVBAsTC0VuZ2luZWVyaW5nMRYwFAYDVQQDEw1UZXN0IENBIChSU0EpMB4XDTAyMDQyOTE5MTY0MFoXDTEyMDQyNjE5MTY0MFowgYAxCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhOZXcgWW9yazERMA8GA1UEBxMITmV3IFlvcmsxGTAXBgNVBAoTEFBoYW9zIFRlY2hub2xvZ3kxFDASBgNVBAsTC0VuZ2luZWVyaW5nMRowGAYDVQQDExFUZXN0IENsaWVudCAoUlNBKTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAgIb6nAB9oS/AI5jIj6WymvQhRxiMlE07G4abmMliYi5zWzvaFE2tnU+RZIBgtoXcgDEIU/vsLQut7nzCn9mHxC8JEaV4D4U91j64AyZakShqJw7qjJfqUxxPL0yJv2oFiouPDjGuJ9JPi0NrsZq+yfWfM54s4b9SNkcOIVMybZUCAwEAAaNbMFkwDAYDVR0TAQH/BAIwADAPBgNVHQ8BAf8EBQMDB9gAMBkGA1UdEQQSMBCBDnRlY2hAcGhhb3MuY29tMB0GA1UdDgQWBBQT58rBCxPmVLeZaYGRqVROnQlFbzANBgkqhkiG9w0BAQQFAAOBgQCxbCovFST25t+ryN1RipqozxJQcguKfeCwbfgBNobzcRvoW0kSIf7zi4mtQajDM0NfslFF51/dex5Rn64HmFFshSwSvQQMyf5Cfaqv2XQ60OXq6nAFG6WbHoge6RqfIez2MWDLoSB6plsjKtMmL3mcybBhROtX5GGuLx1NtfhNFQ==</dsig:X509Certificate><dsig:X509IssuerSerial><dsig:X509IssuerName>CN=Test CA (RSA),OU=Engineering,O=Phaos Technology,L=New York,ST=New York,C=US</dsig:X509IssuerName><dsig:X509SerialNumber>1000001</dsig:X509SerialNumber></dsig:X509IssuerSerial><dsig:X509SubjectName>CN=Test Client (RSA),OU=Engineering,O=Phaos Technology,L=New York,ST=New York,C=US</dsig:X509SubjectName><dsig:X509SKI>E+fKwQsT5lS3mWmBkalUTp0JRW8=</dsig:X509SKI></dsig:X509Data></dsig:KeyInfo></dsig:Signature></player>";
// SignedXmlTest.cs - Test Cases for SignedXml
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2004-2005, 2008 Novell, Inc (http://www.novell.com)
// TransformChainTest.cs - Test Cases for TransformChain
//
// Author:
-// Sebastien Pouliot (spouliot@motus.com)
+// Sebastien Pouliot (spouliot@motus.com)
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
//
// Unit tests for Transform
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
//
// Unit tests for XmlDecryptionTransform
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
//
// XmlDsigBase64TransformTest.cs - Test Cases for XmlDsigBase64Transform
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
// (C) 2004 Novell (http://www.novell.com)
// XmlDsigC14NTransformTest.cs - Test Cases for XmlDsigC14NTransform
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-// Aleksey Sanin (aleksey@aleksey.com)
+// Sebastien Pouliot <sebastien@ximian.com>
+// Aleksey Sanin (aleksey@aleksey.com)
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// (C) 2003 Aleksey Sanin (aleksey@aleksey.com)
" <e7 xmlns=\"http://www.ietf.org\">\n" +
" <e8 xmlns=\"\">\n" +
" <e9 xmlns:a=\"http://www.ietf.org\" attr=\"default\"></e9>\n" +
- // " <e9 xmlns:a=\"http://www.ietf.org\"></e9>\n" +
+ // " <e9 xmlns:a=\"http://www.ietf.org\"></e9>\n" +
" </e8>\n" +
" </e7>\n" +
" </e6>\n" +
// See the LICENSE file in the project root for more information
//
// XmlDsigC14NWithCommentsTransformTest.cs
-// - Test Cases for XmlDsigC14NWithCommentsTransform
+// - Test Cases for XmlDsigC14NWithCommentsTransform
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
" <e7 xmlns=\"http://www.ietf.org\">\n" +
" <e8 xmlns=\"\">\n" +
" <e9 xmlns:a=\"http://www.ietf.org\" attr=\"default\"></e9>\n" +
- // " <e9 xmlns:a=\"http://www.ietf.org\"></e9>\n" +
+ // " <e9 xmlns:a=\"http://www.ietf.org\"></e9>\n" +
" </e8>\n" +
" </e7>\n" +
" </e6>\n" +
// XmlDsigEnvelopedSignatureTransformTest.cs
//
// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
+// Atsushi Enomoto <atsushi@ximian.com>
//
// (C) 2004 Novell Inc.
//
//
// Author:
// original:
-// Sebastien Pouliot <sebastien@ximian.com>
-// Aleksey Sanin (aleksey@aleksey.com)
+// Sebastien Pouliot <sebastien@ximian.com>
+// Aleksey Sanin (aleksey@aleksey.com)
// this file:
-// Atsushi Enomoto <atsushi@ximian.com>
+// Atsushi Enomoto <atsushi@ximian.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// (C) 2003 Aleksey Sanin (aleksey@aleksey.com)
}
[Fact]
- // [Ignore ("This test should be fine, but it does not pass under MS.NET")]
+ // [Ignore ("This test should be fine, but it does not pass under MS.NET")]
public void ExcC14NSpecExample4()
{
string res = ExecuteXmlDSigExcC14NTransform(ExcC14NSpecExample4Input);
" <e7 xmlns=\"http://www.ietf.org\">\n" +
" <e8 xmlns=\"\">\n" +
" <e9 attr=\"default\"></e9>\n" +
- // " <e9 xmlns:a=\"http://www.ietf.org\"></e9>\n" +
+ // " <e9 xmlns:a=\"http://www.ietf.org\"></e9>\n" +
" </e8>\n" +
" </e7>\n" +
" </e6>\n" +
//
// Author:
// original:
-// Sebastien Pouliot <sebastien@ximian.com>
-// Aleksey Sanin (aleksey@aleksey.com)
+// Sebastien Pouliot <sebastien@ximian.com>
+// Aleksey Sanin (aleksey@aleksey.com)
// this file:
-// Gert Driesen <drieseng@users.sourceforge.net>
+// Gert Driesen <drieseng@users.sourceforge.net>
//
// (C) 2003 Aleksey Sanin (aleksey@aleksey.com)
// (C) 2004 Novell (http://www.novell.com)
// XmlDsigXPathTransformTest.cs - Test Cases for XmlDsigXPathTransform
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
// MS.NET bug - ms.net returns ns node even when the
// current node is ns node (it is like returning
// attribute from attribute nodes).
- // Assert.Equal (XmlNodeType.Attribute, nl [4].NodeType);
- // Assert.Equal ("xmlns", nl [4].LocalName);
+ // Assert.Equal (XmlNodeType.Attribute, nl [4].NodeType);
+ // Assert.Equal ("xmlns", nl [4].LocalName);
}
[Fact]
XmlDsigXPathTransform t = new XmlDsigXPathTransform();
XmlDocument xpdoc = new XmlDocument();
string ns = "http://www.w3.org/2000/09/xmldsig#";
- // string xpath = "<XPath xmlns='" + ns + "' xmlns:x='urn:foo'>here()</XPath>";
+ // string xpath = "<XPath xmlns='" + ns + "' xmlns:x='urn:foo'>here()</XPath>";
string xpath = "<XPath xmlns='" + ns + "' xmlns:x='urn:foo'></XPath>";
xpdoc.LoadXml(xpath);
t.LoadInnerXml(xpdoc.ChildNodes);
// XmlDsigXsltTransformTest.cs - Test Cases for XmlDsigXsltTransform
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-// Atsushi Enomoto <atsushi@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
+// Atsushi Enomoto <atsushi@ximian.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// (C) 2004 Novell (http://www.novell.com)
//
// Author:
// original:
-// Sebastien Pouliot <sebastien@ximian.com>
-// Aleksey Sanin (aleksey@aleksey.com)
+// Sebastien Pouliot <sebastien@ximian.com>
+// Aleksey Sanin (aleksey@aleksey.com)
// this file:
-// Gert Driesen <drieseng@users.sourceforge.net>
+// Gert Driesen <drieseng@users.sourceforge.net>
//
// (C) 2003 Aleksey Sanin (aleksey@aleksey.com)
// (C) 2004 Novell (http://www.novell.com)
{
AssertExtensions.Throws<ArgumentException>("type", () => transform.GetOutput(typeof(string)));
}
-
+
[Fact]
public static void ItDecryptsLicense()
{
namespace System.Configuration
{
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- sealed public class ConfigurationPermissionAttribute : CodeAccessSecurityAttribute
+ public sealed class ConfigurationPermissionAttribute : CodeAccessSecurityAttribute
{
public ConfigurationPermissionAttribute(SecurityAction action) : base(default(SecurityAction)) { }
public override IPermission CreatePermission() { return default(IPermission); }
}
-}
\ No newline at end of file
+}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor
| AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly,
AllowMultiple = true, Inherited = false)]
- sealed public class IsolatedStorageFilePermissionAttribute : IsolatedStoragePermissionAttribute
+ public sealed class IsolatedStorageFilePermissionAttribute : IsolatedStoragePermissionAttribute
{
public IsolatedStorageFilePermissionAttribute(SecurityAction action) : base(action) { }
public override IPermission CreatePermission() { return null; }
SafeImage,
AllImage,
}
- sealed public class MediaPermission : CodeAccessPermission, IUnrestrictedPermission
+ public sealed class MediaPermission : CodeAccessPermission, IUnrestrictedPermission
{
public MediaPermission() { }
public MediaPermission(PermissionState state) { }
public MediaPermissionImage Image { get { return MediaPermissionImage.AllImage; } }
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
- sealed public class MediaPermissionAttribute : CodeAccessSecurityAttribute
+ public sealed class MediaPermissionAttribute : CodeAccessSecurityAttribute
{
public MediaPermissionAttribute(SecurityAction action) : base(action) { }
public override IPermission CreatePermission() { return new MediaPermission(); }
Safe,
Unrestricted
}
- sealed public class WebBrowserPermission : CodeAccessPermission, IUnrestrictedPermission
+ public sealed class WebBrowserPermission : CodeAccessPermission, IUnrestrictedPermission
{
public WebBrowserPermission() { }
public WebBrowserPermission(PermissionState state) { }
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
- sealed public class WebBrowserPermissionAttribute : CodeAccessSecurityAttribute
+ public sealed class WebBrowserPermissionAttribute : CodeAccessSecurityAttribute
{
public WebBrowserPermissionAttribute(SecurityAction action) : base(action) { }
public override IPermission CreatePermission() { return new WebBrowserPermission(); }
namespace System.Web
{
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false )]
- sealed public class AspNetHostingPermissionAttribute : CodeAccessSecurityAttribute
+ public sealed class AspNetHostingPermissionAttribute : CodeAccessSecurityAttribute
{
public AspNetHostingPermissionAttribute(SecurityAction action) : base(action) { }
public AspNetHostingPermissionLevel Level { get; set; }
// See the LICENSE file in the project root for more information.
//
// Author:
-// Sebastien Pouliot (spouliot@motus.com)
+// Sebastien Pouliot (spouliot@motus.com)
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
// See the LICENSE file in the project root for more information.
//
// Authors:
-// Lawrence Pit (loz@cable.a2000.nl)
-// Sebastien Pouliot <sebastien@ximian.com>
+// Lawrence Pit (loz@cable.a2000.nl)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// Portions (C) 2004 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
internal override bool IsInline => true;
- internal protected virtual SyndicationCategory CreateCategory() => new SyndicationCategory();
+ protected internal virtual SyndicationCategory CreateCategory() => new SyndicationCategory();
}
}
public abstract void WriteTo(XmlWriter writer);
- internal static protected SyndicationCategory CreateCategory(SyndicationFeed feed)
+ protected internal static SyndicationCategory CreateCategory(SyndicationFeed feed)
{
if (feed == null)
{
return GetNonNullValue(feed.CreateCategory(), SR.FeedCreatedNullCategory);
}
- internal static protected SyndicationCategory CreateCategory(SyndicationItem item)
+ protected internal static SyndicationCategory CreateCategory(SyndicationItem item)
{
if (item == null)
{
return GetNonNullValue(item.CreateCategory(), SR.ItemCreatedNullCategory);
}
- internal static protected SyndicationItem CreateItem(SyndicationFeed feed)
+ protected internal static SyndicationItem CreateItem(SyndicationFeed feed)
{
if (feed == null)
{
return GetNonNullValue(feed.CreateItem(), SR.FeedCreatedNullItem);
}
- internal static protected SyndicationLink CreateLink(SyndicationFeed feed)
+ protected internal static SyndicationLink CreateLink(SyndicationFeed feed)
{
if (feed == null)
{
return GetNonNullValue(feed.CreateLink(), SR.FeedCreatedNullPerson);
}
- internal static protected SyndicationLink CreateLink(SyndicationItem item)
+ protected internal static SyndicationLink CreateLink(SyndicationItem item)
{
if (item == null)
{
return GetNonNullValue(item.CreateLink(), SR.ItemCreatedNullPerson);
}
- internal static protected SyndicationPerson CreatePerson(SyndicationFeed feed)
+ protected internal static SyndicationPerson CreatePerson(SyndicationFeed feed)
{
if (feed == null)
{
return GetNonNullValue(feed.CreatePerson(), SR.FeedCreatedNullPerson);
}
- internal static protected SyndicationPerson CreatePerson(SyndicationItem item)
+ protected internal static SyndicationPerson CreatePerson(SyndicationItem item)
{
if (item == null)
{
return GetNonNullValue(item.CreatePerson(), SR.ItemCreatedNullPerson);
}
- internal static protected void LoadElementExtensions(XmlReader reader, SyndicationFeed feed, int maxExtensionSize)
+ protected internal static void LoadElementExtensions(XmlReader reader, SyndicationFeed feed, int maxExtensionSize)
{
if (feed == null)
{
feed.LoadElementExtensions(reader, maxExtensionSize);
}
- internal static protected void LoadElementExtensions(XmlReader reader, SyndicationItem item, int maxExtensionSize)
+ protected internal static void LoadElementExtensions(XmlReader reader, SyndicationItem item, int maxExtensionSize)
{
if (item == null)
{
item.LoadElementExtensions(reader, maxExtensionSize);
}
- internal static protected void LoadElementExtensions(XmlReader reader, SyndicationCategory category, int maxExtensionSize)
+ protected internal static void LoadElementExtensions(XmlReader reader, SyndicationCategory category, int maxExtensionSize)
{
if (category == null)
{
category.LoadElementExtensions(reader, maxExtensionSize);
}
- internal static protected void LoadElementExtensions(XmlReader reader, SyndicationLink link, int maxExtensionSize)
+ protected internal static void LoadElementExtensions(XmlReader reader, SyndicationLink link, int maxExtensionSize)
{
if (link == null)
{
link.LoadElementExtensions(reader, maxExtensionSize);
}
- internal static protected void LoadElementExtensions(XmlReader reader, SyndicationPerson person, int maxExtensionSize)
+ protected internal static void LoadElementExtensions(XmlReader reader, SyndicationPerson person, int maxExtensionSize)
{
if (person == null)
{
person.LoadElementExtensions(reader, maxExtensionSize);
}
- internal static protected bool TryParseAttribute(string name, string ns, string value, SyndicationFeed feed, string version)
+ protected internal static bool TryParseAttribute(string name, string ns, string value, SyndicationFeed feed, string version)
{
if (feed == null)
{
return feed.TryParseAttribute(name, ns, value, version);
}
- internal static protected bool TryParseAttribute(string name, string ns, string value, SyndicationItem item, string version)
+ protected internal static bool TryParseAttribute(string name, string ns, string value, SyndicationItem item, string version)
{
if (item == null)
{
return item.TryParseAttribute(name, ns, value, version);
}
- internal static protected bool TryParseAttribute(string name, string ns, string value, SyndicationCategory category, string version)
+ protected internal static bool TryParseAttribute(string name, string ns, string value, SyndicationCategory category, string version)
{
if (category == null)
{
return category.TryParseAttribute(name, ns, value, version);
}
- internal static protected bool TryParseAttribute(string name, string ns, string value, SyndicationLink link, string version)
+ protected internal static bool TryParseAttribute(string name, string ns, string value, SyndicationLink link, string version)
{
if (link == null)
{
return link.TryParseAttribute(name, ns, value, version);
}
- internal static protected bool TryParseAttribute(string name, string ns, string value, SyndicationPerson person, string version)
+ protected internal static bool TryParseAttribute(string name, string ns, string value, SyndicationPerson person, string version)
{
if (person == null)
{
return person.TryParseAttribute(name, ns, value, version);
}
- internal static protected bool TryParseContent(XmlReader reader, SyndicationItem item, string contentType, string version, out SyndicationContent content)
+ protected internal static bool TryParseContent(XmlReader reader, SyndicationItem item, string contentType, string version, out SyndicationContent content)
{
return item.TryParseContent(reader, contentType, version, out content);
}
- internal static protected bool TryParseElement(XmlReader reader, SyndicationFeed feed, string version)
+ protected internal static bool TryParseElement(XmlReader reader, SyndicationFeed feed, string version)
{
if (feed == null)
{
return feed.TryParseElement(reader, version);
}
- internal static protected bool TryParseElement(XmlReader reader, SyndicationItem item, string version)
+ protected internal static bool TryParseElement(XmlReader reader, SyndicationItem item, string version)
{
if (item == null)
{
return item.TryParseElement(reader, version);
}
- internal static protected bool TryParseElement(XmlReader reader, SyndicationCategory category, string version)
+ protected internal static bool TryParseElement(XmlReader reader, SyndicationCategory category, string version)
{
if (category == null)
{
return category.TryParseElement(reader, version);
}
- internal static protected bool TryParseElement(XmlReader reader, SyndicationLink link, string version)
+ protected internal static bool TryParseElement(XmlReader reader, SyndicationLink link, string version)
{
if (link == null)
{
return link.TryParseElement(reader, version);
}
- internal static protected bool TryParseElement(XmlReader reader, SyndicationPerson person, string version)
+ protected internal static bool TryParseElement(XmlReader reader, SyndicationPerson person, string version)
{
if (person == null)
{
return person.TryParseElement(reader, version);
}
- internal static protected void WriteAttributeExtensions(XmlWriter writer, SyndicationFeed feed, string version)
+ protected internal static void WriteAttributeExtensions(XmlWriter writer, SyndicationFeed feed, string version)
{
if (feed == null)
{
feed.WriteAttributeExtensions(writer, version);
}
- internal static protected void WriteAttributeExtensions(XmlWriter writer, SyndicationItem item, string version)
+ protected internal static void WriteAttributeExtensions(XmlWriter writer, SyndicationItem item, string version)
{
if (item == null)
{
item.WriteAttributeExtensions(writer, version);
}
- internal static protected void WriteAttributeExtensions(XmlWriter writer, SyndicationCategory category, string version)
+ protected internal static void WriteAttributeExtensions(XmlWriter writer, SyndicationCategory category, string version)
{
if (category == null)
{
category.WriteAttributeExtensions(writer, version);
}
- internal static protected void WriteAttributeExtensions(XmlWriter writer, SyndicationLink link, string version)
+ protected internal static void WriteAttributeExtensions(XmlWriter writer, SyndicationLink link, string version)
{
if (link == null)
{
link.WriteAttributeExtensions(writer, version);
}
- internal static protected void WriteAttributeExtensions(XmlWriter writer, SyndicationPerson person, string version)
+ protected internal static void WriteAttributeExtensions(XmlWriter writer, SyndicationPerson person, string version)
{
if (person == null)
{
person.WriteAttributeExtensions(writer, version);
}
- internal static protected void WriteElementExtensions(XmlWriter writer, SyndicationFeed feed, string version)
+ protected internal static void WriteElementExtensions(XmlWriter writer, SyndicationFeed feed, string version)
{
if (feed == null)
{
feed.WriteElementExtensions(writer, version);
}
- internal static protected void WriteElementExtensions(XmlWriter writer, SyndicationItem item, string version)
+ protected internal static void WriteElementExtensions(XmlWriter writer, SyndicationItem item, string version)
{
if (item == null)
{
item.WriteElementExtensions(writer, version);
}
- internal static protected void WriteElementExtensions(XmlWriter writer, SyndicationCategory category, string version)
+ protected internal static void WriteElementExtensions(XmlWriter writer, SyndicationCategory category, string version)
{
if (category == null)
{
category.WriteElementExtensions(writer, version);
}
- internal static protected void WriteElementExtensions(XmlWriter writer, SyndicationLink link, string version)
+ protected internal static void WriteElementExtensions(XmlWriter writer, SyndicationLink link, string version)
{
if (link == null)
{
link.WriteElementExtensions(writer, version);
}
- internal static protected void WriteElementExtensions(XmlWriter writer, SyndicationPerson person, string version)
+ protected internal static void WriteElementExtensions(XmlWriter writer, SyndicationPerson person, string version)
{
if (person == null)
{
person.WriteElementExtensions(writer, version);
}
- internal protected virtual void SetFeed(SyndicationFeed feed)
+ protected internal virtual void SetFeed(SyndicationFeed feed)
{
_feed = feed ?? throw new ArgumentNullException(nameof(feed));
}
public abstract void WriteTo(XmlWriter writer);
- internal protected virtual void SetItem(SyndicationItem item)
+ protected internal virtual void SetItem(SyndicationItem item)
{
_item = item ?? throw new ArgumentNullException(nameof(item));
}
{
XmlDiffAttribute current1 = elem1.FirstAttribute;
XmlDiffAttribute current2 = elem2.FirstAttribute;
- // NodePosition result = 0;
+ // NodePosition result = 0;
int nCompare = 0;
while (current1 != null && current2 != null && nCompare == 0)
{
if (!bEmptyElement)
{
// bool rtn = reader.Read();
- // rtn = reader.Read();
+ // rtn = reader.Read();
reader.Read(); //move to child
ReadChildNodes(elem, reader, pInfo);
}
{
get
{
- if (String.IsNullOrEmpty(_displayName))
+ if (string.IsNullOrEmpty(_displayName))
GenerateNames();
return _displayName;
}
{
get
{
- if (String.IsNullOrEmpty(_name))
+ if (string.IsNullOrEmpty(_name))
GenerateNames();
return _name;
}
{
GetDataBaseHandleWithConnectAccess();
- if (String.IsNullOrEmpty(_name))
+ if (string.IsNullOrEmpty(_name))
{
// Figure out the _name based on the information we have.
// We must either have _displayName or the constructor parameter _eitherName.
- string userGivenName = String.IsNullOrEmpty(_eitherName) ? _displayName : _eitherName;
+ string userGivenName = string.IsNullOrEmpty(_eitherName) ? _displayName : _eitherName;
- if (String.IsNullOrEmpty(userGivenName))
+ if (string.IsNullOrEmpty(userGivenName))
throw new InvalidOperationException(SR.Format(SR.ServiceName, userGivenName, ServiceBase.MaxNameLength.ToString()));
// Try it as a display name
_displayName = result;
_eitherName = null;
}
- else if (String.IsNullOrEmpty(_displayName))
+ else if (string.IsNullOrEmpty(_displayName))
{
// We must have _name
string result = GetServiceDisplayName(_serviceManagerHandle, _name);
if (s_InternalSyncObject == null)
{
object o = new object();
- Interlocked.CompareExchange<Object>(ref s_InternalSyncObject, o, null);
+ Interlocked.CompareExchange<object>(ref s_InternalSyncObject, o, null);
}
return s_InternalSyncObject;
}
if (s_InternalSyncObject == null)
{
object o = new object();
- Interlocked.CompareExchange<Object>(ref s_InternalSyncObject, o, null);
+ Interlocked.CompareExchange<object>(ref s_InternalSyncObject, o, null);
}
return s_InternalSyncObject;
}
if (s_InternalSyncObject == null)
{
object o = new object();
- Interlocked.CompareExchange<Object>(ref s_InternalSyncObject, o, null);
+ Interlocked.CompareExchange<object>(ref s_InternalSyncObject, o, null);
}
return s_InternalSyncObject;
}
if (s_InternalSyncObject == null)
{
object o = new object();
- Interlocked.CompareExchange<Object>(ref s_InternalSyncObject, o, null);
+ Interlocked.CompareExchange<object>(ref s_InternalSyncObject, o, null);
}
return s_InternalSyncObject;
}
byte [] bytes2 = utf8.GetBytes(s2);
byte [] bytes3 = utf8.GetBytes(s3);
- int bytesUsed;
- int charsUsed;
- bool completed;
+ int bytesUsed;
+ int charsUsed;
+ bool completed;
fixed (byte *pBytes1 = bytes1)
fixed (byte *pBytes2 = bytes2)
public static unsafe void ConvertNegativeTest()
{
Decoder decoder = Encoding.UTF8.GetDecoder();
- int bytesUsed;
- int charsUsed;
- bool completed;
+ int bytesUsed;
+ int charsUsed;
+ bool completed;
byte [] bytes = Encoding.UTF8.GetBytes("\u0D800\uDC00");
byte [] bytes = new byte[50];
- int bytesUsed;
- int charsUsed;
- bool completed;
+ int bytesUsed;
+ int charsUsed;
+ bool completed;
fixed (char *pChars1 = s1)
fixed (char *pChars2 = s2)
public static unsafe void ConvertNegativeTest()
{
Encoder encoder = Encoding.UTF8.GetEncoder();
- int bytesUsed;
- int charsUsed;
- bool completed;
+ int bytesUsed;
+ int charsUsed;
+ bool completed;
string chars = "\u0D800\uDC00";
byte [] bytes = new byte[4];
private static int GetScalarValueFromUtf16Slow(char first, char? second, out bool wasSurrogatePair)
{
#if DEBUG
- if (!Char.IsSurrogate(first))
+ if (!char.IsSurrogate(first))
{
Debug.Assert(false, "This case should've been handled by the fast path.");
wasSurrogatePair = false;
private static string GetKnownGoodPercentEncodedValue(int codePoint)
{
// Convert the code point to UTF16, then call Encoding.UTF8.GetBytes, then hex-encode everything
- return string.Concat(_utf8EncodingThrowOnInvalidBytes.GetBytes(Char.ConvertFromUtf32(codePoint)).Select(b => string.Format(CultureInfo.InvariantCulture, "%{0:X2}", b)));
+ return string.Concat(_utf8EncodingThrowOnInvalidBytes.GetBytes(char.ConvertFromUtf32(codePoint)).Select(b => string.Format(CultureInfo.InvariantCulture, "%{0:X2}", b)));
}
private static bool IsSurrogateCodePoint(int codePoint)
/// <typeparamref name="TValue"/> is not compatible with the JSON,
/// or when there is remaining data in the Stream.
/// </exception>
- /// <remarks>Using a <see cref="System.String"/> is not as efficient as using the
+ /// <remarks>Using a <see cref="string"/> is not as efficient as using the
/// UTF-8 methods since the implementation natively uses UTF-8.
/// </remarks>
public static TValue Deserialize<TValue>(string json, JsonSerializerOptions options = null)
/// the <paramref name="returnType"/> is not compatible with the JSON,
/// or when there is remaining data in the Stream.
/// </exception>
- /// <remarks>Using a <see cref="System.String"/> is not as efficient as using the
+ /// <remarks>Using a <see cref="string"/> is not as efficient as using the
/// UTF-8 methods since the implementation natively uses UTF-8.
/// </remarks>
public static object Deserialize(string json, Type returnType, JsonSerializerOptions options = null)
public static partial class JsonSerializer
{
/// <summary>
- /// Convert the provided value into a <see cref="System.Byte"/> array.
+ /// Convert the provided value into a <see cref="byte"/> array.
/// </summary>
/// <returns>A UTF-8 representation of the value.</returns>
/// <param name="value">The value to convert.</param>
}
/// <summary>
- /// Convert the provided value into a <see cref="System.Byte"/> array.
+ /// Convert the provided value into a <see cref="byte"/> array.
/// </summary>
/// <returns>A UTF-8 representation of the value.</returns>
/// <param name="value">The value to convert.</param>
public static partial class JsonSerializer
{
/// <summary>
- /// Convert the provided value into a <see cref="System.String"/>.
+ /// Convert the provided value into a <see cref="string"/>.
/// </summary>
- /// <returns>A <see cref="System.String"/> representation of the value.</returns>
+ /// <returns>A <see cref="string"/> representation of the value.</returns>
/// <param name="value">The value to convert.</param>
/// <param name="options">Options to control the conversion behavior.</param>
- /// <remarks>Using a <see cref="System.String"/> is not as efficient as using UTF-8
+ /// <remarks>Using a <see cref="string"/> is not as efficient as using UTF-8
/// encoding since the implementation internally uses UTF-8. See also <see cref="SerializeToUtf8Bytes"/>
/// and <see cref="SerializeAsync"/>.
/// </remarks>
}
/// <summary>
- /// Convert the provided value into a <see cref="System.String"/>.
+ /// Convert the provided value into a <see cref="string"/>.
/// </summary>
- /// <returns>A <see cref="System.String"/> representation of the value.</returns>
+ /// <returns>A <see cref="string"/> representation of the value.</returns>
/// <param name="value">The value to convert.</param>
/// <param name="type">The type of the <paramref name="value"/> to convert.</param>
/// <param name="options">Options to control the conversion behavior.</param>
- /// <remarks>Using a <see cref="System.String"/> is not as efficient as using UTF-8
+ /// <remarks>Using a <see cref="string"/> is not as efficient as using UTF-8
/// encoding since the implementation internally uses UTF-8. See also <see cref="SerializeToUtf8Bytes"/>
/// and <see cref="SerializeAsync"/>.
/// </remarks>
/// <param name="bytesConsumed">On exit, contains the number of bytes that were consumed from the <paramref name="utf16Source"/>.</param>
/// <param name="bytesWritten">On exit, contains the number of bytes written to <paramref name="utf8Destination"/></param>
/// <returns>A <see cref="OperationStatus"/> value representing the state of the conversion.</returns>
- public unsafe static OperationStatus ToUtf8(ReadOnlySpan<byte> utf16Source, Span<byte> utf8Destination, out int bytesConsumed, out int bytesWritten)
+ public static unsafe OperationStatus ToUtf8(ReadOnlySpan<byte> utf16Source, Span<byte> utf8Destination, out int bytesConsumed, out int bytesWritten)
{
//
//
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private unsafe static int PtrDiff(char* a, char* b)
+ private static unsafe int PtrDiff(char* a, char* b)
{
return (int)(((uint)((byte*)a - (byte*)b)) >> 1);
}
// byte* flavor just for parity
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private unsafe static int PtrDiff(byte* a, byte* b)
+ private static unsafe int PtrDiff(byte* a, byte* b)
{
return (int)(a - b);
}
prevat = match.Index + match.Length;
string result = evaluator(match);
if (!string.IsNullOrEmpty(result))
- vsb.Append(result);
+ vsb.Append(result);
if (--count == 0)
break;
public int OffsetHigh { get { throw null; } set { } }
public int OffsetLow { get { throw null; } set { } }
[System.CLSCompliantAttribute(false)]
- public unsafe static void Free(System.Threading.NativeOverlapped* nativeOverlappedPtr) { }
+ public static unsafe void Free(System.Threading.NativeOverlapped* nativeOverlappedPtr) { }
[System.CLSCompliantAttribute(false)]
[System.ObsoleteAttribute("This method is not safe. Use Pack (iocb, userData) instead. https://go.microsoft.com/fwlink/?linkid=14202")]
public unsafe System.Threading.NativeOverlapped* Pack(System.Threading.IOCompletionCallback? iocb) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe System.Threading.NativeOverlapped* Pack(System.Threading.IOCompletionCallback? iocb, object? userData) { throw null; }
[System.CLSCompliantAttribute(false)]
- public unsafe static System.Threading.Overlapped Unpack(System.Threading.NativeOverlapped* nativeOverlappedPtr) { throw null; }
+ public static unsafe System.Threading.Overlapped Unpack(System.Threading.NativeOverlapped* nativeOverlappedPtr) { throw null; }
[System.CLSCompliantAttribute(false)]
[System.ObsoleteAttribute("This method is not safe. Use UnsafePack (iocb, userData) instead. https://go.microsoft.com/fwlink/?linkid=14202")]
public unsafe System.Threading.NativeOverlapped* UnsafePack(System.Threading.IOCompletionCallback? iocb) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe void FreeNativeOverlapped(System.Threading.NativeOverlapped* overlapped) { }
[System.CLSCompliantAttribute(false)]
- public unsafe static object? GetNativeOverlappedState(System.Threading.NativeOverlapped* overlapped) { throw null; }
+ public static unsafe object? GetNativeOverlappedState(System.Threading.NativeOverlapped* overlapped) { throw null; }
}
}
public class AsyncResult : IAsyncResult
{
- public object AsyncState
- {
- get { throw new NotImplementedException(); }
- }
+ public object AsyncState
+ {
+ get { throw new NotImplementedException(); }
+ }
- public System.Threading.WaitHandle AsyncWaitHandle
- {
- get { throw new NotImplementedException(); }
- }
+ public System.Threading.WaitHandle AsyncWaitHandle
+ {
+ get { throw new NotImplementedException(); }
+ }
- public bool CompletedSynchronously
- {
- get { throw new NotImplementedException(); }
- }
+ public bool CompletedSynchronously
+ {
+ get { throw new NotImplementedException(); }
+ }
- public bool IsCompleted
- {
- get { throw new NotImplementedException(); }
- }
+ public bool IsCompleted
+ {
+ get { throw new NotImplementedException(); }
+ }
}
FileAttributes dwFlagsAndAttributes, IntPtr hTemplateFile);
#else
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
- internal static unsafe extern Win32Handle CreateFile2(string lpFileName,
+ internal static extern unsafe Win32Handle CreateFile2(string lpFileName,
FileAccess dwDesiredAccess, FileShare dwShareMode,
CreationDisposition dwCreationDisposition, CREATEFILE2_EXTENDED_PARAMETERS* pCreateExParams);
// Fast path check for cancellation
if (cancellationToken.IsCancellationRequested)
- return Common.CreateTaskFromCancellation<Boolean>(cancellationToken);
+ return Common.CreateTaskFromCancellation<bool>(cancellationToken);
SendAsyncSource<TInput> source;
{
// If the target throws from OfferMessage, return a faulted task
Common.StoreDataflowMessageValueIntoExceptionData(exc, item);
- return Common.CreateTaskFromException<Boolean>(exc);
+ return Common.CreateTaskFromException<bool>(exc);
}
Debug.Assert(source != null, "The SendAsyncSource instance must have been constructed.");
/// </returns>
/// <exception cref="System.ArgumentNullException">The <paramref name="source"/> is null (Nothing in Visual Basic).</exception>
/// <exception cref="System.ArgumentOutOfRangeException">
- /// timeout is a negative number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than <see cref="System.Int32.MaxValue"/>.
+ /// timeout is a negative number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than <see cref="int.MaxValue"/>.
/// </exception>
public static Task<TOutput> ReceiveAsync<TOutput>(
this ISourceBlock<TOutput> source, TimeSpan timeout)
/// </returns>
/// <exception cref="System.ArgumentNullException">The <paramref name="source"/> is null (Nothing in Visual Basic).</exception>
/// <exception cref="System.ArgumentOutOfRangeException">
- /// timeout is a negative number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than <see cref="System.Int32.MaxValue"/>.
+ /// timeout is a negative number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than <see cref="int.MaxValue"/>.
/// </exception>
public static Task<TOutput> ReceiveAsync<TOutput>(
this ISourceBlock<TOutput> source, TimeSpan timeout, CancellationToken cancellationToken)
/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.</param>
/// <returns>The received item.</returns>
/// <exception cref="System.ArgumentOutOfRangeException">
- /// timeout is a negative number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than <see cref="System.Int32.MaxValue"/>.
+ /// timeout is a negative number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than <see cref="int.MaxValue"/>.
/// </exception>
/// <exception cref="System.ArgumentNullException">The <paramref name="source"/> is null (Nothing in Visual Basic).</exception>
/// <exception cref="System.InvalidOperationException">No item could be received from the source.</exception>
/// <returns>The received item.</returns>
/// <exception cref="System.ArgumentNullException">The <paramref name="source"/> is null (Nothing in Visual Basic).</exception>
/// <exception cref="System.ArgumentOutOfRangeException">
- /// timeout is a negative number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than <see cref="System.Int32.MaxValue"/>.
+ /// timeout is a negative number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than <see cref="int.MaxValue"/>.
/// </exception>
/// <exception cref="System.InvalidOperationException">No item could be received from the source.</exception>
/// <exception cref="System.TimeoutException">The specified timeout expired before an item was received from the source.</exception>
// Early cancellation check and bail out
if (dataflowBlockOptions.CancellationToken.IsCancellationRequested)
- return Common.CreateTaskFromCancellation<Int32>(dataflowBlockOptions.CancellationToken);
+ return Common.CreateTaskFromCancellation<int>(dataflowBlockOptions.CancellationToken);
// Fast path: if any of the sources already has data available that can be received immediately.
Task<int> resultTask;
// By using these same tasks, we're a bit more robust against disposals,
// in that such a disposed task's ((IAsyncResult)task).AsyncWaitHandle
// is still valid.
- var atmb = System.Runtime.CompilerServices.AsyncTaskMethodBuilder<Boolean>.Create();
+ var atmb = System.Runtime.CompilerServices.AsyncTaskMethodBuilder<bool>.Create();
atmb.SetResult(value);
return atmb.Task; // must be accessed after SetResult to get the cached task
}
// Hold list of verification
private Queue<Action<ParallelLoopResult?>> _verifications = new Queue<Action<ParallelLoopResult?>>();
- private volatile bool _isStopped = false; // Flag to indicate that we called Stop() on the Parallel state
- private long? _lowestBreakIter = null; // LowestBreakIteration value holder, null indicates that Break hasn't been called
- private volatile bool _isExceptional = false; // Flag to indicate exception thrown in the test
+ private volatile bool _isStopped = false; // Flag to indicate that we called Stop() on the Parallel state
+ private long? _lowestBreakIter = null; // LowestBreakIteration value holder, null indicates that Break hasn't been called
+ private volatile bool _isExceptional = false; // Flag to indicate exception thrown in the test
private int _iterCount = 0; // test own counter for certain scenario, so the test can change behaviour after certain number of loop iteration
//public int SchedulerID
//{
- // get;
- // set;
+ // get;
+ // set;
//}
protected override IEnumerable<Task> GetScheduledTasks() { return null; }
public static bool SetMaxThreads(int workerThreads, int completionPortThreads) { throw null; }
public static bool SetMinThreads(int workerThreads, int completionPortThreads) { throw null; }
[System.CLSCompliantAttribute(false)]
- public unsafe static bool UnsafeQueueNativeOverlapped(System.Threading.NativeOverlapped* overlapped) { throw null; }
+ public static unsafe bool UnsafeQueueNativeOverlapped(System.Threading.NativeOverlapped* overlapped) { throw null; }
public static bool UnsafeQueueUserWorkItem(System.Threading.IThreadPoolWorkItem callBack, bool preferLocal) { throw null; }
public static bool UnsafeQueueUserWorkItem(System.Threading.WaitCallback callBack, object? state) { throw null; }
public static bool UnsafeQueueUserWorkItem<TState>(System.Action<TState> callBack, TState state, bool preferLocal) { throw null; }
/// </summary>
/// <param name="participantCount">The number of participating threads.</param>
/// <exception cref="ArgumentOutOfRangeException"> <paramref name="participantCount"/> is less than 0
- /// or greater than <see cref="System.Int16.MaxValue"/>.</exception>
+ /// or greater than <see cref="short.MaxValue"/>.</exception>
public Barrier(int participantCount)
: this(participantCount, null)
{
/// <param name="postPhaseAction">The <see cref="System.Action{Barrier}"/> to be executed after each
/// phase.</param>
/// <exception cref="System.ArgumentOutOfRangeException"> <paramref name="participantCount"/> is less than 0
- /// or greater than <see cref="System.Int32.MaxValue"/>.</exception>
+ /// or greater than <see cref="int.MaxValue"/>.</exception>
/// <remarks>
/// The <paramref name="postPhaseAction"/> delegate will be executed after
/// all participants have arrived at the barrier in one phase. The participants
/// participate.</returns>
/// <exception cref="System.InvalidOperationException">
/// Adding a participant would cause the barrier's participant count to
- /// exceed <see cref="System.Int16.MaxValue"/>.
+ /// exceed <see cref="short.MaxValue"/>.
/// </exception>
/// <exception cref="System.InvalidOperationException">
/// The method was invoked from within a post-phase action.
/// <exception cref="System.ArgumentOutOfRangeException"><paramref name="participantCount"/> is less than
/// 0.</exception>
/// <exception cref="System.ArgumentOutOfRangeException">Adding <paramref name="participantCount"/> participants would cause the
- /// barrier's participant count to exceed <see cref="System.Int16.MaxValue"/>.</exception>
+ /// barrier's participant count to exceed <see cref="short.MaxValue"/>.</exception>
/// <exception cref="System.InvalidOperationException">
/// The method was invoked from within a post-phase action.
/// </exception>
/// <returns>true if all other participants reached the barrier; otherwise, false.</returns>
/// <exception cref="System.ArgumentOutOfRangeException"><paramref name="timeout"/>is a negative number
/// other than -1 milliseconds, which represents an infinite time-out, or it is greater than
- /// <see cref="System.Int32.MaxValue"/>.</exception>
+ /// <see cref="int.MaxValue"/>.</exception>
/// <exception cref="System.InvalidOperationException">
/// The method was invoked from within a post-phase action, the barrier currently has 0 participants,
/// or the barrier is being used by more threads than are registered as participants.
/// <exception cref="System.InvalidOperationException">The current instance is already
/// set.</exception>
/// <exception cref="System.InvalidOperationException"><see cref="CurrentCount"/> is equal to <see
- /// cref="System.Int32.MaxValue"/>.</exception>
+ /// cref="int.MaxValue"/>.</exception>
/// <exception cref="System.ObjectDisposedException">
/// The current instance has already been disposed.
/// </exception>
/// <returns>true if the increment succeeded; otherwise, false. If <see cref="CurrentCount"/> is
/// already at zero. this will return false.</returns>
/// <exception cref="System.InvalidOperationException"><see cref="CurrentCount"/> is equal to <see
- /// cref="System.Int32.MaxValue"/>.</exception>
+ /// cref="int.MaxValue"/>.</exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
public bool TryAddCount()
/// <exception cref="System.InvalidOperationException">The current instance is already
/// set.</exception>
/// <exception cref="System.InvalidOperationException"><see cref="CurrentCount"/> is equal to <see
- /// cref="System.Int32.MaxValue"/>.</exception>
+ /// cref="int.MaxValue"/>.</exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
public void AddCount(int signalCount)
/// <exception cref="System.InvalidOperationException">The current instance is already
/// set.</exception>
/// <exception cref="System.InvalidOperationException"><see cref="CurrentCount"/> is equal to <see
- /// cref="System.Int32.MaxValue"/>.</exception>
+ /// cref="int.MaxValue"/>.</exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
public bool TryAddCount(int signalCount)
/// false.</returns>
/// <exception cref="System.ArgumentOutOfRangeException"><paramref name="timeout"/> is a negative
/// number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater
- /// than <see cref="System.Int32.MaxValue"/>.</exception>
+ /// than <see cref="int.MaxValue"/>.</exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
public bool Wait(TimeSpan timeout)
/// false.</returns>
/// <exception cref="System.ArgumentOutOfRangeException"><paramref name="timeout"/> is a negative
/// number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater
- /// than <see cref="System.Int32.MaxValue"/>.</exception>
+ /// than <see cref="int.MaxValue"/>.</exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
/// <exception cref="System.OperationCanceledException"><paramref name="cancellationToken"/> has
irm.Value = 2;
/* Not completing this..
- scope.Complete ();*/
+ scope.Complete ();*/
}
irm.Check(0, 0, 0, 1, 0, 0, 0, "irm");
}
/* We support only 1 durable with 2PC
- * On .net, this becomes a distributed transaction
- */
+ * On .net, this becomes a distributed transaction
+ */
[ActiveIssue(13532)] //Distributed transactions are not supported.
[Fact]
public void Vol0_Dur1_2PC()
IntResourceManager irm = new IntResourceManager(1);
/* Durable resource enlisted with a IEnlistedNotification
- * object
- */
+ * object
+ */
irm.Type = ResourceManagerType.Durable;
using (TransactionScope scope = new TransactionScope())
IntResourceManager irm = new IntResourceManager(1);
/* Durable resource enlisted with a IEnlistedNotification
- * object
- */
+ * object
+ */
irm.Type = ResourceManagerType.Durable;
irm.FailSPC = true;
irm.UseSingle = true;
}
/* >1vol + 1 durable
- * Durable fails SPC
- */
+ * Durable fails SPC
+ */
[Fact]
public void Vol2_Dur1_Fail1()
{
irm[i].UseSingle = true;
/* Durable RM irm[0] does Abort on SPC, so
- * all volatile RMs get Rollback */
+ * all volatile RMs get Rollback */
Assert.Throws<TransactionAbortedException>(() =>
{
using (TransactionScope scope = new TransactionScope())
}
/* >1vol + 1 durable
- * Volatile fails Prepare
- */
+ * Volatile fails Prepare
+ */
[Fact]
public void Vol2_Dur1_Fail3()
{
irm[i].UseSingle = true;
/* Durable RM irm[2] does on SPC, so
- * all volatile RMs get Rollback */
+ * all volatile RMs get Rollback */
Assert.Throws<TransactionAbortedException>(() =>
{
using (TransactionScope scope = new TransactionScope())
irm[i].UseSingle = true;
/* Durable RM irm[2] does on SPC, so
- * all volatile RMs get Rollback */
+ * all volatile RMs get Rollback */
TransactionAbortedException e = Assert.Throws<TransactionAbortedException>(() =>
{
using (TransactionScope scope = new TransactionScope())
irm[i].UseSingle = true;
/* Durable RM irm[2] does on SPC, so
- * all volatile RMs get Rollback */
+ * all volatile RMs get Rollback */
using (TransactionScope scope = new TransactionScope())
{
#region Others
/* >1vol
- * > 1 durable, On .net this becomes a distributed transaction
- * We don't support this in mono yet.
- */
+ * > 1 durable, On .net this becomes a distributed transaction
+ * We don't support this in mono yet.
+ */
[ActiveIssue(13532)] //Distributed transactions are not supported.
[Fact]
public void Vol0_Dur2()
Assert.Equal(TransactionStatus.Active, Transaction.Current.TransactionInformation.Status);
/* Not completing outer scope
- scope.Complete (); */
+ scope.Complete (); */
}
Assert.Null(Transaction.Current);
{
irm2.Value = 20;
/* Not completing
- scope2.Complete();*/
+ scope2.Complete();*/
}
/* irm2, rolled back*/
{
irm.Value = 4;
/* Not completing this, so the transaction will
- * get aborted
- scope2.Complete (); */
+ * get aborted
+ scope2.Complete (); */
}
using (TransactionScope scope3 = new TransactionScope(TransactionScopeOption.RequiresNew))
{
/* Using RequiresNew here, so outer transaction
- * being aborted doesn't matter
- */
+ * being aborted doesn't matter
+ */
scope3.Complete();
}
}
irm3.Value = 24;
/* Make second RM fail to prepare, this should throw
- * TransactionAbortedException when the scope ends
- */
+ * TransactionAbortedException when the scope ends
+ */
irm2.FailPrepare = true;
scope.Complete();
}
irm3.Value = 24;
/* irm2 won't call Prepared or ForceRollback in
- * its Prepare (), so TransactionManager will timeout
- * waiting for it
- */
+ * its Prepare (), so TransactionManager will timeout
+ * waiting for it
+ */
irm2.IgnorePrepare = true;
scope.Complete();
}
Transaction oldTransaction = Transaction.Current;
/* Not setting ambient transaction
- Transaction.Current = ct;
- */
+ Transaction.Current = ct;
+ */
IntResourceManager irm = new IntResourceManager(1);
Transaction oldTransaction = Transaction.Current;
/* Not setting ambient transaction
- Transaction.Current = ct;
- */
+ Transaction.Current = ct;
+ */
IntResourceManager irm = new IntResourceManager(1);
irm.Value = 2;
/* Not completing this scope
- scope.Complete (); */
+ scope.Complete (); */
}
Assert.Equal(oldTransaction, Transaction.Current);
}
[Fact]
- public unsafe static void MemoryOfByte_WithUtf8String_Pin()
+ public static unsafe void MemoryOfByte_WithUtf8String_Pin()
{
Utf8String theString = u8("Hello");
ReadOnlyMemory<byte> rom = theString.AsMemoryBytes();
}
[Fact]
- public unsafe static void MemoryOfChar8_WithUtf8String_Pin()
+ public static unsafe void MemoryOfChar8_WithUtf8String_Pin()
{
Utf8String theString = u8("Hello");
ReadOnlyMemory<Char8> rom = theString.AsMemory();
}
[Fact]
- public unsafe static void ReadOnlyMemoryOfByte_WithUtf8String_Pin()
+ public static unsafe void ReadOnlyMemoryOfByte_WithUtf8String_Pin()
{
Utf8String theString = u8("Hello");
ReadOnlyMemory<byte> rom = theString.AsMemoryBytes();
}
[Fact]
- public unsafe static void ReadOnlyMemoryOfChar8_WithUtf8String_Pin()
+ public static unsafe void ReadOnlyMemoryOfChar8_WithUtf8String_Pin()
{
Utf8String theString = u8("Hello");
ReadOnlyMemory<Char8> rom = theString.AsMemory();
/// <summary>
/// Mimics returning a literal <see cref="Utf8String"/> instance.
/// </summary>
- public unsafe static Utf8String u8(string str)
+ public static unsafe Utf8String u8(string str)
{
if (str is null)
{
// System.Web.HttpUtilityTest.cs - Unit tests for System.Web.HttpUtility
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//