Asserts not provided by Xunit are provided by an AssertExtensions class.
Tests that reference System.Private.Corelib directly will use a polyfill implementation based off the old CoreCLRTestLibrary asserts.
All assert methods provided by CoreCLRTestLibrary have been changed to follow Xunit conventions.
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+// This file is used to provide some basic Assert functionality for assemblies that directly reference System.Private.CoreLib
+// and not the ref pack.
+
+// Note: Exception messages call ToString instead of Name to avoid MissingMetadataException when just outputting basic info
+
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Xunit
+{
+ /// <summary>
+ /// A collection of helper classes to test various conditions within
+ /// unit tests. If the condition being tested is not met, an exception
+ /// is thrown.
+ /// </summary>
+ public static class Assert
+ {
+ /// <summary>
+ /// Asserts that the given delegate throws an <see cref="Exception"/> of type <typeparam name="T" />.
+ /// </summary>
+ /// <param name="action">
+ /// The delagate of type <see cref="Action"/> to execute.
+ /// </param>
+ /// <param name="message">
+ /// A <see cref="String"/> containing additional information for when the assertion fails.
+ /// </param>
+ /// <returns>
+ /// The thrown <see cref="Exception"/>.
+ /// </returns>
+ /// <exception cref="AssertFailedException">
+ /// <see cref="Exception"/> of type <typeparam name="T"/> was not thrown.
+ /// </exception>
+ public static T Throws<T>(Action action) where T : Exception
+ {
+ Exception exception = RunWithCatch(action);
+
+ if (exception == null)
+ Assert.True(false, $"Expected '{typeof(T)}' to be thrown.");
+
+ if (exception is not T)
+ Assert.True(false, $"Expected '{typeof(T)}' to be thrown, however '{exception.GetType()}' was thrown.");
+
+ return (T)exception;
+ }
+
+ /// <summary>
+ /// Tests whether the specified condition is true and throws an exception
+ /// if the condition is false.
+ /// </summary>
+ /// <param name="condition">The condition the test expects to be true.</param>
+ /// <param name="message">
+ /// The message to include in the exception when <paramref name="condition"/>
+ /// is false. The message is shown in test results.
+ /// </param>
+ /// <exception cref="AssertFailedException">
+ /// Thrown if <paramref name="condition"/> is false.
+ /// </exception>
+ public static void True(bool condition, string message = "")
+ {
+ if (!condition)
+ {
+ Assert.HandleFail("Assert.True", message);
+ }
+ }
+
+ /// <summary>
+ /// Tests whether the specified condition is false and throws an exception
+ /// if the condition is true.
+ /// </summary>
+ /// <param name="condition">The condition the test expects to be false.</param>
+ /// <param name="message">
+ /// The message to include in the exception when <paramref name="condition"/>
+ /// is true. The message is shown in test results.
+ /// </param>
+ /// <exception cref="AssertFailedException">
+ /// Thrown if <paramref name="condition"/> is true.
+ /// </exception>
+ public static void False(bool condition, string message = "")
+ {
+ if (condition)
+ {
+ Assert.HandleFail("Assert.False", message);
+ }
+ }
+
+ /// <summary>
+ /// Tests whether the specified object is null and throws an exception
+ /// if it is not.
+ /// </summary>
+ /// <param name="value">The object the test expects to be null.</param>
+ /// <param name="message">
+ /// The message to include in the exception when <paramref name="value"/>
+ /// is not null. The message is shown in test results.
+ /// </param>
+ /// <exception cref="AssertFailedException">
+ /// Thrown if <paramref name="value"/> is not null.
+ /// </exception>
+ public static void Null(object value)
+ {
+ if (value != null)
+ {
+ Assert.HandleFail("Assert.Null", "");
+ }
+ }
+
+ /// <summary>
+ /// Tests whether the specified object is non-null and throws an exception
+ /// if it is null.
+ /// </summary>
+ /// <param name="value">The object the test expects not to be null.</param>
+ /// <param name="message">
+ /// The message to include in the exception when <paramref name="value"/>
+ /// is null. The message is shown in test results.
+ /// </param>
+ /// <exception cref="AssertFailedException">
+ /// Thrown if <paramref name="value"/> is null.
+ /// </exception>
+ public static void NotNull(object value)
+ {
+ if (value == null)
+ {
+ Assert.HandleFail("Assert.NotNull", "");
+ }
+ }
+
+ /// <summary>
+ /// Tests whether the expected object is equal to the actual object and
+ /// throws an exception if it is not.
+ /// </summary>
+ /// <param name="notExpected">Expected object.</param>
+ /// <param name="actual">Actual object.</param>
+ /// <param name="message">Message to display upon failure.</param>
+ public static void Equal<T>(T expected, T actual)
+ {
+ if (!Object.Equals(expected, actual))
+ {
+ Assert.HandleFail("Assert.Equal", "");
+ }
+ }
+
+ /// <summary>
+ /// Tests whether the expected object is equal to the actual object and
+ /// throws an exception if it is not.
+ /// </summary>
+ /// <param name="notExpected">Expected object.</param>
+ /// <param name="actual">Actual object.</param>
+ /// <param name="message">Message to display upon failure.</param>
+ public static void Same(object expected, object actual)
+ {
+ const string EXPECTED_MSG = @"Expected: [{1}]. Actual: [{2}]. {0}";
+
+ if (!Object.ReferenceEquals(expected, actual))
+ {
+ Assert.HandleFail("Assert.Same", "");
+ }
+ }
+
+ /// <summary>
+ /// Tests whether the expected object is equal to the actual object and
+ /// throws an exception if it is not.
+ /// </summary>
+ /// <param name="notExpected">Expected object.</param>
+ /// <param name="actual">Actual object.</param>
+ /// <param name="message">Message to display upon failure.</param>
+ public static void Equal<T>(T expected, T actual, string format, params Object[] args)
+ {
+ Equal<T>(expected, actual);
+ }
+
+ /// <summary>
+ /// Tests whether the expected object is equal to the actual object and
+ /// throws an exception if it is not.
+ /// </summary>
+ /// </summary>
+ /// <param name="notExpected">Expected object that we do not want it to be.</param>
+ /// <param name="actual">Actual object.</param>
+ /// <param name="message">Message to display upon failure.</param>
+ public static void NotEqual<T>(T notExpected, T actual)
+ {
+ if (Object.Equals(notExpected, actual))
+ {
+ Assert.HandleFail("Assert.NotEqual", "");
+ }
+ }
+
+ /// <summary>
+ /// Helper function that creates and throws an exception.
+ /// </summary>
+ /// <param name="assertionName">name of the assertion throwing an exception.</param>
+ /// <param name="message">message describing conditions for assertion failure.</param>
+ /// <param name="parameters">The parameters.</param>=
+ internal static void HandleFail(string assertionName, string message)
+ {
+ throw new XunitException(assertionName + ": " + message);
+ }
+
+
+ [Obsolete("Did you mean to call Assert.Equal()")]
+ public static new bool Equals(Object o1, Object o2)
+ {
+ Assert.True(false, "Don't call this.");
+ throw new Exception();
+ }
+
+ private static Exception RunWithCatch(Action action)
+ {
+ try
+ {
+ action();
+ return null;
+ }
+ catch (Exception ex)
+ {
+ return ex;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Exception raised by the Assert on Fail
+ /// </summary>
+ public class XunitException : Exception
+ {
+ public XunitException(string message)
+ : base(message)
+ {
+ }
+
+ public XunitException()
+ : base()
+ {
+ }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+// Note: Exception messages call ToString instead of Name to avoid MissingMetadataException when just outputting basic info
+
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Xunit
+{
+ public static class AssertExtensions
+ {
+ /// <summary>
+ /// Asserts that the given delegate throws an <see cref="ArgumentException"/> with the given parameter name.
+ /// </summary>
+ /// <param name="action">
+ /// The delagate of type <see cref="Action"/> to execute.
+ /// </param>
+ /// <param name="message">
+ /// A <see cref="String"/> containing additional information for when the assertion fails.
+ /// </param>
+ /// <param name="parameterName">
+ /// A <see cref="String"/> containing the parameter of name to check, <see langword="null"/> to skip parameter validation.
+ /// </param>
+ /// <returns>
+ /// The thrown <see cref="ArgumentException"/>.
+ /// </returns>
+ /// <exception cref="AssertFailedException">
+ /// <see cref="Exception"/> of type <see cref="ArgumentException"/> was not thrown.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// <see cref="ArgumentException.ParamName"/> is not equal to <paramref name="parameterName"/> .
+ /// </exception>
+ public static ArgumentException ThrowsArgumentException(string parameterName, Action action)
+ {
+ return ThrowsArgumentException<ArgumentException>(parameterName, action);
+ }
+
+ /// <summary>
+ /// Asserts that the given delegate throws an <see cref="ArgumentException"/> of type <typeparamref name="T"/> with the given parameter name.
+ /// </summary>
+ /// <param name="action">
+ /// The delagate of type <see cref="Action"/> to execute.
+ /// </param>
+ /// <param name="message">
+ /// A <see cref="String"/> containing additional information for when the assertion fails.
+ /// </param>
+ /// <param name="parameterName">
+ /// A <see cref="String"/> containing the parameter of name to check, <see langword="null"/> to skip parameter validation.
+ /// </param>
+ /// <returns>
+ /// The thrown <see cref="Exception"/>.
+ /// </returns>
+ /// <exception cref="AssertFailedException">
+ /// <see cref="Exception"/> of type <typeparam name="T"/> was not thrown.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// <see cref="ArgumentException.ParamName"/> is not equal to <paramref name="parameterName"/> .
+ /// </exception>
+ public static T ThrowsArgumentException<T>(string parameterName, Action action)
+ where T : ArgumentException
+ {
+ T exception = Assert.Throws<T>(action);
+
+#if DEBUG
+ // ParamName's not available on ret builds
+ if (parameterName != null)
+ Assert.Equal(parameterName, exception.ParamName);
+#endif
+
+ return exception;
+ }
+
+ /// <summary>
+ /// Asserts that the given async delegate throws an <see cref="Exception"/> of type <typeparam name="T" /> and <see cref="Exception.InnerException"/>
+ /// returns an <see cref="Exception"/> of type <typeparam name="TInner" />.
+ /// </summary>
+ /// <param name="action">
+ /// The delagate of type <see cref="Action"/> to execute.
+ /// </param>
+ /// <param name="message">
+ /// A <see cref="String"/> containing additional information for when the assertion fails.
+ /// </param>
+ /// <param name="options">
+ /// Specifies whether <see cref="Assert.Throws{T}"/> should require an exact type match when comparing the expected exception type with the thrown exception. The default is <see cref="AssertThrowsOptions.None"/>.
+ /// </param>
+ /// <returns>
+ /// The thrown inner <see cref="Exception"/>.
+ /// </returns>
+ /// <exception cref="AssertFailedException">
+ /// <see cref="Exception"/> of type <typeparam name="T"/> was not thrown.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// <see cref="Exception.InnerException"/> is not of type <typeparam name="TInner"/>.
+ /// </exception>
+ public static TInner ThrowsWithInnerException<T, TInner>(Action action)
+ where T : Exception
+ where TInner : Exception
+ {
+ T outerException = Assert.Throws<T>(action);
+
+ if (outerException.InnerException == null)
+ Assert.True(false, string.Format("Expected '{0}.InnerException' to be '{1}', however it is null.", typeof(T), typeof(TInner)));
+
+ if (outerException.InnerException is not TInner)
+ Assert.True(false, string.Format("Expected '{0}.InnerException', to be '{1}', however, '{2}' is.", typeof(T), typeof(TInner), outerException.InnerException.GetType()));
+
+ return (TInner)outerException.InnerException;
+ }
+
+
+ /// <summary>
+ /// Tests whether the two lists are the same length and contain the same objects (using Object.Equals()) in the same order and
+ /// throws an exception if it is not.
+ /// </summary>
+ /// <param name="expected">Expected list.</param>
+ /// <param name="actual">Actual list.</param>
+ /// <param name="message">Message to display upon failure.</param>
+ public static void CollectionEqual<T>(T[] expected, T[] actual)
+ {
+ Assert.Equal(expected.Length, actual.Length);
+
+ for (int i = 0; i < expected.Length; i++)
+ Assert.Equal<T>(expected[i], actual[i]);
+ }
+
+ /// <summary>
+ /// Tests whether the two enumerables are the same length and contain the same objects (using Object.Equals()) in the same order and
+ /// throws an exception if it is not.
+ /// </summary>
+ /// <param name="expected">Expected enumerables.</param>
+ /// <param name="actual">Actual enumerables.</param>
+ /// <param name="message">Message to display upon failure.</param>
+ public static void CollectionEqual<T>(IEnumerable<T> expected, IEnumerable<T> actual)
+ {
+ CollectionEqual(CopyToArray(expected), CopyToArray(actual));
+ }
+
+ /// <summary>
+ /// Iterates through an IEnumerable to generate an array of elements. The rational for using this instead of
+ /// System.Linq.ToArray is that this will not require a dependency on System.Linq.dll
+ /// </summary>
+ private static T[] CopyToArray<T>(IEnumerable<T> source)
+ {
+ T[] items = new T[4];
+ int count = 0;
+
+ if (source == null)
+ return null;
+
+ foreach (var item in source)
+ {
+ if (items.Length == count)
+ {
+ var newItems = new T[checked(count * 2)];
+ Array.Copy(items, 0, newItems, 0, count);
+ items = newItems;
+ }
+
+ items[count] = item;
+ count++;
+ }
+
+ if (items.Length == count)
+ return items;
+
+ var finalItems = new T[count];
+ Array.Copy(items, 0, finalItems, 0, count);
+ return finalItems;
+ }
+ }
+}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-// Note: Exception messages call ToString instead of Name to avoid MissingMetadataException when just outputting basic info
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace TestLibrary
-{
- /// <summary>
- /// A collection of helper classes to test various conditions within
- /// unit tests. If the condition being tested is not met, an exception
- /// is thrown.
- /// </summary>
- public static class Assert
- {
- /// <summary>
- /// Asserts that the given delegate throws an <see cref="ArgumentNullException"/> with the given parameter name.
- /// </summary>
- /// <param name="action">
- /// The delagate of type <see cref="Action"/> to execute.
- /// </param>
- /// <param name="message">
- /// A <see cref="String"/> containing additional information for when the assertion fails.
- /// </param>
- /// <param name="parameterName">
- /// A <see cref="String"/> containing the parameter of name to check, <see langword="null"/> to skip parameter validation.
- /// </param>
- /// <returns>
- /// The thrown <see cref="ArgumentNullException"/>.
- /// </returns>
- /// <exception cref="AssertFailedException">
- /// <see cref="Exception"/> of type <see cref="ArgumentNullException"/> was not thrown.
- /// <para>
- /// -or-
- /// </para>
- /// <see cref="ArgumentException.ParamName"/> is not equal to <paramref name="parameterName"/> .
- /// </exception>
- public static ArgumentNullException ThrowsArgumentNullException(string parameterName, Action action, string message = null)
- {
- return ThrowsArgumentException<ArgumentNullException>(parameterName, action, message);
- }
-
- /// <summary>
- /// Asserts that the given delegate throws an <see cref="ArgumentException"/> with the given parameter name.
- /// </summary>
- /// <param name="action">
- /// The delagate of type <see cref="Action"/> to execute.
- /// </param>
- /// <param name="message">
- /// A <see cref="String"/> containing additional information for when the assertion fails.
- /// </param>
- /// <param name="parameterName">
- /// A <see cref="String"/> containing the parameter of name to check, <see langword="null"/> to skip parameter validation.
- /// </param>
- /// <returns>
- /// The thrown <see cref="ArgumentException"/>.
- /// </returns>
- /// <exception cref="AssertFailedException">
- /// <see cref="Exception"/> of type <see cref="ArgumentException"/> was not thrown.
- /// <para>
- /// -or-
- /// </para>
- /// <see cref="ArgumentException.ParamName"/> is not equal to <paramref name="parameterName"/> .
- /// </exception>
- public static ArgumentException ThrowsArgumentException(string parameterName, Action action, string message = null)
- {
- return ThrowsArgumentException<ArgumentException>(parameterName, action, message);
- }
-
- /// <summary>
- /// Asserts that the given delegate throws an <see cref="ArgumentException"/> of type <typeparamref name="T"/> with the given parameter name.
- /// </summary>
- /// <param name="action">
- /// The delagate of type <see cref="Action"/> to execute.
- /// </param>
- /// <param name="message">
- /// A <see cref="String"/> containing additional information for when the assertion fails.
- /// </param>
- /// <param name="parameterName">
- /// A <see cref="String"/> containing the parameter of name to check, <see langword="null"/> to skip parameter validation.
- /// </param>
- /// <returns>
- /// The thrown <see cref="Exception"/>.
- /// </returns>
- /// <exception cref="AssertFailedException">
- /// <see cref="Exception"/> of type <typeparam name="T"/> was not thrown.
- /// <para>
- /// -or-
- /// </para>
- /// <see cref="ArgumentException.ParamName"/> is not equal to <paramref name="parameterName"/> .
- /// </exception>
- public static T ThrowsArgumentException<T>(string parameterName, Action action, string message = null)
- where T : ArgumentException
- {
- T exception = Throws<T>(action, message);
-
-#if DEBUG
- // ParamName's not available on ret builds
- if (parameterName != null)
- Assert.AreEqual(parameterName, exception.ParamName, "Expected '{0}.ParamName' to be '{1}'. {2}", typeof(T), parameterName, message);
-#endif
-
- return exception;
- }
-
- /// <summary>
- /// Asserts that the given delegate throws an <see cref="AggregateException"/> with a base exception <see cref="Exception"/> of type <typeparam name="T" />.
- /// </summary>
- /// <param name="action">
- /// The delagate of type <see cref="Action"/> to execute.
- /// </param>
- /// <param name="message">
- /// A <see cref="String"/> containing additional information for when the assertion fails.
- /// </param>
- /// <returns>
- /// The base <see cref="Exception"/> of the <see cref="AggregateException"/>.
- /// </returns>
- /// <exception cref="AssertFailedException">
- /// <see cref="AggregateException"/> of was not thrown.
- /// -or-
- /// </para>
- /// <see cref="AggregateException.GetBaseException()"/> is not of type <typeparam name="TBase"/>.
- /// </exception>
- public static TBase ThrowsAggregateException<TBase>(Action action, string message = "") where TBase : Exception
- {
- AggregateException exception = Throws<AggregateException>(action, message);
-
- Exception baseException = exception.GetBaseException();
- if (baseException == null)
- Assert.Fail("Expected 'AggregateException.GetBaseException()' to be '{0}', however it is null. {1}", typeof(TBase), message);
-
- if (baseException.GetType() != typeof(TBase))
- Assert.Fail("Expected 'AggregateException.GetBaseException()', to be '{0}', however, '{1}' is. {2}", typeof(TBase), baseException.GetType(), message);
-
- return (TBase)baseException;
- }
-
- /// <summary>
- /// Asserts that the given delegate throws an <see cref="Exception"/> of type <typeparam name="T" />.
- /// </summary>
- /// <param name="action">
- /// The delagate of type <see cref="Action"/> to execute.
- /// </param>
- /// <param name="format">
- /// A <see cref="String"/> containing format information for when the assertion fails.
- /// </param>
- /// <param name="args">
- /// An <see cref="Array"/> of arguments to be formatted.
- /// </param>
- /// <returns>
- /// The thrown <see cref="Exception"/>.
- /// </returns>
- /// <exception cref="AssertFailedException">
- /// <see cref="Exception"/> of type <typeparam name="T"/> was not thrown.
- /// </exception>
- public static T Throws<T>(Action action, string format, params Object[] args) where T : Exception
- {
- return Throws<T>(action, String.Format(format, args));
- }
-
- /// <summary>
- /// Asserts that the given delegate throws an <see cref="Exception"/> of type <typeparam name="T" />.
- /// </summary>
- /// <param name="action">
- /// The delagate of type <see cref="Action"/> to execute.
- /// </param>
- /// <param name="message">
- /// A <see cref="String"/> containing additional information for when the assertion fails.
- /// </param>
- /// <param name="options">
- /// Specifies whether <see cref="Assert.Throws{T}"/> should require an exact type match when comparing the expected exception type with the thrown exception. The default is <see cref="AssertThrowsOptions.None"/>.
- /// </param>
- /// <returns>
- /// The thrown <see cref="Exception"/>.
- /// </returns>
- /// <exception cref="AssertFailedException">
- /// <see cref="Exception"/> of type <typeparam name="T"/> was not thrown.
- /// </exception>
- public static T Throws<T>(Action action, string message = "", AssertThrowsOptions options = AssertThrowsOptions.None) where T : Exception
- {
- Exception exception = RunWithCatch(action);
-
- if (exception == null)
- Assert.Fail("Expected '{0}' to be thrown. {1}", typeof(T).ToString(), message);
-
- if (!IsOfExceptionType<T>(exception, options))
- Assert.Fail("Expected '{0}' to be thrown, however '{1}' was thrown. {2}", typeof(T), exception.GetType(), message);
-
- return (T)exception;
- }
-
- /// <summary>
- /// Asserts that the given async delegate throws an <see cref="Exception"/> of type <typeparam name="T".
- /// </summary>
- /// <param name="action">
- /// The delagate of type <see cref="Func{}"/> to execute.
- /// </param>
- /// <param name="message">
- /// A <see cref="String"/> containing additional information for when the assertion fails.
- /// </param>
- /// <param name="options">
- /// Specifies whether <see cref="Assert.Throws{T}"/> should require an exact type match when comparing the expected exception type with the thrown exception. The default is <see cref="AssertThrowsOptions.None"/>.
- /// </param>
- /// <returns>
- /// The thrown <see cref="Exception"/>.
- /// </returns>
- /// <exception cref="AssertFailedException">
- /// <see cref="Exception"/> of type <typeparam name="T"/> was not thrown.
- /// </exception>
- public static async Task<T> ThrowsAsync<T>(Func<Task> action, string message = "", AssertThrowsOptions options = AssertThrowsOptions.None) where T : Exception
- {
- Exception exception = await RunWithCatchAsync(action);
-
- if (exception == null)
- Assert.Fail("Expected '{0}' to be thrown. {1}", typeof(T).ToString(), message);
-
- if (!IsOfExceptionType<T>(exception, options))
- Assert.Fail("Expected '{0}' to be thrown, however '{1}' was thrown. {2}", typeof(T), exception.GetType(), message);
-
- return (T)exception;
- }
-
- /// <summary>
- /// Asserts that the given async delegate throws an <see cref="Exception"/> of type <typeparam name="T" /> and <see cref="Exception.InnerException"/>
- /// returns an <see cref="Exception"/> of type <typeparam name="TInner" />.
- /// </summary>
- /// <param name="action">
- /// The delagate of type <see cref="Action"/> to execute.
- /// </param>
- /// <param name="message">
- /// A <see cref="String"/> containing additional information for when the assertion fails.
- /// </param>
- /// <param name="options">
- /// Specifies whether <see cref="Assert.Throws{T}"/> should require an exact type match when comparing the expected exception type with the thrown exception. The default is <see cref="AssertThrowsOptions.None"/>.
- /// </param>
- /// <returns>
- /// The thrown inner <see cref="Exception"/>.
- /// </returns>
- /// <exception cref="AssertFailedException">
- /// <see cref="Exception"/> of type <typeparam name="T"/> was not thrown.
- /// <para>
- /// -or-
- /// </para>
- /// <see cref="Exception.InnerException"/> is not of type <typeparam name="TInner"/>.
- /// </exception>
- public static TInner Throws<T, TInner>(Action action, string message = "", AssertThrowsOptions options = AssertThrowsOptions.None)
- where T : Exception
- where TInner : Exception
- {
- T outerException = Throws<T>(action, message, options);
-
- if (outerException.InnerException == null)
- Assert.Fail("Expected '{0}.InnerException' to be '{1}', however it is null. {2}", typeof(T), typeof(TInner), message);
-
- if (!IsOfExceptionType<TInner>(outerException.InnerException, options))
- Assert.Fail("Expected '{0}.InnerException', to be '{1}', however, '{2}' is. {3}", typeof(T), typeof(TInner), outerException.InnerException.GetType(), message);
-
- return (TInner)outerException.InnerException;
- }
-
-
- /// <summary>
- /// Tests whether the specified condition is true and throws an exception
- /// if the condition is false.
- /// </summary>
- /// <param name="condition">The condition the test expects to be true.</param>
- /// <param name="message">
- /// The message to include in the exception when <paramref name="condition"/>
- /// is false. The message is shown in test results.
- /// </param>
- /// <exception cref="AssertFailedException">
- /// Thrown if <paramref name="condition"/> is false.
- /// </exception>
- public static void IsTrue(bool condition, string format, params Object[] args)
- {
- if (!condition)
- {
- Assert.HandleFail("Assert.IsTrue", String.Format(format, args));
- }
- }
-
- /// <summary>
- /// Tests whether the specified condition is true and throws an exception
- /// if the condition is false.
- /// </summary>
- /// <param name="condition">The condition the test expects to be true.</param>
- /// <param name="message">
- /// The message to include in the exception when <paramref name="condition"/>
- /// is false. The message is shown in test results.
- /// </param>
- /// <exception cref="AssertFailedException">
- /// Thrown if <paramref name="condition"/> is false.
- /// </exception>
- public static void IsTrue(bool condition, string message = "")
- {
- if (!condition)
- {
- Assert.HandleFail("Assert.IsTrue", message);
- }
- }
-
- /// <summary>
- /// Tests whether the specified condition is false and throws an exception
- /// if the condition is true.
- /// </summary>
- /// <param name="condition">The condition the test expects to be false.</param>
- /// <param name="message">
- /// The message to include in the exception when <paramref name="condition"/>
- /// is true. The message is shown in test results.
- /// </param>
- /// <exception cref="AssertFailedException">
- /// Thrown if <paramref name="condition"/> is true.
- /// </exception>
- public static void IsFalse(bool condition, string message = "")
- {
- if (condition)
- {
- Assert.HandleFail("Assert.IsFalse", message);
- }
- }
-
- /// <summary>
- /// Tests whether the specified condition is false and throws an exception
- /// if the condition is true.
- /// </summary>
- /// <param name="condition">The condition the test expects to be false.</param>
- /// <param name="message">
- /// The message to include in the exception when <paramref name="condition"/>
- /// is true. The message is shown in test results.
- /// </param>
- /// <exception cref="AssertFailedException">
- /// Thrown if <paramref name="condition"/> is true.
- /// </exception>
- public static void IsFalse(bool condition, string format, params Object[] args)
- {
- IsFalse(condition, String.Format(format, args));
- }
-
- /// <summary>
- /// Tests whether the specified object is null and throws an exception
- /// if it is not.
- /// </summary>
- /// <param name="value">The object the test expects to be null.</param>
- /// <param name="message">
- /// The message to include in the exception when <paramref name="value"/>
- /// is not null. The message is shown in test results.
- /// </param>
- /// <exception cref="AssertFailedException">
- /// Thrown if <paramref name="value"/> is not null.
- /// </exception>
- public static void IsNull(object value, string message = "")
- {
- if (value != null)
- {
- Assert.HandleFail("Assert.IsNull", message);
- }
- }
-
- /// <summary>
- /// Tests whether the specified object is null and throws an exception
- /// if it is not.
- /// </summary>
- /// <param name="value">The object the test expects to be null.</param>
- /// <param name="message">
- /// The message to include in the exception when <paramref name="value"/>
- /// is not null. The message is shown in test results.
- /// </param>
- /// <exception cref="AssertFailedException">
- /// Thrown if <paramref name="value"/> is not null.
- /// </exception>
- public static void IsNull(object value, string format, params Object[] args)
- {
- IsNull(value, String.Format(format, args));
- }
-
- /// <summary>
- /// Tests whether the specified object is non-null and throws an exception
- /// if it is null.
- /// </summary>
- /// <param name="value">The object the test expects not to be null.</param>
- /// <param name="message">
- /// The message to include in the exception when <paramref name="value"/>
- /// is null. The message is shown in test results.
- /// </param>
- /// <exception cref="AssertFailedException">
- /// Thrown if <paramref name="value"/> is null.
- /// </exception>
- public static void IsNotNull(object value, string message = "")
- {
- if (value == null)
- {
- Assert.HandleFail("Assert.IsNotNull", message);
- }
- }
-
- /// <summary>
- /// Tests whether the expected object is equal to the actual object and
- /// throws an exception if it is not.
- /// </summary>
- /// <param name="notExpected">Expected object.</param>
- /// <param name="actual">Actual object.</param>
- /// <param name="message">Message to display upon failure.</param>
- public static void AreEqual<T>(T expected, T actual, string message = "")
- {
- const string EXPECTED_MSG = @"Expected: [{1}]. Actual: [{2}]. {0}";
-
- if (!Object.Equals(expected, actual))
- {
- string finalMessage = String.Format(EXPECTED_MSG, message, (object)expected ?? "NULL", (object)actual ?? "NULL");
- Assert.HandleFail("Assert.AreEqual", finalMessage);
- }
- }
-
- /// <summary>
- /// Tests whether the expected object is equal to the actual object and
- /// throws an exception if it is not.
- /// </summary>
- /// <param name="notExpected">Expected object.</param>
- /// <param name="actual">Actual object.</param>
- /// <param name="message">Message to display upon failure.</param>
- public static void AreEqual<T>(T expected, T actual, string format, params Object[] args)
- {
- AreEqual<T>(expected, actual, String.Format(format, args));
- }
-
- /// <summary>
- /// Tests whether the expected object is equal to the actual object and
- /// throws an exception if it is not.
- /// </summary>
- /// <param name="notExpected">Expected object that we do not want it to be.</param>
- /// <param name="actual">Actual object.</param>
- /// <param name="message">Message to display upon failure.</param>
- public static void AreNotEqual<T>(T notExpected, T actual, string message = "")
- {
- if (Object.Equals(notExpected, actual))
- {
- String finalMessage =
- String.Format(@"Expected any value except:[{1}]. Actual:[{2}]. {0}",
- message, notExpected, actual);
-
- Assert.HandleFail("Assert.AreNotEqual", finalMessage);
- }
- }
-
- /// <summary>
- /// Tests whether the expected object is equal to the actual object and
- /// throws an exception if it is not.
- /// </summary>
- /// <param name="notExpected">Expected object that we do not want it to be.</param>
- /// <param name="actual">Actual object.</param>
- /// <param name="message">Message to display upon failure.</param>
- public static void AreNotEqual<T>(T notExpected, T actual, string format, params Object[] args)
- {
- AreNotEqual<T>(notExpected, actual, String.Format(format, args));
- }
-
- /// <summary>
- /// Tests whether the two lists are the same length and contain the same objects (using Object.Equals()) in the same order and
- /// throws an exception if it is not.
- /// </summary>
- /// <param name="expected">Expected list.</param>
- /// <param name="actual">Actual list.</param>
- /// <param name="message">Message to display upon failure.</param>
- public static void AreAllEqual<T>(T[] expected, T[] actual, string message = "")
- {
- Assert.AreEqual(expected.Length, actual.Length, message);
-
- for (int i = 0; i < expected.Length; i++)
- Assert.AreEqual<T>(expected[i], actual[i], message);
- }
-
- /// <summary>
- /// Tests whether the two lists are the same length and contain the same objects (using Object.Equals()) in the same order and
- /// throws an exception if it is not.
- /// </summary>
- /// <param name="expected">Expected list.</param>
- /// <param name="actual">Actual list.</param>
- /// <param name="message">Message to display upon failure.</param>
- public static void AreAllEqual<T>(T[] expected, T[] actual, string format, params Object[] args)
- {
- AreAllEqual<T>(expected, actual, String.Format(format, args));
- }
-
- /// <summary>
- /// Tests whether the two lists are the same length and contain the same objects (using Object.Equals()) (but not necessarily in the same order) and
- /// throws an exception if it is not.
- /// </summary>
- /// <param name="expected">Expected list.</param>
- /// <param name="actual">Actual list.</param>
- /// <param name="message">Message to display upon failure.</param>
- public static void AreAllEqualUnordered<T>(T[] expected, T[] actual)
- {
- Assert.AreEqual(expected.Length, actual.Length);
-
- int count = expected.Length;
- bool[] removedFromActual = new bool[count];
- for (int i = 0; i < count; i++)
- {
- T item1 = expected[i];
- bool foundMatch = false;
- for (int j = 0; j < count; j++)
- {
- if (!removedFromActual[j])
- {
- T item2 = actual[j];
- if ((item1 == null && item2 == null) || (item1 != null && item1.Equals(item2)))
- {
- foundMatch = true;
- removedFromActual[j] = true;
- break;
- }
- }
- }
- if (!foundMatch)
- Assert.HandleFail("Assert.AreAllEqualUnordered", "First array has element not found in second array: " + item1);
- }
- return;
- }
-
- /// <summary>
- /// Tests whether the two enumerables are the same length and contain the same objects (using Object.Equals()) in the same order and
- /// throws an exception if it is not.
- /// </summary>
- /// <param name="expected">Expected enumerables.</param>
- /// <param name="actual">Actual enumerables.</param>
- /// <param name="message">Message to display upon failure.</param>
- public static void AreAllEqual<T>(IEnumerable<T> expected, IEnumerable<T> actual, string message = "")
- {
- AreAllEqual(CopyToArray(expected), CopyToArray(actual), message);
- }
-
- /// <summary>
- /// Tests whether the two enumerables are the same length and contain the same objects (using Object.Equals()) (but not necessarily
- /// in the same order) and throws an exception if it is not.
- /// </summary>
- /// <param name="expected">Expected enumerable.</param>
- /// <param name="actual">Actual enumerable.</param>
- /// <param name="message">Message to display upon failure.</param>
- public static void AreAllEqualUnordered<T>(IEnumerable<T> expected, IEnumerable<T> actual, string message = "")
- {
- AreAllEqualUnordered(CopyToArray(expected), CopyToArray(actual), message);
- }
-
- /// <summary>
- /// Iterates through an IEnumerable to generate an array of elements. The rational for using this instead of
- /// System.Linq.ToArray is that this will not require a dependency on System.Linq.dll
- /// </summary>
- private static T[] CopyToArray<T>(IEnumerable<T> source)
- {
- T[] items = new T[4];
- int count = 0;
-
- if (source == null)
- return null;
-
- foreach (var item in source)
- {
- if (items.Length == count)
- {
- var newItems = new T[checked(count * 2)];
- Array.Copy(items, 0, newItems, 0, count);
- items = newItems;
- }
-
- items[count] = item;
- count++;
- }
-
- if (items.Length == count)
- return items;
-
- var finalItems = new T[count];
- Array.Copy(items, 0, finalItems, 0, count);
- return finalItems;
- }
-
-
- /// <summary>
- /// Tests whether the specified objects both refer to the same object and
- /// throws an exception if the two inputs do not refer to the same object.
- /// </summary>
- /// <param name="expected">
- /// The first object to compare. This is the value the test expects.
- /// </param>
- /// <param name="actual">
- /// The second object to compare. This is the value produced by the code under test.
- /// </param>
- /// <exception cref="AssertFailedException">
- /// Thrown if <paramref name="expected"/> does not refer to the same object
- /// as <paramref name="actual"/>.
- /// </exception>
- static public void AreSame(object expected, object actual)
- {
- Assert.AreSame(expected, actual, string.Empty);
- }
-
- /// <summary>
- /// Tests whether the specified objects both refer to the same object and
- /// throws an exception if the two inputs do not refer to the same object.
- /// </summary>
- /// <param name="expected">
- /// The first object to compare. This is the value the test expects.
- /// </param>
- /// <param name="actual">
- /// The second object to compare. This is the value produced by the code under test.
- /// </param>
- /// <param name="message">
- /// The message to include in the exception when <paramref name="actual"/>
- /// is not the same as <paramref name="expected"/>. The message is shown
- /// in test results.
- /// </param>
- /// <exception cref="AssertFailedException">
- /// Thrown if <paramref name="expected"/> does not refer to the same object
- /// as <paramref name="actual"/>.
- /// </exception>
- static public void AreSame(object expected, object actual, string message)
- {
- if (!Object.ReferenceEquals(expected, actual))
- {
- string finalMessage = message;
-
- ValueType valExpected = expected as ValueType;
- if (valExpected != null)
- {
- ValueType valActual = actual as ValueType;
- if (valActual != null)
- {
- finalMessage = message == null ? String.Empty : message;
- }
- }
-
- Assert.HandleFail("Assert.AreSame", finalMessage);
- }
- }
-
- /// <summary>
- /// Tests whether the specified objects refer to different objects and
- /// throws an exception if the two inputs refer to the same object.
- /// </summary>
- /// <param name="notExpected">
- /// The first object to compare. This is the value the test expects not
- /// to match <paramref name="actual"/>.
- /// </param>
- /// <param name="actual">
- /// The second object to compare. This is the value produced by the code under test.
- /// </param>
- /// <exception cref="AssertFailedException">
- /// Thrown if <paramref name="notExpected"/> refers to the same object
- /// as <paramref name="actual"/>.
- /// </exception>
- static public void AreNotSame(object notExpected, object actual)
- {
- Assert.AreNotSame(notExpected, actual, string.Empty);
- }
-
- /// <summary>
- /// Tests whether the specified objects refer to different objects and
- /// throws an exception if the two inputs refer to the same object.
- /// </summary>
- /// <param name="notExpected">
- /// The first object to compare. This is the value the test expects not
- /// to match <paramref name="actual"/>.
- /// </param>
- /// <param name="actual">
- /// The second object to compare. This is the value produced by the code under test.
- /// </param>
- /// <param name="message">
- /// The message to include in the exception when <paramref name="actual"/>
- /// is the same as <paramref name="notExpected"/>. The message is shown in
- /// test results.
- /// </param>
- /// <exception cref="AssertFailedException">
- /// Thrown if <paramref name="notExpected"/> refers to the same object
- /// as <paramref name="actual"/>.
- /// </exception>
- static public void AreNotSame(object notExpected, object actual, string message)
- {
- if (Object.ReferenceEquals(notExpected, actual))
- {
- Assert.HandleFail("Assert.AreNotSame", message);
- }
- }
-
- static public void OfType<T>(object obj)
- {
- if (!(obj is T))
- {
- Assert.HandleFail(
- "Assert.IsOfType",
- $"Expected an object of type [{typeof(T).AssemblyQualifiedName}], got type of type [{obj.GetType().AssemblyQualifiedName}].");
- }
- }
-
- /// <summary>
- /// Throws an AssertFailedException.
- /// </summary>
- /// <exception cref="AssertFailedException">
- /// Always thrown.
- /// </exception>
- public static void Fail()
- {
- Assert.HandleFail("Assert.Fail", "");
- }
-
- /// <summary>
- /// Throws an AssertFailedException.
- /// </summary>
- /// <param name="message">
- /// The message to include in the exception. The message is shown in
- /// test results.
- /// </param>
- /// <exception cref="AssertFailedException">
- /// Always thrown.
- /// </exception>
- public static void Fail(string message, params object[] args)
- {
- string exceptionMessage = args.Length == 0 ? message : string.Format(message, args);
- Assert.HandleFail("Assert.Fail", exceptionMessage);
- }
-
- /// <summary>
- /// Helper function that creates and throws an exception.
- /// </summary>
- /// <param name="assertionName">name of the assertion throwing an exception.</param>
- /// <param name="message">message describing conditions for assertion failure.</param>
- /// <param name="parameters">The parameters.</param>
- /// TODO: Modify HandleFail to take in parameters
- internal static void HandleFail(string assertionName, string message)
- {
- // change this to use AssertFailedException
- throw new AssertTestException(assertionName + ": " + message);
- }
-
-
- [Obsolete("Did you mean to call Assert.AreEqual()")]
- public static new bool Equals(Object o1, Object o2)
- {
- Assert.Fail("Don\u2019t call this.");
- throw new Exception();
- }
-
- private static bool IsOfExceptionType<T>(Exception thrown, AssertThrowsOptions options)
- {
- if ((options & AssertThrowsOptions.AllowDerived) == AssertThrowsOptions.AllowDerived)
- return thrown is T;
-
- return thrown.GetType() == typeof(T);
- }
-
- private static Exception RunWithCatch(Action action)
- {
- try
- {
- action();
- return null;
- }
- catch (Exception ex)
- {
- return ex;
- }
- }
-
- private static async Task<Exception> RunWithCatchAsync(Func<Task> action)
- {
- try
- {
- await action();
- return null;
- }
- catch (Exception ex)
- {
- return ex;
- }
- }
- }
-
- /// <summary>
- /// Exception raised by the Assert on Fail
- /// </summary>
- public class AssertTestException : Exception
- {
- public AssertTestException(string message)
- : base(message)
- {
- }
-
- public AssertTestException()
- : base()
- {
- }
- }
-
- public static class ExceptionAssert
- {
- public static void Throws<T>(String message, Action a) where T : Exception
- {
- Assert.Throws<T>(a, message);
- }
- }
-
- /// <summary>
- /// Specifies whether <see cref="Assert.Throws{T}"/> should require an exact type match when comparing the expected exception type with the thrown exception.
- /// </summary>
- [Flags]
- public enum AssertThrowsOptions
- {
- /// <summary>
- /// Specifies that <see cref="Assert.Throws{T}"/> should require an exact type
- /// match when comparing the specified exception type with the throw exception.
- /// </summary>
- None = 0,
-
- /// <summary>
- /// Specifies that <see cref="Assert.Throws{T}"/> should not require an exact type
- /// match when comparing the specified exception type with the thrown exception.
- /// </summary>
- AllowDerived = 1,
- }
-}
<TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>
</PropertyGroup>
<ItemGroup>
- <Compile Include="Assertion.cs" />
+ <Compile Include="AssertExtensions.cs" />
<Compile Include="Generator.cs" />
<Compile Include="Logging.cs" />
<Compile Include="TestFramework.cs" />
<Compile Include="XPlatformUtils.cs" />
</ItemGroup>
+ <ItemGroup>
+ <PackageReference Include="xunit" Version="$(XUnitVersion)" ExcludeAssets="runtime" />
+ </ItemGroup>
</Project>
using System.Security;
using System.Text;
using System.Threading;
+using Xunit;
namespace TestLibrary
{
return 0;
}
- Assert.AreEqual(0, Ntdll.RtlGetVersionEx(out Ntdll.RTL_OSVERSIONINFOEX osvi));
+ Assert.Equal(0, Ntdll.RtlGetVersionEx(out Ntdll.RTL_OSVERSIONINFOEX osvi));
return osvi.dwMajorVersion;
}
internal static uint GetWindowsMinorVersion()
return 0;
}
- Assert.AreEqual(0, Ntdll.RtlGetVersionEx(out Ntdll.RTL_OSVERSIONINFOEX osvi));
+ Assert.Equal(0, Ntdll.RtlGetVersionEx(out Ntdll.RTL_OSVERSIONINFOEX osvi));
return osvi.dwMinorVersion;
}
internal static uint GetWindowsBuildNumber()
return 0;
}
- Assert.AreEqual(0, Ntdll.RtlGetVersionEx(out Ntdll.RTL_OSVERSIONINFOEX osvi));
+ Assert.Equal(0, Ntdll.RtlGetVersionEx(out Ntdll.RTL_OSVERSIONINFOEX osvi));
return osvi.dwBuildNumber;
}
<Output TaskParameter="TargetOutputs" ItemName="Reference" />
</MSBuild>
- <ItemGroup>
+ <ItemGroup Condition="'$(ReferenceSystemPrivateCoreLib)' != 'true'">
<Reference Include="$(TargetingPackPath)/*.dll" >
<Private>false</Private>
</Reference>
using System.Linq;
using System.Threading;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
#pragma warning disable CS0612, CS0618
{
var boolArray = new bool[] { true, false, true, false, false, true };
SafeArrayNative.XorBoolArray(boolArray, out var xorResult);
- Assert.AreEqual(XorArray(boolArray), xorResult);
+ Assert.Equal(XorArray(boolArray), xorResult);
var decimalArray = new decimal[] { 1.5M, 30.2M, 6432M, 12.5832M };
SafeArrayNative.MeanDecimalArray(decimalArray, out var meanDecimalValue);
- Assert.AreEqual(decimalArray.Average(), meanDecimalValue);
+ Assert.Equal(decimalArray.Average(), meanDecimalValue);
SafeArrayNative.SumCurrencyArray(decimalArray, out var sumCurrencyValue);
- Assert.AreEqual(decimalArray.Sum(), sumCurrencyValue);
+ Assert.Equal(decimalArray.Sum(), sumCurrencyValue);
var strings = new [] {"ABCDE", "12345", "Microsoft"};
var reversedStrings = strings.Select(str => Reverse(str)).ToArray();
var ansiTest = strings.ToArray();
SafeArrayNative.ReverseStringsAnsi(ansiTest);
- Assert.AreAllEqual(reversedStrings, ansiTest);
+ AssertExtensions.CollectionEqual(reversedStrings, ansiTest);
var unicodeTest = strings.ToArray();
SafeArrayNative.ReverseStringsUnicode(unicodeTest);
- Assert.AreAllEqual(reversedStrings, unicodeTest);
+ AssertExtensions.CollectionEqual(reversedStrings, unicodeTest);
var bstrTest = strings.ToArray();
SafeArrayNative.ReverseStringsBSTR(bstrTest);
- Assert.AreAllEqual(reversedStrings, bstrTest);
+ AssertExtensions.CollectionEqual(reversedStrings, bstrTest);
var blittableRecords = new SafeArrayNative.BlittableRecord[]
{
new SafeArrayNative.BlittableRecord { a = 9 },
new SafeArrayNative.BlittableRecord { a = 15 },
};
- Assert.AreAllEqual(blittableRecords, SafeArrayNative.CreateSafeArrayOfRecords(blittableRecords));
+ AssertExtensions.CollectionEqual(blittableRecords, SafeArrayNative.CreateSafeArrayOfRecords(blittableRecords));
var nonBlittableRecords = boolArray.Select(b => new SafeArrayNative.NonBlittableRecord{ b = b }).ToArray();
- Assert.AreAllEqual(nonBlittableRecords, SafeArrayNative.CreateSafeArrayOfRecords(nonBlittableRecords));
+ AssertExtensions.CollectionEqual(nonBlittableRecords, SafeArrayNative.CreateSafeArrayOfRecords(nonBlittableRecords));
var objects = new object[] { new object(), new object(), new object() };
SafeArrayNative.VerifyIUnknownArray(objects);
SafeArrayNative.VerifyIDispatchArray(objects);
var variantInts = new object[] {1, 2, 3, 4, 5, 6, 7, 8, 9};
-
+
SafeArrayNative.MeanVariantIntArray(variantInts, out var variantMean);
- Assert.AreEqual(variantInts.OfType<int>().Average(), variantMean);
+ Assert.Equal(variantInts.OfType<int>().Average(), variantMean);
var dates = new DateTime[] { new DateTime(2008, 5, 1), new DateTime(2010, 1, 1) };
SafeArrayNative.DistanceBetweenDates(dates, out var numDays);
- Assert.AreEqual((dates[1] - dates[0]).TotalDays, numDays);
+ Assert.Equal((dates[1] - dates[0]).TotalDays, numDays);
SafeArrayNative.XorBoolArrayInStruct(
new SafeArrayNative.StructWithSafeArray
},
out var structXor);
- Assert.AreEqual(XorArray(boolArray), structXor);
+ Assert.Equal(XorArray(boolArray), structXor);
}
catch (Exception e)
{
using System.Runtime.InteropServices;
using TestLibrary;
+ using Xunit;
using Console = Internal.Console;
InterfaceId = notIClassFactory
};
ComActivator.GetClassFactoryForType(cxt);
- },
- "Non-IClassFactory request should fail");
+ });
}
static void NonrootedAssemblyPath(bool builtInComDisabled)
if (!builtInComDisabled)
{
- Assert.Throws<ArgumentException>(action, "Non-root assembly path should not be valid");
+ Assert.Throws<ArgumentException>(action);
}
else
{
- Assert.Throws<NotSupportedException>(action, "Built-in COM has been disabled via a feature switch");
+ Assert.Throws<NotSupportedException>(action);
}
}
if (!builtInComDisabled)
{
- COMException e = Assert.Throws<COMException>(action, "Class should not be found");
+ COMException e = Assert.Throws<COMException>(action);
const int CLASS_E_CLASSNOTAVAILABLE = unchecked((int)0x80040111);
- Assert.AreEqual(CLASS_E_CLASSNOTAVAILABLE, e.HResult, "Unexpected HRESULT");
+ Assert.Equal(CLASS_E_CLASSNOTAVAILABLE, e.HResult);
}
else
{
- Assert.Throws<NotSupportedException>(action, "Built-in COM has been disabled via a feature switch");
+ Assert.Throws<NotSupportedException>(action);
}
}
if (builtInComDisabled)
{
Assert.Throws<NotSupportedException>(
- () => ComActivator.GetClassFactoryForType(cxt), "Built-in COM has been disabled via a feature switch");
+ () => ComActivator.GetClassFactoryForType(cxt));
return;
}
typeCFromAssemblyB = (Type)svr.GetTypeFromC();
}
- Assert.AreNotEqual(typeCFromAssemblyA, typeCFromAssemblyB, "Types should be from different AssemblyLoadContexts");
+ Assert.NotEqual(typeCFromAssemblyA, typeCFromAssemblyB);
}
static void ValidateUserDefinedRegistrationCallbacks()
Marshal.Release(svrRaw);
var inst = (IValidateRegistrationCallbacks)svr;
- Assert.IsFalse(inst.DidRegister());
- Assert.IsFalse(inst.DidUnregister());
+ Assert.False(inst.DidRegister());
+ Assert.False(inst.DidUnregister());
cxt.InterfaceId = Guid.Empty;
ComActivator.ClassRegistrationScenarioForType(cxt, register: true);
ComActivator.ClassRegistrationScenarioForType(cxt, register: false);
- Assert.IsTrue(inst.DidRegister(), $"User-defined register function should have been called.");
- Assert.IsTrue(inst.DidUnregister(), $"User-defined unregister function should have been called.");
+ Assert.True(inst.DidRegister(), $"User-defined register function should have been called.");
+ Assert.True(inst.DidUnregister(), $"User-defined unregister function should have been called.");
}
}
exceptionThrown = true;
}
- Assert.IsTrue(exceptionThrown || !inst.DidRegister());
+ Assert.True(exceptionThrown || !inst.DidRegister());
exceptionThrown = false;
try
exceptionThrown = true;
}
- Assert.IsTrue(exceptionThrown || !inst.DidUnregister());
+ Assert.True(exceptionThrown || !inst.DidUnregister());
}
}
}
using System.Runtime.InteropServices;
using ComWrappersTests.Common;
- using TestLibrary;
+ using Xunit;
class Program
{
var iid = typeof(ITrackerObject).GUID;
IntPtr iTrackerComObject;
int hr = Marshal.QueryInterface(externalComObject, ref iid, out iTrackerComObject);
- Assert.AreEqual(0, hr);
+ Assert.Equal(0, hr);
return new ITrackerObjectWrapper(iTrackerComObject);
}
ComWrappers.GetIUnknownImpl(out IntPtr fpQueryInterface, out IntPtr fpAddRef, out IntPtr fpRelease);
- Assert.AreNotEqual(fpQueryInterface, IntPtr.Zero);
- Assert.AreNotEqual(fpAddRef, IntPtr.Zero);
- Assert.AreNotEqual(fpRelease, IntPtr.Zero);
+ Assert.NotEqual(fpQueryInterface, IntPtr.Zero);
+ Assert.NotEqual(fpAddRef, IntPtr.Zero);
+ Assert.NotEqual(fpRelease, IntPtr.Zero);
}
}
// Allocate a wrapper for the object
IntPtr comWrapper = wrappers.GetOrCreateComInterfaceForObject(testObj, CreateComInterfaceFlags.TrackerSupport);
- Assert.AreNotEqual(IntPtr.Zero, comWrapper);
+ Assert.NotEqual(IntPtr.Zero, comWrapper);
// Get a wrapper for an object and verify it is the same one.
IntPtr comWrapperMaybe = wrappers.GetOrCreateComInterfaceForObject(testObj, CreateComInterfaceFlags.TrackerSupport);
- Assert.AreEqual(comWrapper, comWrapperMaybe);
+ Assert.Equal(comWrapper, comWrapperMaybe);
// Release the wrapper
int count = Marshal.Release(comWrapper);
- Assert.AreEqual(1, count);
+ Assert.Equal(1, count);
count = Marshal.Release(comWrapperMaybe);
- Assert.AreEqual(0, count);
+ Assert.Equal(0, count);
// Create a new wrapper
IntPtr comWrapperNew = wrappers.GetOrCreateComInterfaceForObject(testObj, CreateComInterfaceFlags.TrackerSupport);
// Once a wrapper is created for a managed object it is always present
- Assert.AreEqual(comWrapperNew, comWrapper);
+ Assert.Equal(comWrapperNew, comWrapper);
// Release the new wrapper
count = Marshal.Release(comWrapperNew);
- Assert.AreEqual(0, count);
+ Assert.Equal(0, count);
}
static void ValidateComInterfaceCreationRoundTrip()
// Allocate a wrapper for the object
IntPtr comWrapper = wrappers.GetOrCreateComInterfaceForObject(testObj, CreateComInterfaceFlags.None);
- Assert.AreNotEqual(IntPtr.Zero, comWrapper);
+ Assert.NotEqual(IntPtr.Zero, comWrapper);
var testObjUnwrapped = wrappers.GetOrCreateObjectForComInstance(comWrapper, CreateObjectFlags.Unwrap);
- Assert.AreEqual(testObj, testObjUnwrapped);
+ Assert.Equal(testObj, testObjUnwrapped);
// Release the wrapper
int count = Marshal.Release(comWrapper);
- Assert.AreEqual(0, count);
+ Assert.Equal(0, count);
}
static void ValidateFallbackQueryInterface()
var anyGuid = new Guid("1E42439C-DCB5-4701-ACBD-87FE92E785DE");
testObj.ICustomQueryInterface_GetInterfaceIID = anyGuid;
int hr = Marshal.QueryInterface(comWrapper, ref anyGuid, out result);
- Assert.AreEqual(0, hr);
- Assert.AreEqual(testObj.ICustomQueryInterface_GetInterfaceResult, result);
+ Assert.Equal(0, hr);
+ Assert.Equal(testObj.ICustomQueryInterface_GetInterfaceResult, result);
var anyGuid2 = new Guid("7996D0F9-C8DD-4544-B708-0F75C6FF076F");
hr = Marshal.QueryInterface(comWrapper, ref anyGuid2, out result);
const int E_NOINTERFACE = unchecked((int)0x80004002);
- Assert.AreEqual(E_NOINTERFACE, hr);
- Assert.AreEqual(IntPtr.Zero, result);
+ Assert.Equal(E_NOINTERFACE, hr);
+ Assert.Equal(IntPtr.Zero, result);
int count = Marshal.Release(comWrapper);
- Assert.AreEqual(0, count);
+ Assert.Equal(0, count);
}
static void ValidateCreateObjectCachingScenario()
var trackerObj1 = (ITrackerObjectWrapper)cw.GetOrCreateObjectForComInstance(trackerObjRaw, CreateObjectFlags.TrackerObject);
var trackerObj2 = (ITrackerObjectWrapper)cw.GetOrCreateObjectForComInstance(trackerObjRaw, CreateObjectFlags.TrackerObject);
- Assert.AreEqual(trackerObj1, trackerObj2);
+ Assert.Equal(trackerObj1, trackerObj2);
// Ownership has been transferred to the wrapper.
Marshal.Release(trackerObjRaw);
var trackerObj3 = (ITrackerObjectWrapper)cw.GetOrCreateObjectForComInstance(trackerObjRaw, CreateObjectFlags.TrackerObject | CreateObjectFlags.UniqueInstance);
- Assert.AreNotEqual(trackerObj1, trackerObj3);
+ Assert.NotEqual(trackerObj1, trackerObj3);
}
static void ValidateWrappersInstanceIsolation()
// Allocate a wrapper for the object
IntPtr comWrapper1 = cw1.GetOrCreateComInterfaceForObject(testObj, CreateComInterfaceFlags.TrackerSupport);
IntPtr comWrapper2 = cw2.GetOrCreateComInterfaceForObject(testObj, CreateComInterfaceFlags.TrackerSupport);
- Assert.AreNotEqual(comWrapper1, IntPtr.Zero);
- Assert.AreNotEqual(comWrapper2, IntPtr.Zero);
- Assert.AreNotEqual(comWrapper1, comWrapper2);
+ Assert.NotEqual(comWrapper1, IntPtr.Zero);
+ Assert.NotEqual(comWrapper2, IntPtr.Zero);
+ Assert.NotEqual(comWrapper1, comWrapper2);
IntPtr comWrapper3 = cw1.GetOrCreateComInterfaceForObject(testObj, CreateComInterfaceFlags.TrackerSupport);
IntPtr comWrapper4 = cw2.GetOrCreateComInterfaceForObject(testObj, CreateComInterfaceFlags.TrackerSupport);
- Assert.AreNotEqual(comWrapper3, comWrapper4);
- Assert.AreEqual(comWrapper1, comWrapper3);
- Assert.AreEqual(comWrapper2, comWrapper4);
+ Assert.NotEqual(comWrapper3, comWrapper4);
+ Assert.Equal(comWrapper1, comWrapper3);
+ Assert.Equal(comWrapper2, comWrapper4);
Marshal.Release(comWrapper1);
Marshal.Release(comWrapper2);
// Create objects for the COM instance
var trackerObj1 = (ITrackerObjectWrapper)cw1.GetOrCreateObjectForComInstance(trackerObjRaw, CreateObjectFlags.TrackerObject);
var trackerObj2 = (ITrackerObjectWrapper)cw2.GetOrCreateObjectForComInstance(trackerObjRaw, CreateObjectFlags.TrackerObject);
- Assert.AreNotEqual(trackerObj1, trackerObj2);
+ Assert.NotEqual(trackerObj1, trackerObj2);
var trackerObj3 = (ITrackerObjectWrapper)cw1.GetOrCreateObjectForComInstance(trackerObjRaw, CreateObjectFlags.TrackerObject);
var trackerObj4 = (ITrackerObjectWrapper)cw2.GetOrCreateObjectForComInstance(trackerObjRaw, CreateObjectFlags.TrackerObject);
- Assert.AreNotEqual(trackerObj3, trackerObj4);
- Assert.AreEqual(trackerObj1, trackerObj3);
- Assert.AreEqual(trackerObj2, trackerObj4);
+ Assert.NotEqual(trackerObj3, trackerObj4);
+ Assert.Equal(trackerObj1, trackerObj3);
+ Assert.Equal(trackerObj2, trackerObj4);
Marshal.Release(trackerObjRaw);
}
var iid = typeof(ITrackerObject).GUID;
IntPtr iTestComObject;
int hr = Marshal.QueryInterface(trackerObjRaw, ref iid, out iTestComObject);
- Assert.AreEqual(0, hr);
+ Assert.Equal(0, hr);
var nativeWrapper = new ITrackerObjectWrapper(iTestComObject);
// Register wrapper, but supply the wrapper.
var nativeWrapper2 = (ITrackerObjectWrapper)cw.GetOrRegisterObjectForComInstance(trackerObjRaw, CreateObjectFlags.TrackerObject, nativeWrapper);
- Assert.AreEqual(nativeWrapper, nativeWrapper2);
+ Assert.Equal(nativeWrapper, nativeWrapper2);
// Ownership has been transferred to the wrapper.
Marshal.Release(trackerObjRaw);
// We are using a tracking resurrection WeakReference<T> so we should be able
// to get back the objects as they are all continually re-registering for Finalization.
- Assert.IsTrue(weakRef1.TryGetTarget(out ITrackerObjectWrapper wrapper1));
- Assert.IsTrue(weakRef2.TryGetTarget(out ITrackerObjectWrapper wrapper2));
+ Assert.True(weakRef1.TryGetTarget(out ITrackerObjectWrapper wrapper1));
+ Assert.True(weakRef2.TryGetTarget(out ITrackerObjectWrapper wrapper2));
// Check that the two wrappers aren't equal, meaning we created a new wrapper since
// the first wrapper was removed from the internal cache.
- Assert.AreNotEqual(wrapper1, wrapper2);
+ Assert.NotEqual(wrapper1, wrapper2);
// Let the wrappers Finalize.
wrapper1.ReregisterForFinalize = false;
var iid = typeof(ITrackerObject).GUID;
IntPtr iTestComObject;
int hr = Marshal.QueryInterface(trackerObjRaw, ref iid, out iTestComObject);
- Assert.AreEqual(0, hr);
+ Assert.Equal(0, hr);
var nativeWrapper = new ITrackerObjectWrapper(iTestComObject);
nativeWrapper = (ITrackerObjectWrapper)cw.GetOrRegisterObjectForComInstance(trackerObjRaw, CreateObjectFlags.None, nativeWrapper);
case FailureMode.ThrowException:
throw new Exception() { HResult = ExceptionErrorCode };
default:
- Assert.Fail("Invalid failure mode");
+ Assert.True(false, "Invalid failure mode");
throw new Exception("UNREACHABLE");
}
}
case FailureMode.ThrowException:
throw new Exception() { HResult = ExceptionErrorCode };
default:
- Assert.Fail("Invalid failure mode");
+ Assert.True(false, "Invalid failure mode");
throw new Exception("UNREACHABLE");
}
}
}
catch (Exception e)
{
- Assert.AreEqual(BadComWrappers.ExceptionErrorCode, e.HResult);
+ Assert.Equal(BadComWrappers.ExceptionErrorCode, e.HResult);
}
IntPtr trackerObjRaw = MockReferenceTrackerRuntime.CreateTrackerObject();
}
catch (Exception e)
{
- Assert.AreEqual(BadComWrappers.ExceptionErrorCode, e.HResult);
+ Assert.Equal(BadComWrappers.ExceptionErrorCode, e.HResult);
}
Marshal.Release(trackerObjRaw);
Marshal.Release(testWrapper);
}
- Assert.IsTrue(testWrapperIds.Count <= Test.InstanceCount);
+ Assert.True(testWrapperIds.Count <= Test.InstanceCount);
ForceGC();
- Assert.IsTrue(testWrapperIds.Count <= Test.InstanceCount);
+ Assert.True(testWrapperIds.Count <= Test.InstanceCount);
// Remove the managed object ref from the native object.
foreach (int id in testWrapperIds)
// The COM reference count should be 0 and indicates to the GC the managed object
// can be collected.
refCount = Marshal.Release(testWrapper);
- Assert.AreEqual(0, refCount);
+ Assert.Equal(0, refCount);
}
ForceGC();
int hr = Marshal.QueryInterface(refTrackerTarget, ref iid, out iTestComObject);
const int COR_E_ACCESSING_CCW = unchecked((int)0x80131544);
- Assert.AreEqual(COR_E_ACCESSING_CCW, hr);
+ Assert.Equal(COR_E_ACCESSING_CCW, hr);
// Release the IReferenceTrackerTarget instance.
refCount = MockReferenceTrackerRuntime.TrackerTarget_ReleaseFromReferenceTracker(refTrackerTarget);
- Assert.AreEqual(0, refCount);
+ Assert.Equal(0, refCount);
static IntPtr CreateWrapper(TestComWrappers cw)
{
ForceGC();
// Validate all instances were cleaned up
- Assert.IsFalse(weakRef.TryGetTarget(out _));
- Assert.AreEqual(0, allocTracker.GetCount());
+ Assert.False(weakRef.TryGetTarget(out _));
+ Assert.Equal(0, allocTracker.GetCount());
}
static void ValidateAggregationWithReferenceTrackerObject()
ForceGC();
// Validate all instances were cleaned up.
- Assert.IsFalse(weakRef.TryGetTarget(out _));
+ Assert.False(weakRef.TryGetTarget(out _));
// Reference counter cleanup requires additional GCs since the Finalizer is used
// to clean up the Reference Tracker runtime references.
ForceGC();
- Assert.AreEqual(0, allocTracker.GetCount());
+ Assert.Equal(0, allocTracker.GetCount());
}
static int Main(string[] doNotUse)
using ComWrappersTests.Common;
using TestLibrary;
+ using Xunit;
partial class Program
{
Console.WriteLine($"Running {nameof(ValidateNotRegisteredForTrackerSupport)}...");
int hr = MockReferenceTrackerRuntime.Trigger_NotifyEndOfReferenceTrackingOnThread();
- Assert.AreNotEqual(GlobalComWrappers.ReleaseObjectsCallAck, hr);
+ Assert.NotEqual(GlobalComWrappers.ReleaseObjectsCallAck, hr);
}
static int Main(string[] doNotUse)
using ComWrappersTests.Common;
using TestLibrary;
+ using Xunit;
partial class Program
{
var testObj = new Test();
IntPtr comWrapper1 = Marshal.GetIUnknownForObject(testObj);
- Assert.IsNull(GlobalComWrappers.Instance.LastComputeVtablesObject, "ComWrappers instance should not have been called");
+ Assert.Null(GlobalComWrappers.Instance.LastComputeVtablesObject);
IntPtr trackerObjRaw = MockReferenceTrackerRuntime.CreateTrackerObject();
object objWrapper = Marshal.GetObjectForIUnknown(trackerObjRaw);
- Assert.IsFalse(objWrapper is FakeWrapper, $"ComWrappers instance should not have been called");
+ Assert.False(objWrapper is FakeWrapper, $"ComWrappers instance should not have been called");
}
static int Main(string[] doNotUse)
using ComWrappersTests.Common;
using TestLibrary;
+ using Xunit;
partial class Program
{
{
foreach (object o in objects)
{
- Assert.IsNotNull(o);
+ Assert.NotNull(o);
}
throw new Exception() { HResult = ReleaseObjectsCallAck };
() =>
{
ComWrappers.RegisterForMarshalling(wrappers1);
- }, "Should not be able to re-register for global ComWrappers");
+ });
var wrappers2 = new GlobalComWrappers();
Assert.Throws<InvalidOperationException>(
() =>
{
ComWrappers.RegisterForMarshalling(wrappers2);
- }, "Should not be able to reset for global ComWrappers");
+ });
}
private static void ValidateRegisterForTrackerSupport()
() =>
{
ComWrappers.RegisterForTrackerSupport(wrappers1);
- }, "Should not be able to re-register for global ComWrappers");
+ });
var wrappers2 = new GlobalComWrappers();
Assert.Throws<InvalidOperationException>(
() =>
{
ComWrappers.RegisterForTrackerSupport(wrappers2);
- }, "Should not be able to reset for global ComWrappers");
+ });
}
private static void ValidateMarshalAPIs(bool validateUseRegistered)
var testObj = new Test();
IntPtr comWrapper1 = Marshal.GetIUnknownForObject(testObj);
- Assert.AreNotEqual(IntPtr.Zero, comWrapper1);
- Assert.AreEqual(testObj, registeredWrapper.LastComputeVtablesObject, "Registered ComWrappers instance should have been called");
+ Assert.NotEqual(IntPtr.Zero, comWrapper1);
+ Assert.Equal(testObj, registeredWrapper.LastComputeVtablesObject);
IntPtr comWrapper2 = Marshal.GetIUnknownForObject(testObj);
- Assert.AreEqual(comWrapper1, comWrapper2);
+ Assert.Equal(comWrapper1, comWrapper2);
Marshal.Release(comWrapper1);
Marshal.Release(comWrapper2);
{
var dispatchObj = new TestEx(IID_IDISPATCH);
IntPtr dispatchWrapper = Marshal.GetIDispatchForObject(dispatchObj);
- Assert.AreNotEqual(IntPtr.Zero, dispatchWrapper);
- Assert.AreEqual(dispatchObj, registeredWrapper.LastComputeVtablesObject, "Registered ComWrappers instance should have been called");
+ Assert.NotEqual(IntPtr.Zero, dispatchWrapper);
+ Assert.Equal(dispatchObj, registeredWrapper.LastComputeVtablesObject);
Console.WriteLine($" -- Validate Marshal.GetIDispatchForObject != Marshal.GetIUnknownForObject...");
IntPtr unknownWrapper = Marshal.GetIUnknownForObject(dispatchObj);
- Assert.AreNotEqual(IntPtr.Zero, unknownWrapper);
- Assert.AreNotEqual(unknownWrapper, dispatchWrapper);
+ Assert.NotEqual(IntPtr.Zero, unknownWrapper);
+ Assert.NotEqual(unknownWrapper, dispatchWrapper);
}
Console.WriteLine($" -- Validate Marshal.GetObjectForIUnknown...");
IntPtr trackerObjRaw = MockReferenceTrackerRuntime.CreateTrackerObject();
object objWrapper1 = Marshal.GetObjectForIUnknown(trackerObjRaw);
- Assert.AreEqual(validateUseRegistered, objWrapper1 is FakeWrapper, $"GetObjectForIUnknown should{(validateUseRegistered ? string.Empty : "not")} have returned {nameof(FakeWrapper)} instance");
+ Assert.Equal(validateUseRegistered, objWrapper1 is FakeWrapper);
object objWrapper2 = Marshal.GetObjectForIUnknown(trackerObjRaw);
- Assert.AreEqual(objWrapper1, objWrapper2);
+ Assert.Equal(objWrapper1, objWrapper2);
Console.WriteLine($" -- Validate Marshal.GetUniqueObjectForIUnknown...");
object objWrapper3 = Marshal.GetUniqueObjectForIUnknown(trackerObjRaw);
- Assert.AreEqual(validateUseRegistered, objWrapper3 is FakeWrapper, $"GetObjectForIUnknown should{(validateUseRegistered ? string.Empty : "not")} have returned {nameof(FakeWrapper)} instance");
+ Assert.Equal(validateUseRegistered, objWrapper3 is FakeWrapper);
- Assert.AreNotEqual(objWrapper1, objWrapper3);
+ Assert.NotEqual(objWrapper1, objWrapper3);
Marshal.Release(trackerObjRaw);
}
Console.WriteLine($" -- Validate MarshalAs IUnknown...");
ValidateInterfaceMarshaler<object>(MarshalInterface.UpdateTestObjectAsIUnknown, shouldSucceed: validateUseRegistered);
object obj = MarshalInterface.CreateTrackerObjectAsIUnknown();
- Assert.AreEqual(validateUseRegistered, obj is FakeWrapper, $"Should{(validateUseRegistered ? string.Empty : "not")} have returned {nameof(FakeWrapper)} instance");
+ Assert.Equal(validateUseRegistered, obj is FakeWrapper);
if (validateUseRegistered)
{
Assert.Throws<InvalidCastException>(() => MarshalInterface.CreateTrackerObjectWrongType());
FakeWrapper wrapper = MarshalInterface.CreateTrackerObjectAsInterface();
- Assert.IsNotNull(wrapper, $"Should have returned {nameof(FakeWrapper)} instance");
+ Assert.NotNull(wrapper);
}
}
T retObj;
int hr = func(testObj as T, value, out retObj);
- Assert.AreEqual(testObj, GlobalComWrappers.Instance.LastComputeVtablesObject, "Registered ComWrappers instance should have been called");
+ Assert.Equal(testObj, GlobalComWrappers.Instance.LastComputeVtablesObject);
if (shouldSucceed)
{
- Assert.IsTrue(retObj is Test);
- Assert.AreEqual(value, testObj.GetValue());
- Assert.AreEqual<object>(testObj, retObj);
+ Assert.True(retObj is Test);
+ Assert.Equal(value, testObj.GetValue());
+ Assert.Equal<object>(testObj, retObj);
}
else
{
- Assert.AreEqual(E_NOINTERFACE, hr);
+ Assert.Equal(E_NOINTERFACE, hr);
}
}
Type t= Type.GetTypeFromCLSID(Guid.Parse(Server.Contract.Guids.DispatchTesting));
var server = Activator.CreateInstance(t);
- Assert.AreEqual(returnValid, server is FakeWrapper, $"Should{(returnValid ? string.Empty : "not")} have returned {nameof(FakeWrapper)} instance");
+ Assert.Equal(returnValid, server is FakeWrapper);
IntPtr ptr = Marshal.GetIUnknownForObject(server);
var obj = Marshal.GetObjectForIUnknown(ptr);
- Assert.AreEqual(server, obj);
+ Assert.Equal(server, obj);
}
private static void ValidateManagedServerActivation()
{
Type t = Type.GetTypeFromCLSID(Guid.Parse(Server.Contract.Guids.ConsumeNETServerTesting));
var server = Activator.CreateInstance(t);
- Assert.AreEqual(returnValid, server is FakeWrapper, $"Should{(returnValid ? string.Empty : "not")} have returned {nameof(FakeWrapper)} instance");
+ Assert.Equal(returnValid, server is FakeWrapper);
object serverUnwrapped = GlobalComWrappers.Instance.LastComputeVtablesObject;
- Assert.AreEqual(ManagedServerTypeName, serverUnwrapped.GetType().Name);
+ Assert.Equal(ManagedServerTypeName, serverUnwrapped.GetType().Name);
IntPtr ptr = Marshal.GetIUnknownForObject(server);
var obj = Marshal.GetObjectForIUnknown(ptr);
- Assert.AreEqual(server, obj);
- Assert.AreEqual(returnValid, obj is FakeWrapper, $"Should{(returnValid ? string.Empty : "not")} have returned {nameof(FakeWrapper)} instance");
+ Assert.Equal(server, obj);
+ Assert.Equal(returnValid, obj is FakeWrapper);
serverUnwrapped.GetType().GetMethod("NotEqualByRCW").Invoke(serverUnwrapped, new object[] { obj });
}
}
// Trigger the thread lifetime end API and verify the callback occurs.
int hr = MockReferenceTrackerRuntime.Trigger_NotifyEndOfReferenceTrackingOnThread();
- Assert.AreEqual(GlobalComWrappers.ReleaseObjectsCallAck, hr);
+ Assert.Equal(GlobalComWrappers.ReleaseObjectsCallAck, hr);
}
}
}
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
- using TestLibrary;
+ using Xunit;
static class WeakReferenceNative
{
{
WeakReferenceableWrapper target;
bool isAlive = wr.TryGetTarget(out target);
- Assert.AreEqual(expectedIsAlive, isAlive);
+ Assert.Equal(expectedIsAlive, isAlive);
if (isAlive && sourceWrappers != null)
- Assert.AreEqual(sourceWrappers.Registration, target.Registration);
+ Assert.Equal(sourceWrappers.Registration, target.Registration);
}
private static (WeakReference<WeakReferenceableWrapper>, IntPtr) GetWeakReference(TestComWrappers cw)
// A weak reference to an RCW wrapping an IWeakReference created throguh the built-in system
// should stay alive even after the RCW dies
- Assert.IsFalse(weakRef.IsAlive);
- Assert.IsTrue(HasTarget(weakRef));
+ Assert.False(weakRef.IsAlive);
+ Assert.True(HasTarget(weakRef));
// Release the last native reference.
Marshal.Release(nativeRef);
GC.WaitForPendingFinalizers();
// After all native references die and the RCW is collected, the weak reference should be dead and stay dead.
- Assert.IsNull(weakRef.Target);
+ Assert.Null(weakRef.Target);
}
static void ValidateAggregatedWeakReference()
{
using System;
using System.Runtime.InteropServices;
- using TestLibrary;
+ using Xunit;
internal class BasicTest
{
int expected = val * 2;
// Invoke default member
- Assert.AreEqual(expected, obj(val));
- Assert.AreEqual(expected, obj.Default(val));
+ Assert.Equal(expected, obj(val));
+ Assert.Equal(expected, obj.Default(val));
}
private void Boolean()
{
// Get and set property
obj.Boolean_Property = true;
- Assert.IsTrue(obj.Boolean_Property);
+ Assert.True(obj.Boolean_Property);
// Call method with return value
- Assert.IsFalse(obj.Boolean_Inverse_Ret(true));
+ Assert.False(obj.Boolean_Inverse_Ret(true));
// Call method passing by ref
bool inout = true;
obj.Boolean_Inverse_InOut(ref inout);
- Assert.IsFalse(inout);
+ Assert.False(inout);
// Pass as variant
Variant<bool>(true, false);
// Get and set property
obj.SByte_Property = val;
- Assert.AreEqual(val, obj.SByte_Property);
+ Assert.Equal(val, obj.SByte_Property);
// Call method with return value
- Assert.AreEqual(expected, obj.SByte_Doubled_Ret(val));
+ Assert.Equal(expected, obj.SByte_Doubled_Ret(val));
// Call method passing by ref
sbyte inout = val;
obj.SByte_Doubled_InOut(ref inout);
- Assert.AreEqual(expected, inout);
+ Assert.Equal(expected, inout);
// Pass as variant
Variant<sbyte>(val, expected);
// Get and set property
obj.Byte_Property = val;
- Assert.AreEqual(val, obj.Byte_Property);
+ Assert.Equal(val, obj.Byte_Property);
// Call method with return value
- Assert.AreEqual(expected, obj.Byte_Doubled_Ret(val));
+ Assert.Equal(expected, obj.Byte_Doubled_Ret(val));
// Call method passing by ref
byte inout = val;
obj.Byte_Doubled_InOut(ref inout);
- Assert.AreEqual(expected, inout);
+ Assert.Equal(expected, inout);
// Pass as variant
Variant<byte>(val, expected);
// Get and set property
obj.Short_Property = val;
- Assert.AreEqual(val, obj.Short_Property);
+ Assert.Equal(val, obj.Short_Property);
// Call method with return value
- Assert.AreEqual(expected, obj.Short_Doubled_Ret(val));
+ Assert.Equal(expected, obj.Short_Doubled_Ret(val));
// Call method passing by ref
short inout = val;
obj.Short_Doubled_InOut(ref inout);
- Assert.AreEqual(expected, inout);
+ Assert.Equal(expected, inout);
// Pass as variant
Variant<short>(val, expected);
// Get and set property
obj.UShort_Property = val;
- Assert.AreEqual(val, obj.UShort_Property);
+ Assert.Equal(val, obj.UShort_Property);
// Call method with return value
- Assert.AreEqual(expected, obj.UShort_Doubled_Ret(val));
+ Assert.Equal(expected, obj.UShort_Doubled_Ret(val));
// Call method passing by ref
ushort inout = val;
obj.UShort_Doubled_InOut(ref inout);
- Assert.AreEqual(expected, inout);
+ Assert.Equal(expected, inout);
// Pass as variant
Variant<ushort>(val, expected);
// Get and set property
obj.Int_Property = val;
- Assert.AreEqual(val, obj.Int_Property);
+ Assert.Equal(val, obj.Int_Property);
// Call method with return value
- Assert.AreEqual(expected, obj.Int_Doubled_Ret(val));
+ Assert.Equal(expected, obj.Int_Doubled_Ret(val));
// Call method passing by ref
int inout = val;
obj.Int_Doubled_InOut(ref inout);
- Assert.AreEqual(expected, inout);
+ Assert.Equal(expected, inout);
// Pass as variant
Variant<int>(val, expected);
// Get and set property
obj.UInt_Property = val;
- Assert.AreEqual(val, obj.UInt_Property);
+ Assert.Equal(val, obj.UInt_Property);
// Call method with return value
- Assert.AreEqual(expected, obj.UInt_Doubled_Ret(val));
+ Assert.Equal(expected, obj.UInt_Doubled_Ret(val));
// Call method passing by ref
uint inout = val;
obj.UInt_Doubled_InOut(ref inout);
- Assert.AreEqual(expected, inout);
+ Assert.Equal(expected, inout);
// Pass as variant
Variant<uint>(val, expected);
// Get and set property
obj.Int64_Property = val;
- Assert.AreEqual(val, obj.Int64_Property);
+ Assert.Equal(val, obj.Int64_Property);
// Call method with return value
- Assert.AreEqual(expected, obj.Int64_Doubled_Ret(val));
+ Assert.Equal(expected, obj.Int64_Doubled_Ret(val));
// Call method passing by ref
long inout = val;
obj.Int64_Doubled_InOut(ref inout);
- Assert.AreEqual(expected, inout);
+ Assert.Equal(expected, inout);
// Pass as variant
Variant<long>(val, expected);
// Get and set property
obj.UInt64_Property = val;
- Assert.AreEqual(val, obj.UInt64_Property);
+ Assert.Equal(val, obj.UInt64_Property);
// Call method with return value
- Assert.AreEqual(expected, obj.UInt64_Doubled_Ret(val));
+ Assert.Equal(expected, obj.UInt64_Doubled_Ret(val));
// Call method passing by ref
ulong inout = val;
obj.UInt64_Doubled_InOut(ref inout);
- Assert.AreEqual(expected, inout);
+ Assert.Equal(expected, inout);
// Pass as variant
Variant<ulong>(val, expected);
// Get and set property
obj.Float_Property = val;
- Assert.AreEqual(val, obj.Float_Property);
+ Assert.Equal(val, obj.Float_Property);
// Call method with return value
- Assert.AreEqual(expected, obj.Float_Ceil_Ret(val));
+ Assert.Equal(expected, obj.Float_Ceil_Ret(val));
// Call method passing by ref
float inout = val;
obj.Float_Ceil_InOut(ref inout);
- Assert.AreEqual(expected, inout);
+ Assert.Equal(expected, inout);
// Pass as variant
Variant<float>(val, expected);
// Get and set property
obj.Double_Property = val;
- Assert.AreEqual(val, obj.Double_Property);
+ Assert.Equal(val, obj.Double_Property);
// Call method with return value
- Assert.AreEqual(expected, obj.Double_Ceil_Ret(val));
+ Assert.Equal(expected, obj.Double_Ceil_Ret(val));
// Call method passing by ref
double inout = val;
obj.Double_Ceil_InOut(ref inout);
- Assert.AreEqual(expected, inout);
+ Assert.Equal(expected, inout);
// Pass as variant
Variant<double>(val, expected);
// Get and set property
obj.Variant_Property = val;
- Assert.AreEqual(valRaw, obj.Variant_Property);
+ Assert.Equal(valRaw, obj.Variant_Property);
// Call method with return value
- Assert.AreEqual(expectedRaw, obj.Variant_Ret(val));
+ Assert.Equal(expectedRaw, obj.Variant_Ret(val));
// Call method passing by ref
IntPtr inout = val;
obj.Variant_InOut(ref inout);
- Assert.AreEqual(expected, inout);
+ Assert.Equal(expected, inout);
}
private void UIntPtr()
// Get and set property
obj.Variant_Property = val;
- Assert.AreEqual(valRaw, obj.Variant_Property);
+ Assert.Equal(valRaw, obj.Variant_Property);
// Call method with return value
- Assert.AreEqual(expectedRaw, obj.Variant_Ret(val));
+ Assert.Equal(expectedRaw, obj.Variant_Ret(val));
// Call method passing by ref
UIntPtr inout = val;
obj.Variant_InOut(ref inout);
- Assert.AreEqual(expected, inout);
+ Assert.Equal(expected, inout);
}
private void String()
// Get and set property
obj.String_Property = val;
- Assert.AreEqual(val, obj.String_Property);
+ Assert.Equal(val, obj.String_Property);
// Call method with return value
- Assert.AreEqual(expected, obj.String_Reverse_Ret(val));
+ Assert.Equal(expected, obj.String_Reverse_Ret(val));
// Call method passing by ref
string inout = val;
obj.String_Reverse_InOut(ref inout);
- Assert.AreEqual(expected, inout);
+ Assert.Equal(expected, inout);
// Pass as variant
Variant<string>(val, expected);
// Get and set property
obj.Date_Property = val;
- Assert.AreEqual(val, obj.Date_Property);
+ Assert.Equal(val, obj.Date_Property);
// Call method with return value
- Assert.AreEqual(expected, obj.Date_AddDay_Ret(val));
+ Assert.Equal(expected, obj.Date_AddDay_Ret(val));
// Call method passing by ref
DateTime inout = val;
obj.Date_AddDay_InOut(ref inout);
- Assert.AreEqual(expected, inout);
+ Assert.Equal(expected, inout);
// Pass as variant
Variant<DateTime>(val, expected);
// Get and set property
obj.Dispatch_Property = val;
- Assert.AreEqual(val, obj.Dispatch_Property);
+ Assert.Equal(val, obj.Dispatch_Property);
// Update dispatch object
obj.Dispatch_Property.Boolean_Property = false;
- Assert.IsFalse(obj.Dispatch_Property.Boolean_Property);
- Assert.IsFalse(val.Boolean_Property);
+ Assert.False(obj.Dispatch_Property.Boolean_Property);
+ Assert.False(val.Boolean_Property);
// Call method with return value
dynamic ret = obj.Dispatch_Ret(val);
- Assert.IsTrue(ret.Boolean_Property);
- Assert.IsFalse(val.Boolean_Property);
+ Assert.True(ret.Boolean_Property);
+ Assert.False(val.Boolean_Property);
// Call method passing by ref
obj.Dispatch_InOut(ref val);
- Assert.IsTrue(val.Boolean_Property);
+ Assert.True(val.Boolean_Property);
val.Boolean_Property = false;
- Variant(val, new Action<dynamic>(d => Assert.IsTrue(d.Boolean_Property)));
- Assert.IsTrue(val.Boolean_Property);
+ Variant(val, new Action<dynamic>(d => Assert.True(d.Boolean_Property)));
+ Assert.True(val.Boolean_Property);
val.Boolean_Property = false;
UnknownWrapper(val);
private void Null()
{
obj.Variant_Property = null;
- Assert.IsNull(obj.Variant_Property);
+ Assert.Null(obj.Variant_Property);
obj.String_Property = null;
- Assert.AreEqual(string.Empty, obj.String_Property);
+ Assert.Equal(string.Empty, obj.String_Property);
}
private void StringWrapper(string toWrap, string expected)
// Get and set property
obj.String_Property = val;
- Assert.AreEqual(val.WrappedObject, obj.String_Property);
+ Assert.Equal(val.WrappedObject, obj.String_Property);
// Call method with return value
- Assert.AreEqual(expected, obj.String_Reverse_Ret(val));
+ Assert.Equal(expected, obj.String_Reverse_Ret(val));
// Call method passing by ref
BStrWrapper inout = new BStrWrapper(val.WrappedObject);
obj.String_Reverse_InOut(ref inout);
- Assert.AreEqual(expected, inout.WrappedObject);
+ Assert.Equal(expected, inout.WrappedObject);
}
private void UnknownWrapper(dynamic toWrap)
// Get and set property
obj.Variant_Property = val;
- Assert.AreEqual(val.WrappedObject, obj.Variant_Property);
+ Assert.Equal(val.WrappedObject, obj.Variant_Property);
// Call method with return value
dynamic ret = obj.Variant_Ret(val);
- Assert.IsTrue(ret.Boolean_Property);
- Assert.IsTrue(toWrap.Boolean_Property);
+ Assert.True(ret.Boolean_Property);
+ Assert.True(toWrap.Boolean_Property);
// Call method passing by ref
obj.Variant_InOut(ref val);
- Assert.IsTrue(toWrap.Boolean_Property);
+ Assert.True(toWrap.Boolean_Property);
}
private void ErrorWrapper()
// Get and set property
obj.Variant_Property = val;
- Assert.AreEqual(val.ErrorCode, obj.Variant_Property);
+ Assert.Equal(val.ErrorCode, obj.Variant_Property);
}
#pragma warning disable 618 // CurrencyWrapper is marked obsolete
// Get and set property
obj.Variant_Property = val;
- Assert.AreEqual(val.WrappedObject, obj.Variant_Property);
+ Assert.Equal(val.WrappedObject, obj.Variant_Property);
}
#pragma warning restore 618
// Get and set property
obj.Variant_Property = val;
- Assert.AreEqual(val.WrappedObject, obj.Variant_Property);
+ Assert.Equal(val.WrappedObject, obj.Variant_Property);
// Call method with return value
dynamic ret = obj.Variant_Ret(val);
- Assert.AreEqual(expected, ret);
+ Assert.Equal(expected, ret);
// Call method passing by ref
obj.Variant_InOut(ref val);
- Assert.AreEqual(expected, val.WrappedObject);
+ Assert.Equal(expected, val.WrappedObject);
}
private void Variant<T>(T val, Action<T> validate)
{
// Get and set property
obj.Variant_Property = val;
- Assert.AreEqual(val, obj.Variant_Property);
+ Assert.Equal(val, obj.Variant_Property);
// Call method with return value
validate(obj.Variant_Ret(val));
private void Variant<T>(T val, T expected)
{
- Variant<T>(val, v => Assert.AreEqual(expected, v));
+ Variant<T>(val, v => Assert.Equal(expected, v));
}
private void Fail()
const int E_ABORT = unchecked((int)0x80004004);
string message = "CUSTOM ERROR MESSAGE";
COMException comException = Assert.Throws<COMException>(() => obj.Fail(E_ABORT, message));
- Assert.AreEqual(E_ABORT, comException.HResult, "Unexpected HRESULT on COMException");
- Assert.AreEqual(message, comException.Message, "Unexpected message on COMException");
+ Assert.Equal(E_ABORT, comException.HResult);
+ Assert.Equal(message, comException.Message);
Assert.Throws<SEHException>(() => obj.Throw());
}
{
using System;
using System.Collections.Generic;
- using TestLibrary;
+ using Xunit;
internal class CollectionTest
{
}
// Call method returning array
- Assert.AreAllEqual(expected, obj.Array_PlusOne_Ret(array));
+ AssertExtensions.CollectionEqual(expected, obj.Array_PlusOne_Ret(array));
// Call method with array in/out
int[] inout = new int[len];
System.Array.Copy(array, inout, len);
obj.Array_PlusOne_InOut(ref inout);
- Assert.AreAllEqual(expected, inout);
+ AssertExtensions.CollectionEqual(expected, inout);
// Call method returning array as variant
- Assert.AreAllEqual(expected, obj.ArrayVariant_PlusOne_Ret(array));
+ AssertExtensions.CollectionEqual(expected, obj.ArrayVariant_PlusOne_Ret(array));
// Call method with array as variant in/out
inout = new int[len];
System.Array.Copy(array, inout, len);
obj.ArrayVariant_PlusOne_InOut(ref inout);
- Assert.AreAllEqual(expected, inout);
+ AssertExtensions.CollectionEqual(expected, inout);
}
private void CustomCollection()
{
// Add to the collection
- Assert.AreEqual(0, obj.Count);
+ Assert.Equal(0, obj.Count);
string[] array = { "ONE", "TWO", "THREE" };
foreach (string s in array)
{
}
// Get item by index
- Assert.AreEqual(array[0], obj[0]);
- Assert.AreEqual(array[0], obj.Item(0));
- Assert.AreEqual(array[0], obj.Item[0]);
- Assert.AreEqual(array[1], obj[1]);
- Assert.AreEqual(array[1], obj.Item(1));
- Assert.AreEqual(array[2], obj[2]);
- Assert.AreEqual(array[2], obj.Item(2));
- Assert.AreEqual(array.Length, obj.Count);
+ Assert.Equal(array[0], obj[0]);
+ Assert.Equal(array[0], obj.Item(0));
+ Assert.Equal(array[0], obj.Item[0]);
+ Assert.Equal(array[1], obj[1]);
+ Assert.Equal(array[1], obj.Item(1));
+ Assert.Equal(array[2], obj[2]);
+ Assert.Equal(array[2], obj.Item(2));
+ Assert.Equal(array.Length, obj.Count);
// Enumerate collection
List<string> list = new List<string>();
{
list.Add((string)enumerator.Current);
}
- Assert.AreAllEqual(array, list);
+ AssertExtensions.CollectionEqual(array, list);
list.Clear();
enumerator.Reset();
{
list.Add((string)enumerator.Current);
}
- Assert.AreAllEqual(array, list);
+ AssertExtensions.CollectionEqual(array, list);
// Iterate over object that handles DISPID_NEWENUM
list.Clear();
{
list.Add(str);
}
- Assert.AreAllEqual(array, list);
+ AssertExtensions.CollectionEqual(array, list);
array = new string[] { "NEW_ONE", "NEW_TWO", "NEW_THREE" };
// Update items by index
obj[0] = array[0];
- Assert.AreEqual(array[0], obj[0]);
+ Assert.Equal(array[0], obj[0]);
obj[1] = array[1];
- Assert.AreEqual(array[1], obj[1]);
+ Assert.Equal(array[1], obj[1]);
obj[2] = array[2];
- Assert.AreEqual(array[2], obj[2]);
- Assert.AreEqual(array.Length, obj.Count);
+ Assert.Equal(array[2], obj[2]);
+ Assert.Equal(array.Length, obj.Count);
list.Clear();
foreach (string str in obj)
{
list.Add(str);
}
- Assert.AreAllEqual(array, list);
+ AssertExtensions.CollectionEqual(array, list);
// Remove item
obj.Remove(1);
- Assert.AreEqual(2, obj.Count);
- Assert.AreEqual(array[0], obj[0]);
- Assert.AreEqual(array[2], obj[1]);
+ Assert.Equal(2, obj.Count);
+ Assert.Equal(array[0], obj[0]);
+ Assert.Equal(array[2], obj[1]);
// Clear collection
obj.Clear();
- Assert.AreEqual(0, obj.Count);
+ Assert.Equal(0, obj.Count);
}
private void IndexChain()
dynamic collection = obj.GetDispatchCollection();
collection.Add(collection);
- Assert.AreEqual(1, collection.Item[0][0][0].Count);
+ Assert.Equal(1, collection.Item[0][0][0].Count);
collection[0].Add(obj);
- Assert.AreEqual(2, collection.Count);
- Assert.AreEqual(2, collection[0].Item[1].GetDispatchCollection()[0].Count);
+ Assert.Equal(2, collection.Count);
+ Assert.Equal(2, collection[0].Item[1].GetDispatchCollection()[0].Count);
}
}
}
namespace Dynamic
{
using System;
- using TestLibrary;
+ using Xunit;
internal class EventTest
{
public void Validate(bool called, int id = InvalidId)
{
- Assert.AreEqual(called, _eventReceived, $"Event handler should {(called ? "" : "not ")}have been called");
- Assert.AreEqual(id, _id, "Unexpected event arguments received");
+ Assert.Equal(called, _eventReceived);
+ Assert.Equal(id, _id);
}
public void ValidateMessage(bool called, string message = "")
{
- Assert.AreEqual(called, _eventMessageReceived, $"Event handler should {(called ? "" : "not ")}have been called");
- Assert.AreEqual(message, _message, "Unexpected event arguments received");
+ Assert.Equal(called, _eventMessageReceived);
+ Assert.Equal(message, _message);
}
}
}
using System;
using System.Runtime.InteropServices;
using TestLibrary;
+ using Xunit;
internal class NETServerTest
{
try
{
- Assert.IsTrue(obj.EqualByCCW(obj));
- Assert.IsTrue(obj.NotEqualByRCW(obj));
+ Assert.True(obj.EqualByCCW(obj));
+ Assert.True(obj.NotEqualByRCW(obj));
}
finally
{
{
using System;
using System.Runtime.InteropServices;
- using TestLibrary;
+ using Xunit;
internal class ParametersTest
{
// Name all arguments
int[] ret = obj.Required(first: one, second: two, third: three);
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with all named arguments");
+ AssertExtensions.CollectionEqual(expected, ret);
// Name some arguments
ret = obj.Required(one, two, third: three);
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with some named arguments");
+ AssertExtensions.CollectionEqual(expected, ret);
ret = obj.Required(one, second: two, third: three);
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with some named arguments");
+ AssertExtensions.CollectionEqual(expected, ret);
// Name in different order
ret = obj.Required(third: three, first: one, second: two);
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with out-of-order named arguments");
+ AssertExtensions.CollectionEqual(expected, ret);
ret = obj.Required(one, third: three, second: two);
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with out-of-order named arguments");
+ AssertExtensions.CollectionEqual(expected, ret);
// Invalid name
COMException e = Assert.Throws<COMException>(() => obj.Required(one, two, invalid: three));
const int DISP_E_UNKNOWNNAME = unchecked((int)0x80020006);
- Assert.AreEqual(DISP_E_UNKNOWNNAME, e.HResult, "Unexpected HRESULT on COMException");
+ Assert.Equal(DISP_E_UNKNOWNNAME, e.HResult);
}
private void DefaultValue()
// Omit all arguments
int[] ret = obj.DefaultValue();
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with all arguments omitted");
+ AssertExtensions.CollectionEqual(expected, ret);
// Specify some arguments
expected[0] = one;
ret = obj.DefaultValue(one);
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with some arguments specified");
+ AssertExtensions.CollectionEqual(expected, ret);
expected[1] = two;
ret = obj.DefaultValue(one, two);
- Assert.AreAllEqual(expected, ret);
+ AssertExtensions.CollectionEqual(expected, ret);
// Specify all arguments
expected[1] = two;
expected[2] = three;
ret = obj.DefaultValue(one, two, three);
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with all arguments specified");
+ AssertExtensions.CollectionEqual(expected, ret);
// Named arguments
expected[0] = Default1;
expected[1] = Default2;
ret = obj.DefaultValue(third: three);
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with named arguments");
+ AssertExtensions.CollectionEqual(expected, ret);
}
private void Optional()
// Omit all arguments
int[] ret = obj.Optional();
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with all arguments omitted");
+ AssertExtensions.CollectionEqual(expected, ret);
// Specify some arguments
expected[0] = one;
ret = obj.Optional(one);
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with some arguments specified");
+ AssertExtensions.CollectionEqual(expected, ret);
expected[1] = Default2;
ret = obj.Mixed(one);
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with some arguments specified");
+ AssertExtensions.CollectionEqual(expected, ret);
expected[1] = two;
ret = obj.Optional(one, two);
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with some arguments specified");
+ AssertExtensions.CollectionEqual(expected, ret);
ret = obj.Mixed(one, two);
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with some arguments specified");
+ AssertExtensions.CollectionEqual(expected, ret);
// Specify all arguments
expected[1] = two;
expected[2] = three;
ret = obj.Optional(one, two, three);
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with all arguments specified");
+ AssertExtensions.CollectionEqual(expected, ret);
ret = obj.Mixed(one, two, three);
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with all arguments specified");
+ AssertExtensions.CollectionEqual(expected, ret);
// Named arguments
expected[1] = MissingParamId;
ret = obj.Optional(first: one, third: three);
- Assert.AreAllEqual(expected, ret, "Unexpected result calling function with named arguments");
+ AssertExtensions.CollectionEqual(expected, ret);
}
private void VarArgs()
{
VarEnum[] ret = obj.VarArgs();
- Assert.AreEqual(0, ret.Length);
+ Assert.Equal(0, ret.Length);
// COM server returns the type of each variant
ret = obj.VarArgs(false);
- Assert.AreEqual(1, ret.Length);
- Assert.AreAllEqual(new [] { VarEnum.VT_BOOL }, ret);
+ Assert.Equal(1, ret.Length);
+ AssertExtensions.CollectionEqual(new [] { VarEnum.VT_BOOL }, ret);
VarEnum[] expected = { VarEnum.VT_BSTR, VarEnum.VT_R8, VarEnum.VT_DATE, VarEnum.VT_I4 };
ret = obj.VarArgs("s", 10d, new DateTime(), 10);
- Assert.AreEqual(expected.Length, ret.Length);
- Assert.AreAllEqual(expected, ret);
+ Assert.Equal(expected.Length, ret.Length);
+ AssertExtensions.CollectionEqual(expected, ret);
}
private void Invalid()
{
using System;
using TestLibrary;
+ using Xunit;
class Program
{
using System.Runtime.InteropServices;
using TestLibrary;
+ using Xunit;
using Server.Contract;
using Server.Contract.Servers;
var managedInner = new ManagedInner();
var nativeOuter = (AggregationTesting)managedInner;
- Assert.IsTrue(typeof(ManagedInner).IsCOMObject);
- Assert.IsTrue(typeof(AggregationTestingClass).IsCOMObject);
- Assert.IsFalse(typeof(AggregationTesting).IsCOMObject);
- Assert.IsTrue(Marshal.IsComObject(managedInner));
- Assert.IsTrue(Marshal.IsComObject(nativeOuter));
+ Assert.True(typeof(ManagedInner).IsCOMObject);
+ Assert.True(typeof(AggregationTestingClass).IsCOMObject);
+ Assert.False(typeof(AggregationTesting).IsCOMObject);
+ Assert.True(Marshal.IsComObject(managedInner));
+ Assert.True(Marshal.IsComObject(nativeOuter));
- Assert.IsTrue(nativeOuter.IsAggregated());
- Assert.IsTrue(nativeOuter.AreAggregated(managedInner, nativeOuter));
- Assert.IsFalse(nativeOuter.AreAggregated(nativeOuter, new object()));
+ Assert.True(nativeOuter.IsAggregated());
+ Assert.True(nativeOuter.AreAggregated(managedInner, nativeOuter));
+ Assert.False(nativeOuter.AreAggregated(nativeOuter, new object()));
}
static int Main(string[] doNotUse)
using System.Runtime.InteropServices;
using TestLibrary;
+ using Xunit;
using Server.Contract;
using CoClass = Server.Contract.Servers;
test.ReleaseResources();
// The CoClass should be the activated type, _not_ the activation interface.
- Assert.AreEqual(test.GetType(), typeof(CoClass.ConsumeNETServerTestingClass));
- Assert.IsTrue(typeof(CoClass.ConsumeNETServerTestingClass).IsCOMObject);
- Assert.IsFalse(typeof(CoClass.ConsumeNETServerTesting).IsCOMObject);
- Assert.IsTrue(Marshal.IsComObject(test));
+ Assert.Equal(test.GetType(), typeof(CoClass.ConsumeNETServerTestingClass));
+ Assert.True(typeof(CoClass.ConsumeNETServerTestingClass).IsCOMObject);
+ Assert.False(typeof(CoClass.ConsumeNETServerTesting).IsCOMObject);
+ Assert.True(Marshal.IsComObject(test));
}
static void Validate_Activation_CreateInstance()
Console.WriteLine($"{nameof(Validate_Activation_CreateInstance)}...");
Type t = Type.GetTypeFromCLSID(Guid.Parse(Guids.ConsumeNETServerTesting));
- Assert.IsTrue(t.IsCOMObject);
+ Assert.True(t.IsCOMObject);
object obj = Activator.CreateInstance(t);
var test = (CoClass.ConsumeNETServerTesting)obj;
test.ReleaseResources();
-
- Assert.IsTrue(Marshal.IsComObject(test));
+
+ Assert.True(Marshal.IsComObject(test));
// Use the overload that takes constructor arguments. This tests the path where the runtime searches for the
// constructor to use (which has some special-casing for COM) instead of just always using the default.
test = (CoClass.ConsumeNETServerTesting)obj;
test.ReleaseResources();
- Assert.IsTrue(Marshal.IsComObject(test));
+ Assert.True(Marshal.IsComObject(test));
}
static void Validate_CCW_Wasnt_Unwrapped()
// The CoClass should be the activated type, _not_ the implementation class.
// This indicates the real implementation class is wrapped in its CCW and exposed
// to the runtime as an RCW.
- Assert.AreNotEqual(test.GetType(), typeof(ConsumeNETServerTesting));
+ Assert.NotEqual(test.GetType(), typeof(ConsumeNETServerTesting));
}
static void Validate_Client_CCW_RCW()
ccw = test.GetCCW();
object rcw = Marshal.GetObjectForIUnknown(ccw);
object inst = test.GetRCW();
- Assert.AreEqual(rcw, inst);
+ Assert.Equal(rcw, inst);
}
finally
{
var test = new CoClass.ConsumeNETServerTesting();
try
{
- Assert.IsTrue(test.EqualByCCW(test));
- Assert.IsTrue(test.NotEqualByRCW(test));
+ Assert.True(test.EqualByCCW(test));
+ Assert.True(test.NotEqualByRCW(test));
}
finally
{
using System.Runtime.InteropServices;
using TestLibrary;
+ using Xunit;
using Server.Contract;
using Server.Contract.Servers;
using Server.Contract.Events;
string message = string.Empty;
eventTesting.FireEvent();
- Assert.IsTrue(eventFired, "Event didn't fire");
- Assert.AreEqual(nameof(EventTesting.FireEvent), message, "Event message is incorrect");
+ Assert.True(eventFired);
+ Assert.Equal(nameof(EventTesting.FireEvent), message);
// Remove event
eventTesting.OnEvent -= OnEventEventHandler;
eventFired = false;
eventTesting.FireEvent();
- Assert.IsFalse(eventFired, "Event shouldn't fire");
+ Assert.False(eventFired);
void OnEventEventHandler(string msg)
{
string message = string.Empty;
eventTesting.FireEvent();
- Assert.IsTrue(eventFired, "Event didn't fire");
- Assert.AreEqual(nameof(EventTesting.FireEvent), message, "Event message is incorrect");
+ Assert.True(eventFired);
+ Assert.Equal(nameof(EventTesting.FireEvent), message);
comAwareEventInfo.RemoveEventHandler(eventTesting, handler);
eventFired = false;
eventTesting.FireEvent();
- Assert.IsFalse(eventFired, "Event shouldn't fire");
+ Assert.False(eventFired);
void OnEventEventHandler(string msg)
{
using System.Runtime.InteropServices;
using TestLibrary;
+ using Xunit;
using Server.Contract;
using Server.Contract.Servers;
ul1, ref ul2);
Console.WriteLine($"Call to {nameof(DispatchTesting.DoubleNumeric_ReturnByRef)} complete");
- Assert.AreEqual(b1 * 2, b2);
- Assert.AreEqual(s1 * 2, s2);
- Assert.AreEqual(us1 * 2, us2);
- Assert.AreEqual(i1 * 2, i2);
- Assert.AreEqual(ui1 * 2, ui2);
- Assert.AreEqual(l1 * 2, l2);
- Assert.AreEqual(ul1 * 2, ul2);
+ Assert.Equal(b1 * 2, b2);
+ Assert.Equal(s1 * 2, s2);
+ Assert.Equal(us1 * 2, us2);
+ Assert.Equal(i1 * 2, i2);
+ Assert.Equal(ui1 * 2, ui2);
+ Assert.Equal(l1 * 2, l2);
+ Assert.Equal(ul1 * 2, ul2);
}
static private bool EqualByBound(float expected, float actual)
float d = dispatchTesting.Add_Float_ReturnAndUpdateByRef (a, ref c);
Console.WriteLine($"Call to {nameof(DispatchTesting.Add_Float_ReturnAndUpdateByRef)} complete: {a} + {b} = {d}; {c} == {d}");
- Assert.IsTrue(EqualByBound(expected, c));
- Assert.IsTrue(EqualByBound(expected, d));
+ Assert.True(EqualByBound(expected, c));
+ Assert.True(EqualByBound(expected, d));
}
static void Validate_Double_In_ReturnAndUpdateByRef()
double d = dispatchTesting.Add_Double_ReturnAndUpdateByRef (a, ref c);
Console.WriteLine($"Call to {nameof(DispatchTesting.Add_Double_ReturnAndUpdateByRef)} complete: {a} + {b} = {d}; {c} == {d}");
- Assert.IsTrue(EqualByBound(expected, c));
- Assert.IsTrue(EqualByBound(expected, d));
+ Assert.True(EqualByBound(expected, c));
+ Assert.True(EqualByBound(expected, d));
}
static int GetErrorCodeFromHResult(int hresult)
{
Console.WriteLine($"Calling {nameof(DispatchTesting.TriggerException)} with {nameof(IDispatchTesting_Exception.Disp)} {errorCode}...");
dispatchTesting.TriggerException(IDispatchTesting_Exception.Disp, errorCode);
- Assert.Fail("DISP exception not thrown properly");
+ Assert.True(false, "DISP exception not thrown properly");
}
catch (COMException e)
{
- Assert.AreEqual(GetErrorCodeFromHResult(e.HResult), errorCode);
- Assert.AreEqual(e.Message, resultString);
+ Assert.Equal(GetErrorCodeFromHResult(e.HResult), errorCode);
+ Assert.Equal(e.Message, resultString);
}
try
{
Console.WriteLine($"Calling {nameof(DispatchTesting.TriggerException)} with {nameof(IDispatchTesting_Exception.HResult)} {errorCode}...");
dispatchTesting.TriggerException(IDispatchTesting_Exception.HResult, errorCode);
- Assert.Fail("HRESULT exception not thrown properly");
+ Assert.True(false, "HRESULT exception not thrown properly");
}
catch (COMException e)
{
- Assert.AreEqual(GetErrorCodeFromHResult(e.HResult), errorCode);
+ Assert.Equal(GetErrorCodeFromHResult(e.HResult), errorCode);
// Failing HRESULT exceptions contain CLR generated messages
}
}
CultureInfo englishCulture = new CultureInfo("en-US", false);
CultureInfo.CurrentCulture = newCulture;
int lcid = dispatchTesting.PassThroughLCID();
- Assert.AreEqual(englishCulture.LCID, lcid); // CLR->Dispatch LCID marshalling is explicitly hardcoded to en-US instead of passing the current culture.
+ Assert.Equal(englishCulture.LCID, lcid); // CLR->Dispatch LCID marshalling is explicitly hardcoded to en-US instead of passing the current culture.
}
finally
{
var expected = System.Linq.Enumerable.Range(0, 10);
Console.WriteLine($"Calling {nameof(DispatchTesting.GetEnumerator)} ...");
- var enumerator = dispatchTesting.GetEnumerator();
- Assert.AreAllEqual(expected, GetEnumerable(enumerator));
+ var enumerator = dispatchTesting.GetEnumerator();
+ AssertExtensions.CollectionEqual(expected, GetEnumerable(enumerator));
enumerator.Reset();
- Assert.AreAllEqual(expected, GetEnumerable(enumerator));
+ AssertExtensions.CollectionEqual(expected, GetEnumerable(enumerator));
Console.WriteLine($"Calling {nameof(DispatchTesting.ExplicitGetEnumerator)} ...");
var enumeratorExplicit = dispatchTesting.ExplicitGetEnumerator();
- Assert.AreAllEqual(expected, GetEnumerable(enumeratorExplicit));
+ AssertExtensions.CollectionEqual(expected, GetEnumerable(enumeratorExplicit));
enumeratorExplicit.Reset();
- Assert.AreAllEqual(expected, GetEnumerable(enumeratorExplicit));
+ AssertExtensions.CollectionEqual(expected, GetEnumerable(enumeratorExplicit));
System.Collections.Generic.IEnumerable<int> GetEnumerable(System.Collections.IEnumerator e)
{
using System.Runtime.InteropServices;
using TestLibrary;
+ using Xunit;
using Server.Contract;
using Server.Contract.Servers;
using System.Runtime.InteropServices;
using TestLibrary;
+ using Xunit;
using Server.Contract;
using Server.Contract.Servers;
try
{
var tmp = (LicenseTesting)new LicenseTestingClass();
- Assert.Fail("Activation of licensed class should fail");
+ Assert.True(false, "Activation of licensed class should fail");
}
catch (COMException e)
{
const int CLASS_E_NOTLICENSED = unchecked((int)0x80040112);
- Assert.AreEqual(CLASS_E_NOTLICENSED, e.HResult);
+ Assert.Equal(CLASS_E_NOTLICENSED, e.HResult);
}
finally
{
var licenseTesting = (LicenseTesting)new LicenseTestingClass();
// During design time the IClassFactory::CreateInstance will be called - no license
- Assert.AreEqual(null, licenseTesting.GetLicense());
+ Assert.Equal(null, licenseTesting.GetLicense());
// Verify the value retrieved from the IClassFactory2::RequestLicKey was what was set
- Assert.AreEqual(DefaultLicKey, LicenseManager.CurrentContext.GetSavedLicenseKey(typeof(LicenseTestingClass), resourceAssembly: null));
+ Assert.Equal(DefaultLicKey, LicenseManager.CurrentContext.GetSavedLicenseKey(typeof(LicenseTestingClass), resourceAssembly: null));
}
finally
{
var licenseTesting = (LicenseTesting)new LicenseTestingClass();
// During runtime the IClassFactory::CreateInstance2 will be called with license from context
- Assert.AreEqual(licKey, licenseTesting.GetLicense());
+ Assert.Equal(licKey, licenseTesting.GetLicense());
}
finally
{
using System.Runtime.InteropServices;
using TestLibrary;
+ using Xunit;
using Server.Contract;
using Server.Contract.Servers;
allocated += AllocateInstances(1);
allocated += AllocateInstances(2);
allocated += AllocateInstances(3);
- Assert.AreNotEqual(0, GetAllocationCount());
+ Assert.NotEqual(0, GetAllocationCount());
ForceGC();
- Assert.AreEqual(0, GetAllocationCount());
+ Assert.Equal(0, GetAllocationCount());
}
static void Validate_COMServer_DisableEagerCleanUp()
{
Console.WriteLine($"Calling {nameof(Validate_COMServer_DisableEagerCleanUp)}...");
- Assert.AreEqual(0, GetAllocationCount());
+ Assert.Equal(0, GetAllocationCount());
Thread.CurrentThread.DisableComObjectEagerCleanup();
allocated += AllocateInstances(1);
allocated += AllocateInstances(2);
allocated += AllocateInstances(3);
- Assert.AreNotEqual(0, GetAllocationCount());
+ Assert.NotEqual(0, GetAllocationCount());
ForceGC();
- Assert.AreNotEqual(0, GetAllocationCount());
+ Assert.NotEqual(0, GetAllocationCount());
Marshal.CleanupUnusedObjectsInCurrentContext();
ForceGC();
- Assert.AreEqual(0, GetAllocationCount());
- Assert.IsFalse(Marshal.AreComObjectsAvailableForCleanup());
+ Assert.Equal(0, GetAllocationCount());
+ Assert.False(Marshal.AreComObjectsAvailableForCleanup());
}
static int Main(string[] doNotUse)
{
// Initialization for all future tests
Initialize();
- Assert.IsTrue(GetAllocationCount != null);
+ Assert.True(GetAllocationCount != null);
Validate_COMServer_CleanUp();
Validate_COMServer_DisableEagerCleanUp();
using System;
using System.Collections.Generic;
using System.Linq;
- using TestLibrary;
+ using Xunit;
class ArrayTests
{
byte[] data = BaseData.Select(i => (byte)i).ToArray();
Console.WriteLine($"{data.GetType().Name} marshalling");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Byte_LP_PreLen(data.Length, data)), $"Mean_Byte_LP_PreLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Byte_LP_PostLen(data, data.Length)), $"Mean_Byte_LP_PostLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Byte_SafeArray_OutLen(data, out len)), $"Mean_Byte_SafeArray_OutLen");
- Assert.AreEqual(data.Length, len);
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Byte_LP_PreLen(data.Length, data)), $"Mean_Byte_LP_PreLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Byte_LP_PostLen(data, data.Length)), $"Mean_Byte_LP_PostLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Byte_SafeArray_OutLen(data, out len)), $"Mean_Byte_SafeArray_OutLen");
+ Assert.Equal(data.Length, len);
}
private void Marshal_ShortArray()
short[] data = BaseData.Select(i => (short)i).ToArray();
Console.WriteLine($"{data.GetType().Name} marshalling");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Short_LP_PreLen(data.Length, data)), $"Mean_Short_LP_PreLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Short_LP_PostLen(data, data.Length)), $"Mean_Short_LP_PostLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Short_SafeArray_OutLen(data, out len)), $"Mean_Short_SafeArray_OutLen");
- Assert.AreEqual(data.Length, len);
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Short_LP_PreLen(data.Length, data)), $"Mean_Short_LP_PreLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Short_LP_PostLen(data, data.Length)), $"Mean_Short_LP_PostLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Short_SafeArray_OutLen(data, out len)), $"Mean_Short_SafeArray_OutLen");
+ Assert.Equal(data.Length, len);
}
private void Marshal_UShortArray()
ushort[] data = BaseData.Select(i => (ushort)i).ToArray();
Console.WriteLine($"{data.GetType().Name} marshalling");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_UShort_LP_PreLen(data.Length, data)), $"Mean_UShort_LP_PreLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_UShort_LP_PostLen(data, data.Length)), $"Mean_UShort_LP_PostLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_UShort_SafeArray_OutLen(data, out len)), $"Mean_UShort_SafeArray_OutLen");
- Assert.AreEqual(data.Length, len);
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_UShort_LP_PreLen(data.Length, data)), $"Mean_UShort_LP_PreLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_UShort_LP_PostLen(data, data.Length)), $"Mean_UShort_LP_PostLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_UShort_SafeArray_OutLen(data, out len)), $"Mean_UShort_SafeArray_OutLen");
+ Assert.Equal(data.Length, len);
}
private void Marshal_IntArray()
int[] data = BaseData.Select(i => i).ToArray();
Console.WriteLine($"{data.GetType().Name} marshalling");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Int_LP_PreLen(data.Length, data)), $"Mean_Int_LP_PreLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Int_LP_PostLen(data, data.Length)), $"Mean_Int_LP_PostLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Int_SafeArray_OutLen(data, out len)), $"Mean_Int_SafeArray_OutLen");
- Assert.AreEqual(data.Length, len);
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Int_LP_PreLen(data.Length, data)), $"Mean_Int_LP_PreLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Int_LP_PostLen(data, data.Length)), $"Mean_Int_LP_PostLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Int_SafeArray_OutLen(data, out len)), $"Mean_Int_SafeArray_OutLen");
+ Assert.Equal(data.Length, len);
}
private void Marshal_UIntArray()
uint[] data = BaseData.Select(i => (uint)i).ToArray();
Console.WriteLine($"{data.GetType().Name} marshalling");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_UInt_LP_PreLen(data.Length, data)), $"Mean_UInt_LP_PreLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_UInt_LP_PostLen(data, data.Length)), $"Mean_UInt_LP_PostLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_UInt_SafeArray_OutLen(data, out len)), $"Mean_UInt_SafeArray_OutLen");
- Assert.AreEqual(data.Length, len);
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_UInt_LP_PreLen(data.Length, data)), $"Mean_UInt_LP_PreLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_UInt_LP_PostLen(data, data.Length)), $"Mean_UInt_LP_PostLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_UInt_SafeArray_OutLen(data, out len)), $"Mean_UInt_SafeArray_OutLen");
+ Assert.Equal(data.Length, len);
}
private void Marshal_LongArray()
long[] data = BaseData.Select(i => (long)i).ToArray();
Console.WriteLine($"{data.GetType().Name} marshalling");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Long_LP_PreLen(data.Length, data)), $"Mean_Long_LP_PreLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Long_LP_PostLen(data, data.Length)), $"Mean_Long_LP_PostLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Long_SafeArray_OutLen(data, out len)), $"Mean_Long_SafeArray_OutLen");
- Assert.AreEqual(data.Length, len);
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Long_LP_PreLen(data.Length, data)), $"Mean_Long_LP_PreLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Long_LP_PostLen(data, data.Length)), $"Mean_Long_LP_PostLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Long_SafeArray_OutLen(data, out len)), $"Mean_Long_SafeArray_OutLen");
+ Assert.Equal(data.Length, len);
}
private void Marshal_ULongArray()
ulong[] data = BaseData.Select(i => (ulong)i).ToArray();
Console.WriteLine($"{data.GetType().Name} marshalling");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_ULong_LP_PreLen(data.Length, data)), $"Mean_ULong_LP_PreLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_ULong_LP_PostLen(data, data.Length)), $"Mean_ULong_LP_PostLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_ULong_SafeArray_OutLen(data, out len)), $"Mean_ULong_SafeArray_OutLen");
- Assert.AreEqual(data.Length, len);
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_ULong_LP_PreLen(data.Length, data)), $"Mean_ULong_LP_PreLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_ULong_LP_PostLen(data, data.Length)), $"Mean_ULong_LP_PostLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_ULong_SafeArray_OutLen(data, out len)), $"Mean_ULong_SafeArray_OutLen");
+ Assert.Equal(data.Length, len);
}
private void Marshal_FloatArray()
float[] data = BaseData.Select(i => (float)i).ToArray();
Console.WriteLine($"{data.GetType().Name} marshalling");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Float_LP_PreLen(data.Length, data)), $"Mean_Float_LP_PreLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Float_LP_PostLen(data, data.Length)), $"Mean_Float_LP_PostLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Float_SafeArray_OutLen(data, out len)), $"Mean_Float_SafeArray_OutLen");
- Assert.AreEqual(data.Length, len);
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Float_LP_PreLen(data.Length, data)), $"Mean_Float_LP_PreLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Float_LP_PostLen(data, data.Length)), $"Mean_Float_LP_PostLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Float_SafeArray_OutLen(data, out len)), $"Mean_Float_SafeArray_OutLen");
+ Assert.Equal(data.Length, len);
}
private void Marshal_DoubleArray()
double[] data = BaseData.Select(i => (double)i).ToArray();
Console.WriteLine($"{data.GetType().Name} marshalling");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Double_LP_PreLen(data.Length, data)), $"Mean_Double_LP_PreLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Double_LP_PostLen(data, data.Length)), $"Mean_Double_LP_PostLen");
- Assert.IsTrue(EqualByBound(expectedMean, this.server.Mean_Double_SafeArray_OutLen(data, out len)), $"Mean_Double_SafeArray_OutLen");
- Assert.AreEqual(data.Length, len);
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Double_LP_PreLen(data.Length, data)), $"Mean_Double_LP_PreLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Double_LP_PostLen(data, data.Length)), $"Mean_Double_LP_PostLen");
+ Assert.True(EqualByBound(expectedMean, this.server.Mean_Double_SafeArray_OutLen(data, out len)), $"Mean_Double_SafeArray_OutLen");
+ Assert.Equal(data.Length, len);
}
}
}
using System;
using System.Drawing;
using System.Runtime.InteropServices;
- using TestLibrary;
+ using Xunit;
class ColorTests
{
private void VerifyColorMarshalling()
{
- Assert.IsTrue(server.AreColorsEqual(Color.Green, ColorTranslator.ToOle(Color.Green)));
+ Assert.True(server.AreColorsEqual(Color.Green, ColorTranslator.ToOle(Color.Green)));
}
private void VerifyGetRed()
{
- Assert.AreEqual(Color.Red, server.GetRed());
+ Assert.Equal(Color.Red, server.GetRed());
}
}
}
{
using System;
using System.Runtime.InteropServices;
- using TestLibrary;
+ using Xunit;
class ErrorTests
{
foreach (var hr in hrs)
{
- Assert.AreEqual(hr, this.server.Return_As_HResult(hr));
- Assert.AreEqual(hr, this.server.Return_As_HResult_Struct(hr).hr);
+ Assert.Equal(hr, this.server.Return_As_HResult(hr));
+ Assert.Equal(hr, this.server.Return_As_HResult_Struct(hr).hr);
}
}
}
namespace NetClient
{
using System;
- using TestLibrary;
+ using Xunit;
class NumericTests
{
{
var expected = (byte)(a + b);
Console.WriteLine($"{expected.GetType().Name} test invariant: {a} + {b} = {expected}");
- Assert.AreEqual(expected, this.server.Add_Byte(a, b));
+ Assert.Equal(expected, this.server.Add_Byte(a, b));
var c = byte.MaxValue;
this.server.Add_Byte_Ref(a, b, ref c);
- Assert.AreEqual(expected, c);
+ Assert.Equal(expected, c);
c = 0;
this.server.Add_Byte_Out(a, b, out c);
- Assert.AreEqual(expected, c);
+ Assert.Equal(expected, c);
}
private void Marshal_Short(short a, short b)
{
var expected = (short)(a + b);
Console.WriteLine($"{expected.GetType().Name} test invariant: {a} + {b} = {expected}");
- Assert.AreEqual(expected, this.server.Add_Short(a, b));
+ Assert.Equal(expected, this.server.Add_Short(a, b));
var c = short.MaxValue;
this.server.Add_Short_Ref(a, b, ref c);
- Assert.AreEqual(expected, c);
+ Assert.Equal(expected, c);
c = 0;
this.server.Add_Short_Out(a, b, out c);
- Assert.AreEqual(expected, c);
+ Assert.Equal(expected, c);
}
private void Marshal_UShort(ushort a, ushort b)
{
var expected = (ushort)(a + b);
Console.WriteLine($"{expected.GetType().Name} test invariant: {a} + {b} = {expected}");
- Assert.AreEqual(expected, this.server.Add_UShort(a, b));
+ Assert.Equal(expected, this.server.Add_UShort(a, b));
var c = ushort.MaxValue;
this.server.Add_UShort_Ref(a, b, ref c);
- Assert.AreEqual(expected, c);
+ Assert.Equal(expected, c);
c = 0;
this.server.Add_UShort_Out(a, b, out c);
- Assert.AreEqual(expected, c);
+ Assert.Equal(expected, c);
}
private void Marshal_Int(int a, int b)
{
var expected = a + b;
Console.WriteLine($"{expected.GetType().Name} test invariant: {a} + {b} = {expected}");
- Assert.AreEqual(expected, this.server.Add_Int(a, b));
+ Assert.Equal(expected, this.server.Add_Int(a, b));
var c = int.MaxValue;
this.server.Add_Int_Ref(a, b, ref c);
- Assert.AreEqual(expected, c);
+ Assert.Equal(expected, c);
c = 0;
this.server.Add_Int_Out(a, b, out c);
- Assert.AreEqual(expected, c);
+ Assert.Equal(expected, c);
}
private void Marshal_UInt(uint a, uint b)
{
var expected = a + b;
Console.WriteLine($"{expected.GetType().Name} test invariant: {a} + {b} = {expected}");
- Assert.AreEqual(expected, this.server.Add_UInt(a, b));
+ Assert.Equal(expected, this.server.Add_UInt(a, b));
var c = uint.MaxValue;
this.server.Add_UInt_Ref(a, b, ref c);
- Assert.AreEqual(expected, c);
+ Assert.Equal(expected, c);
c = 0;
this.server.Add_UInt_Out(a, b, out c);
- Assert.AreEqual(expected, c);
+ Assert.Equal(expected, c);
}
private void Marshal_Long(long a, long b)
{
var expected = a + b;
Console.WriteLine($"{expected.GetType().Name} test invariant: {a} + {b} = {expected}");
- Assert.AreEqual(expected, this.server.Add_Long(a, b));
+ Assert.Equal(expected, this.server.Add_Long(a, b));
var c = long.MaxValue;
this.server.Add_Long_Ref(a, b, ref c);
- Assert.AreEqual(expected, c);
+ Assert.Equal(expected, c);
c = 0;
this.server.Add_Long_Out(a, b, out c);
- Assert.AreEqual(expected, c);
+ Assert.Equal(expected, c);
}
private void Marshal_ULong(ulong a, ulong b)
{
var expected = a + b;
Console.WriteLine($"{expected.GetType().Name} test invariant: {a} + {b} = {expected}");
- Assert.AreEqual(expected, this.server.Add_ULong(a, b));
+ Assert.Equal(expected, this.server.Add_ULong(a, b));
var c = ulong.MaxValue;
this.server.Add_ULong_Ref(a, b, ref c);
- Assert.AreEqual(expected, c);
+ Assert.Equal(expected, c);
c = 0;
this.server.Add_ULong_Out(a, b, out c);
- Assert.AreEqual(expected, c);
+ Assert.Equal(expected, c);
}
private void Marshal_Float(float a, float b)
{
var expected = a + b;
Console.WriteLine($"{expected.GetType().Name} test invariant: {a} + {b} = {expected}");
- Assert.IsTrue(EqualByBound(expected, this.server.Add_Float(a, b)), $"Add_Float: {this.server.Add_Float(a, b)}");
+ Assert.True(EqualByBound(expected, this.server.Add_Float(a, b)), $"Add_Float: {this.server.Add_Float(a, b)}");
var c = float.MaxValue;
this.server.Add_Float_Ref(a, b, ref c);
- Assert.IsTrue(EqualByBound(expected, c), "Add_Float_Ref");
+ Assert.True(EqualByBound(expected, c));
c = 0;
this.server.Add_Float_Out(a, b, out c);
- Assert.IsTrue(EqualByBound(expected, c), "Add_Float_Out");
+ Assert.True(EqualByBound(expected, c));
}
private void Marshal_Double(double a, double b)
{
var expected = a + b;
Console.WriteLine($"{expected.GetType().Name} test invariant: {a} + {b} = {expected}");
- Assert.IsTrue(EqualByBound(expected, this.server.Add_Double(a, b)));
+ Assert.True(EqualByBound(expected, this.server.Add_Double(a, b)));
var c = double.MaxValue;
this.server.Add_Double_Ref(a, b, ref c);
- Assert.IsTrue(EqualByBound(expected, c));
+ Assert.True(EqualByBound(expected, c));
c = 0;
this.server.Add_Double_Out(a, b, out c);
- Assert.IsTrue(EqualByBound(expected, c));
+ Assert.True(EqualByBound(expected, c));
}
private void Marshal_ManyInts()
{
var expected = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11;
Console.WriteLine($"{expected.GetType().Name} 11 test invariant: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 = {expected}");
- Assert.IsTrue(expected == this.server.Add_ManyInts11(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11));
+ Assert.True(expected == this.server.Add_ManyInts11(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11));
expected = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12;
Console.WriteLine($"{expected.GetType().Name} 12 test invariant: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 = {expected}");
- Assert.IsTrue(expected == this.server.Add_ManyInts12(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12));
+ Assert.True(expected == this.server.Add_ManyInts12(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12));
}
}
}
using System;
using System.Threading;
using System.Runtime.InteropServices;
- using TestLibrary;
+ using Xunit;
class Program
{
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
- using TestLibrary;
+ using Xunit;
class StringTests
{
string expected = p.Item1 + p.Item2;
string actual = this.server.Add_LPStr(p.Item1, p.Item2);
- Assert.AreEqual(expected, actual, "Add_String_LPStr (simple)");
+ Assert.Equal(expected, actual);
}
foreach (var s in reversableStrings)
string expected = Reverse(local);
string actual = this.server.Reverse_LPStr(local);
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
actual = this.server.Reverse_LPStr_Ref(ref local);
- Assert.AreEqual(expected, actual);
- Assert.AreEqual(expected, local);
+ Assert.Equal(expected, actual);
+ Assert.Equal(expected, local);
local = s;
actual = this.server.Reverse_LPStr_InRef(ref local);
- Assert.AreEqual(expected, actual);
- Assert.AreEqual(s, local);
+ Assert.Equal(expected, actual);
+ Assert.Equal(s, local);
this.server.Reverse_LPStr_Out(local, out actual);
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
actual = local;
this.server.Reverse_LPStr_OutAttr(local, actual); // No-op for strings
- Assert.AreEqual(local, actual);
+ Assert.Equal(local, actual);
}
foreach (var s in reversableStrings)
string expected = Reverse(local.ToString());
StringBuilder actual = this.server.Reverse_SB_LPStr(local);
- Assert.AreEqual(expected, actual.ToString());
- Assert.AreEqual(expected, local.ToString());
+ Assert.Equal(expected, actual.ToString());
+ Assert.Equal(expected, local.ToString());
local = new StringBuilder(s);
actual = this.server.Reverse_SB_LPStr_Ref(ref local);
- Assert.AreEqual(expected, actual.ToString());
- Assert.AreEqual(expected, local.ToString());
+ Assert.Equal(expected, actual.ToString());
+ Assert.Equal(expected, local.ToString());
local = new StringBuilder(s);
actual = this.server.Reverse_SB_LPStr_InRef(ref local);
- Assert.AreEqual(expected, actual.ToString());
+ Assert.Equal(expected, actual.ToString());
// Palindromes are _always_ equal
if (!string.Equals(s, expected))
{
- Assert.AreNotEqual(expected, local.ToString());
+ Assert.NotEqual(expected, local.ToString());
}
local = new StringBuilder(s);
actual = new StringBuilder();
this.server.Reverse_SB_LPStr_Out(local, out actual);
- Assert.AreEqual(expected, actual.ToString());
- Assert.AreEqual(expected, local.ToString());
+ Assert.Equal(expected, actual.ToString());
+ Assert.Equal(expected, local.ToString());
local = new StringBuilder(s);
actual = new StringBuilder(s.Length);
this.server.Reverse_SB_LPStr_OutAttr(local, actual);
- Assert.AreEqual(expected, actual.ToString());
- Assert.AreEqual(expected, local.ToString());
+ Assert.Equal(expected, actual.ToString());
+ Assert.Equal(expected, local.ToString());
}
}
{
string expected = p.Item1 + p.Item2;
string actual = this.server.Add_LPWStr(p.Item1, p.Item2);
- Assert.AreEqual(expected, actual, "Add_String_LPWStr (simple)");
+ Assert.Equal(expected, actual);
}
foreach (var s in reversableStrings)
string expected = Reverse(local);
string actual = this.server.Reverse_LPWStr(local);
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
actual = this.server.Reverse_LPWStr_Ref(ref local);
- Assert.AreEqual(expected, actual);
- Assert.AreEqual(expected, local);
+ Assert.Equal(expected, actual);
+ Assert.Equal(expected, local);
local = s;
actual = this.server.Reverse_LPWStr_InRef(ref local);
- Assert.AreEqual(expected, actual);
- Assert.AreEqual(s, local);
+ Assert.Equal(expected, actual);
+ Assert.Equal(s, local);
this.server.Reverse_LPWStr_Out(local, out actual);
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
actual = local;
Assert.Throws<MarshalDirectiveException>( () => this.server.Reverse_LPWStr_OutAttr(local, actual));
string expected = Reverse(local.ToString());
StringBuilder actual = this.server.Reverse_SB_LPWStr(local);
- Assert.AreEqual(expected, actual.ToString());
- Assert.AreEqual(expected, local.ToString());
+ Assert.Equal(expected, actual.ToString());
+ Assert.Equal(expected, local.ToString());
local = new StringBuilder(s);
actual = this.server.Reverse_SB_LPWStr_Ref(ref local);
- Assert.AreEqual(expected, actual.ToString());
- Assert.AreEqual(expected, local.ToString());
+ Assert.Equal(expected, actual.ToString());
+ Assert.Equal(expected, local.ToString());
local = new StringBuilder(s);
actual = this.server.Reverse_SB_LPWStr_InRef(ref local);
- Assert.AreEqual(expected, actual.ToString());
+ Assert.Equal(expected, actual.ToString());
// Palindromes are _always_ equal
if (!string.Equals(s, expected))
{
- Assert.AreNotEqual(expected, local.ToString());
+ Assert.NotEqual(expected, local.ToString());
}
local = new StringBuilder(s);
actual = new StringBuilder();
this.server.Reverse_SB_LPWStr_Out(local, out actual);
- Assert.AreEqual(expected, actual.ToString());
- Assert.AreEqual(expected, local.ToString());
+ Assert.Equal(expected, actual.ToString());
+ Assert.Equal(expected, local.ToString());
local = new StringBuilder(s);
actual = new StringBuilder(s.Length);
this.server.Reverse_SB_LPWStr_OutAttr(local, actual);
- Assert.AreEqual(expected, actual.ToString());
- Assert.AreEqual(expected, local.ToString());
+ Assert.Equal(expected, actual.ToString());
+ Assert.Equal(expected, local.ToString());
}
}
{
string expected = p.Item1 + p.Item2;
string actual = this.server.Add_BStr(p.Item1, p.Item2);
- Assert.AreEqual(expected, actual, "Add_String_BStr (simple)");
+ Assert.Equal(expected, actual);
}
foreach (var s in reversableStrings)
string expected = Reverse(local);
string actual = this.server.Reverse_BStr(local);
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
actual = this.server.Reverse_BStr_Ref(ref local);
- Assert.AreEqual(expected, actual);
- Assert.AreEqual(expected, local);
+ Assert.Equal(expected, actual);
+ Assert.Equal(expected, local);
local = s;
actual = this.server.Reverse_BStr_InRef(ref local);
- Assert.AreEqual(expected, actual);
- Assert.AreEqual(s, local);
+ Assert.Equal(expected, actual);
+ Assert.Equal(s, local);
this.server.Reverse_BStr_Out(local, out actual);
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
actual = local;
this.server.Reverse_BStr_OutAttr(local, actual); // No-op for strings
- Assert.AreEqual(local, actual);
+ Assert.Equal(local, actual);
}
}
string expected = Reverse(local);
string actual = this.server.Reverse_LPWStr_With_LCID(local);
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
}
CultureInfo culture = new CultureInfo("es-ES", false);
{
CultureInfo.CurrentCulture = culture;
this.server.Pass_Through_LCID(out int lcid);
- Assert.AreEqual(englishCulture.LCID, lcid); // CLR->COM LCID marshalling is explicitly hardcoded to en-US as requested by VSTO instead of passing the current culture.
+ Assert.Equal(englishCulture.LCID, lcid); // CLR->COM LCID marshalling is explicitly hardcoded to en-US as requested by VSTO instead of passing the current culture.
}
finally
{
using System.Security;
using System.Reflection;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public class Reflection
{
If a target project references System.Private.Corelib, we are unable to reference CoreCLRTestLibrary.
Compile in relevant files used for testing interop. -->
<ItemGroup Condition="('$(IgnoreCoreCLRTestLibraryDependency)' != 'true') And ('$(ReferenceSystemPrivateCoreLib)' == 'true')">
- <Compile Include="$(MSBuildThisFileDirectory)\..\Common\CoreCLRTestLibrary\Assertion.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)\..\Common\CoreCLRTestLibrary\AssertExtensions.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)\..\Common\Assert.cs" />
<Compile Include="$(MSBuildThisFileDirectory)\..\Common\CoreCLRTestLibrary\HostPolicyMock.cs" Condition="'$(RequiresMockHostPolicy)' == 'true'"/>
</ItemGroup>
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
class ExactSpellingTest
{
private static void Verify(int expectedReturnValue, int expectedParameterValue, int actualReturnValue, int actualParameterValue)
{
- Assert.AreEqual(expectedReturnValue, actualReturnValue);
- Assert.AreEqual(expectedParameterValue, actualParameterValue);
+ Assert.Equal(expectedReturnValue, actualReturnValue);
+ Assert.Equal(expectedParameterValue, actualParameterValue);
}
}
using System.Linq;
using System.Reflection;
using System.Runtime.Loader;
-using TestLibrary;
+using Xunit;
public class RunInALC
{
Type inContextType = inContextAssembly.GetType("CustomMarshalers.CustomMarshalerTest");
object instance = Activator.CreateInstance(inContextType);
MethodInfo parseIntMethod = inContextType.GetMethod("ParseInt", BindingFlags.Instance | BindingFlags.Public);
- Assert.AreEqual(1234, (int)parseIntMethod.Invoke(instance, new object[]{"1234"}));
+ Assert.Equal(1234, (int)parseIntMethod.Invoke(instance, new object[]{"1234"}));
GC.KeepAlive(context);
}
}
using System.Linq;
using System.Reflection;
using System.Runtime.Loader;
-using TestLibrary;
+using Xunit;
public class RunInALC
{
{
try
{
- Assert.AreEqual(123, new CustomMarshalers.CustomMarshalerTest().ParseInt("123"));
- Assert.AreEqual(123, new CustomMarshalers2.CustomMarshalerTest().ParseInt("123"));
+ Assert.Equal(123, new CustomMarshalers.CustomMarshalerTest().ParseInt("123"));
+ Assert.Equal(123, new CustomMarshalers2.CustomMarshalerTest().ParseInt("123"));
return 100;
}
catch (Exception e)
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
namespace IDynamicInterfaceCastableTests
{
public int GetNumberHelper()
{
- Assert.Fail("Calling a public interface method with a default implementation should go through IDynamicInterfaceCastable for interface dispatch.");
+ Assert.True(false, "Calling a public interface method with a default implementation should go through IDynamicInterfaceCastable for interface dispatch.");
return 0;
}
Console.WriteLine(" -- Validate cast");
// ITest -> ITestImpl
- Assert.IsTrue(castableObj is ITest, $"Should be castable to {nameof(ITest)} via is");
- Assert.IsNotNull(castableObj as ITest, $"Should be castable to {nameof(ITest)} via as");
+ Assert.True(castableObj is ITest);
+ Assert.NotNull(castableObj as ITest);
var testObj = (ITest)castableObj;
Console.WriteLine(" -- Validate method call");
- Assert.AreSame(castableObj, testObj.ReturnThis(), $"{nameof(ITest.ReturnThis)} should return actual object");
- Assert.AreEqual(typeof(DynamicInterfaceCastable), testObj.GetMyType(), $"{nameof(ITest.GetMyType)} should return typeof(DynamicInterfaceCastable)");
+ Assert.Same(castableObj, testObj.ReturnThis());
+ Assert.Equal(typeof(DynamicInterfaceCastable), testObj.GetMyType());
Console.WriteLine(" -- Validate method call which calls methods using 'this'");
- Assert.AreEqual(DynamicInterfaceCastable.ImplementedMethodReturnValue, testObj.CallImplemented(ImplementationToCall.Class));
- Assert.AreEqual(ITestImpl.GetNumberReturnValue, testObj.CallImplemented(ImplementationToCall.Interface));
- Assert.AreEqual(ITestImpl.GetNumberPrivateReturnValue, testObj.CallImplemented(ImplementationToCall.InterfacePrivate));
- Assert.AreEqual(ITestImpl.GetNumberStaticReturnValue, testObj.CallImplemented(ImplementationToCall.InterfaceStatic));
+ Assert.Equal(DynamicInterfaceCastable.ImplementedMethodReturnValue, testObj.CallImplemented(ImplementationToCall.Class));
+ Assert.Equal(ITestImpl.GetNumberReturnValue, testObj.CallImplemented(ImplementationToCall.Interface));
+ Assert.Equal(ITestImpl.GetNumberPrivateReturnValue, testObj.CallImplemented(ImplementationToCall.InterfacePrivate));
+ Assert.Equal(ITestImpl.GetNumberStaticReturnValue, testObj.CallImplemented(ImplementationToCall.InterfaceStatic));
Assert.Throws<InvalidCastException>(() => testObj.CallImplemented(ImplementationToCall.ImplInterfacePublic));
Console.WriteLine(" -- Validate delegate call");
Func<ITest> func = new Func<ITest>(testObj.ReturnThis);
- Assert.AreSame(castableObj, func(), $"Delegate call to {nameof(ITest.ReturnThis)} should return this");
+ Assert.Same(castableObj, func());
}
private static void ValidateGenericInterface()
Console.WriteLine(" -- Validate cast");
// ITestGeneric<int, int> -> ITestGenericIntImpl
- Assert.IsTrue(castableObj is ITestGeneric<int, int>, $"Should be castable to {nameof(ITestGeneric<int, int>)} via is");
- Assert.IsNotNull(castableObj as ITestGeneric<int, int>, $"Should be castable to {nameof(ITestGeneric<int, int>)} via as");
+ Assert.True(castableObj is ITestGeneric<int, int>, $"Should be castable to {nameof(ITestGeneric<int, int>)} via is");
+ Assert.NotNull(castableObj as ITestGeneric<int, int>);
ITestGeneric<int, int> testInt = (ITestGeneric<int, int>)castableObj;
// ITestGeneric<string, string> -> ITestGenericImpl<string, string>
- Assert.IsTrue(castableObj is ITestGeneric<string, string>, $"Should be castable to {nameof(ITestGeneric<string, string>)} via is");
- Assert.IsNotNull(castableObj as ITestGeneric<string, string>, $"Should be castable to {nameof(ITestGeneric<string, string>)} via as");
+ Assert.True(castableObj is ITestGeneric<string, string>, $"Should be castable to {nameof(ITestGeneric<string, string>)} via is");
+ Assert.NotNull(castableObj as ITestGeneric<string, string>);
ITestGeneric<string, string> testStr = (ITestGeneric<string, string>)castableObj;
// Validate Variance
// ITestGeneric<string, object> -> ITestGenericImpl<object, string>
- Assert.IsTrue(castableObj is ITestGeneric<string, object>, $"Should be castable to {nameof(ITestGeneric<string, object>)} via is");
- Assert.IsNotNull(castableObj as ITestGeneric<string, object>, $"Should be castable to {nameof(ITestGeneric<string, object>)} via as");
+ Assert.True(castableObj is ITestGeneric<string, object>, $"Should be castable to {nameof(ITestGeneric<string, object>)} via is");
+ Assert.NotNull(castableObj as ITestGeneric<string, object>);
ITestGeneric<string, object> testVar = (ITestGeneric<string, object>)castableObj;
// ITestGeneric<bool, bool> is not recognized
- Assert.IsFalse(castableObj is ITestGeneric<bool, bool>, $"Should not be castable to {nameof(ITestGeneric<bool, bool>)} via is");
- Assert.IsNull(castableObj as ITestGeneric<bool, bool>, $"Should not be castable to {nameof(ITestGeneric<bool, bool>)} via as");
+ Assert.False(castableObj is ITestGeneric<bool, bool>, $"Should not be castable to {nameof(ITestGeneric<bool, bool>)} via is");
+ Assert.Null(castableObj as ITestGeneric<bool, bool>);
var ex = Assert.Throws<DynamicInterfaceCastableException>(() => { var _ = (ITestGeneric<bool, bool>)castableObj; });
- Assert.AreEqual(string.Format(DynamicInterfaceCastableException.ErrorFormat, typeof(ITestGeneric<bool, bool>)), ex.Message);
+ Assert.Equal(string.Format(DynamicInterfaceCastableException.ErrorFormat, typeof(ITestGeneric<bool, bool>)), ex.Message);
int expectedInt = 42;
string expectedStr = "str";
Console.WriteLine(" -- Validate method call");
- Assert.AreEqual(expectedInt, testInt.ReturnArg(42));
- Assert.AreEqual(expectedStr, testStr.ReturnArg(expectedStr));
- Assert.AreEqual(expectedStr, testVar.ReturnArg(expectedStr));
+ Assert.Equal(expectedInt, testInt.ReturnArg(42));
+ Assert.Equal(expectedStr, testStr.ReturnArg(expectedStr));
+ Assert.Equal(expectedStr, testVar.ReturnArg(expectedStr));
Console.WriteLine(" -- Validate delegate call");
Func<int, int> funcInt = new Func<int, int>(testInt.ReturnArg);
- Assert.AreEqual(expectedInt, funcInt(expectedInt));
+ Assert.Equal(expectedInt, funcInt(expectedInt));
Func<string, string> funcStr = new Func<string, string>(testStr.ReturnArg);
- Assert.AreEqual(expectedStr, funcStr(expectedStr));
+ Assert.Equal(expectedStr, funcStr(expectedStr));
Func<string, object> funcVar = new Func<string, object>(testVar.ReturnArg);
- Assert.AreEqual(expectedStr, funcVar(expectedStr));
+ Assert.Equal(expectedStr, funcVar(expectedStr));
}
private static void ValidateOverriddenInterface()
Console.WriteLine(" -- Validate cast");
// IOverrideTest -> IOverrideTestImpl
- Assert.IsTrue(castableObj is IOverrideTest, $"Should be castable to {nameof(IOverrideTest)} via is");
- Assert.IsNotNull(castableObj as IOverrideTest, $"Should be castable to {nameof(IOverrideTest)} via as");
+ Assert.True(castableObj is IOverrideTest, $"Should be castable to {nameof(IOverrideTest)} via is");
+ Assert.NotNull(castableObj as IOverrideTest);
var testObj = (IOverrideTest)castableObj;
Console.WriteLine(" -- Validate method call");
- Assert.AreSame(castableObj, testObj.ReturnThis(), $"{nameof(IOverrideTest.ReturnThis)} should return actual object");
- Assert.AreEqual(IOverrideTestImpl.GetMyTypeReturnValue, testObj.GetMyType(), $"{nameof(IOverrideTest.GetMyType)} should return {IOverrideTestImpl.GetMyTypeReturnValue}");
+ Assert.Same(castableObj, testObj.ReturnThis());
+ Assert.Equal(IOverrideTestImpl.GetMyTypeReturnValue, testObj.GetMyType());
Console.WriteLine(" -- Validate method call which calls methods using 'this'");
- Assert.AreEqual(DynamicInterfaceCastable.ImplementedMethodReturnValue, testObj.CallImplemented(ImplementationToCall.Class));
- Assert.AreEqual(IOverrideTestImpl.GetNumberReturnValue_Override, testObj.CallImplemented(ImplementationToCall.Interface));
- Assert.AreEqual(ITestImpl.GetNumberPrivateReturnValue, testObj.CallImplemented(ImplementationToCall.InterfacePrivate));
- Assert.AreEqual(ITestImpl.GetNumberStaticReturnValue, testObj.CallImplemented(ImplementationToCall.InterfaceStatic));
+ Assert.Equal(DynamicInterfaceCastable.ImplementedMethodReturnValue, testObj.CallImplemented(ImplementationToCall.Class));
+ Assert.Equal(IOverrideTestImpl.GetNumberReturnValue_Override, testObj.CallImplemented(ImplementationToCall.Interface));
+ Assert.Equal(ITestImpl.GetNumberPrivateReturnValue, testObj.CallImplemented(ImplementationToCall.InterfacePrivate));
+ Assert.Equal(ITestImpl.GetNumberStaticReturnValue, testObj.CallImplemented(ImplementationToCall.InterfaceStatic));
Console.WriteLine(" -- Validate delegate call");
Func<ITest> func = new Func<ITest>(testObj.ReturnThis);
- Assert.AreSame(castableObj, func(), $"Delegate call to {nameof(IOverrideTest.ReturnThis)} should return this");
+ Assert.Same(castableObj, func());
Func<Type> funcGetType = new Func<Type>(testObj.GetMyType);
- Assert.AreEqual(IOverrideTestImpl.GetMyTypeReturnValue, funcGetType(), $"Delegate call to {nameof(IOverrideTest.GetMyType)} should return {IOverrideTestImpl.GetMyTypeReturnValue}");
+ Assert.Equal(IOverrideTestImpl.GetMyTypeReturnValue, funcGetType());
}
private static void ValidateNotImplemented()
{ typeof(ITest), typeof(ITestImpl) }
});
- Assert.IsFalse(castableObj is INotImplemented, $"Should not be castable to {nameof(INotImplemented)} via is");
- Assert.IsNull(castableObj as INotImplemented, $"Should not be castable to {nameof(INotImplemented)} via as");
+ Assert.False(castableObj is INotImplemented, $"Should not be castable to {nameof(INotImplemented)} via is");
+ Assert.Null(castableObj as INotImplemented);
var ex = Assert.Throws<DynamicInterfaceCastableException>(() => { var _ = (INotImplemented)castableObj; });
- Assert.AreEqual(string.Format(DynamicInterfaceCastableException.ErrorFormat, typeof(INotImplemented)), ex.Message);
+ Assert.Equal(string.Format(DynamicInterfaceCastableException.ErrorFormat, typeof(INotImplemented)), ex.Message);
}
private static void ValidateDirectlyImplemented()
});
Console.WriteLine(" -- Validate cast");
- Assert.IsTrue(castableObj is IDirectlyImplemented, $"Should be castable to {nameof(IDirectlyImplemented)} via is");
- Assert.IsNotNull(castableObj as IDirectlyImplemented, $"Should be castable to {nameof(IDirectlyImplemented)} via as");
+ Assert.True(castableObj is IDirectlyImplemented, $"Should be castable to {nameof(IDirectlyImplemented)} via is");
+ Assert.NotNull(castableObj as IDirectlyImplemented);
var direct = (IDirectlyImplemented)castableObj;
Console.WriteLine(" -- Validate method call");
- Assert.AreEqual(DynamicInterfaceCastable.ImplementedMethodReturnValue, direct.ImplementedMethod());
+ Assert.Equal(DynamicInterfaceCastable.ImplementedMethodReturnValue, direct.ImplementedMethod());
Console.WriteLine(" -- Validate delegate call");
Func<int> func = new Func<int>(direct.ImplementedMethod);
- Assert.AreEqual(DynamicInterfaceCastable.ImplementedMethodReturnValue, func());
+ Assert.Equal(DynamicInterfaceCastable.ImplementedMethodReturnValue, func());
}
private static void ValidateErrorHandling()
Console.WriteLine(" -- Validate exception thrown");
castableObj.InvalidImplementation = BadDynamicInterfaceCastable.InvalidReturn.ThrowException;
ex = Assert.Throws<DynamicInterfaceCastableException>(() => { var _ = (ITest)castableObj; });
- Assert.AreEqual(string.Format(DynamicInterfaceCastableException.ErrorFormat, typeof(ITest)), ex.Message);
+ Assert.Equal(string.Format(DynamicInterfaceCastableException.ErrorFormat, typeof(ITest)), ex.Message);
Console.WriteLine($" ---- {ex.GetType().Name}: {ex.Message}");
Console.WriteLine(" -- Validate reabstracted implementation");
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
namespace CopyConstructorMarshaler
{
MethodInfo testMethod = testType.GetMethod("PInvokeNumCopies");
// PInvoke will copy twice. Once from argument to parameter, and once from the managed to native parameter.
- Assert.AreEqual(2, (int)testMethod.Invoke(testInstance, null));
+ Assert.Equal(2, (int)testMethod.Invoke(testInstance, null));
testMethod = testType.GetMethod("ReversePInvokeNumCopies");
// Reverse PInvoke will copy 3 times. Two are from the same paths as the PInvoke,
// and the third is from the reverse P/Invoke call.
- Assert.AreEqual(3, (int)testMethod.Invoke(testInstance, null));
+ Assert.Equal(3, (int)testMethod.Invoke(testInstance, null));
testMethod = testType.GetMethod("PInvokeNumCopiesDerivedType");
// PInvoke will copy twice. Once from argument to parameter, and once from the managed to native parameter.
- Assert.AreEqual(2, (int)testMethod.Invoke(testInstance, null));
+ Assert.Equal(2, (int)testMethod.Invoke(testInstance, null));
testMethod = testType.GetMethod("ReversePInvokeNumCopiesDerivedType");
// Reverse PInvoke will copy 3 times. Two are from the same paths as the PInvoke,
// and the third is from the reverse P/Invoke call.
- Assert.AreEqual(3, (int)testMethod.Invoke(testInstance, null));
+ Assert.Equal(3, (int)testMethod.Invoke(testInstance, null));
}
catch (Exception ex)
{
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
namespace FixupCallsHostWhenLoaded
{
IntPtr ijwModuleHandle = GetModuleHandle("IjwNativeDll.dll");
- Assert.AreNotEqual(IntPtr.Zero, ijwModuleHandle);
- Assert.IsTrue(wasModuleVTableQueried(ijwModuleHandle));
+ Assert.NotEqual(IntPtr.Zero, ijwModuleHandle);
+ Assert.True(wasModuleVTableQueried(ijwModuleHandle));
}
catch (Exception e)
{
using System.Runtime.InteropServices;
using Internal.Runtime.InteropServices;
using TestLibrary;
+using Xunit;
using Console = Internal.Console;
NativeEntryPointDelegate nativeEntryPoint = Marshal.GetDelegateForFunctionPointer<NativeEntryPointDelegate>(NativeLibrary.GetExport(ijwNativeHandle, "NativeEntryPoint"));
- Assert.AreEqual(100, nativeEntryPoint());
+ Assert.Equal(100, nativeEntryPoint());
Console.WriteLine("Test calls from managed to native to managed when an IJW assembly was first loaded via native.");
object testInstance = Activator.CreateInstance(testType);
MethodInfo testMethod = testType.GetMethod("ManagedEntryPoint");
- Assert.AreEqual(100, (int)testMethod.Invoke(testInstance, null));
+ Assert.Equal(100, (int)testMethod.Invoke(testInstance, null));
MethodInfo changeReturnedValueMethod = testType.GetMethod("ChangeReturnedValue");
MethodInfo getReturnValueMethod = testType.GetMethod("GetReturnValue");
int newValue = 42;
changeReturnedValueMethod.Invoke(null, new object[] { newValue });
- Assert.AreEqual(newValue, (int)getReturnValueMethod.Invoke(null, null));
+ Assert.Equal(newValue, (int)getReturnValueMethod.Invoke(null, null));
// Native images are only loaded into memory once. As a result, the stubs in the vtfixup table
// will always point to JIT stubs that exist in the first ALC that the module was loaded into.
// As a result, if an IJW module is loaded into two different ALCs, or if the module is
// first loaded via a native call and then loaded via the managed loader, the call stack can change ALCs when
// jumping from managed->native->managed code within the IJW module.
- Assert.AreEqual(100, (int)testMethod.Invoke(testInstance, null));
+ Assert.Equal(100, (int)testMethod.Invoke(testInstance, null));
return 100;
}
catch (Exception ex)
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
namespace NativeVarargsTest
{
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
namespace PInvokeTests
{
string s = "before";
var p = new SeqClass(0, false, s);
- Assert.IsTrue(SimpleSeqLayoutClassByRef(p));
+ Assert.True(SimpleSeqLayoutClassByRef(p));
}
public static void SequentialClassNull()
{
Console.WriteLine($"Running {nameof(SequentialClassNull)}...");
- Assert.IsTrue(SimpleSeqLayoutClassByRefNull(null));
+ Assert.True(SimpleSeqLayoutClassByRefNull(null));
}
public static void DerivedClassWithEmptyBase()
Console.WriteLine($"Running {nameof(DerivedClassWithEmptyBase)}...");
string s = "before";
- Assert.IsTrue(DerivedSeqLayoutClassByRef(new SeqDerivedClass(42), 42));
- Assert.IsTrue(DerivedSeqLayoutClassByRef(new SeqDerivedClass2(42), 42));
+ Assert.True(DerivedSeqLayoutClassByRef(new SeqDerivedClass(42), 42));
+ Assert.True(DerivedSeqLayoutClassByRef(new SeqDerivedClass2(42), 42));
}
public static void ExplicitClass()
Console.WriteLine($"Running {nameof(ExplicitClass)}...");
var p = new ExpClass(DialogResult.None, 10);
- Assert.IsTrue(SimpleExpLayoutClassByRef(p));
+ Assert.True(SimpleExpLayoutClassByRef(p));
}
private static void ValidateBlittableClassInOut(Func<Blittable, bool> pinvoke)
int a = 10;
int expected = a + 1;
Blittable p = new Blittable(a);
- Assert.IsTrue(pinvoke(p));
- Assert.AreEqual(expected, p.a);
+ Assert.True(pinvoke(p));
+ Assert.Equal(expected, p.a);
}
public static void BlittableClass()
{
// [Compat] Marshalled with [In, Out] behaviour by default
Console.WriteLine($"Running {nameof(BlittableClassNull)}...");
- Assert.IsTrue(SimpleBlittableSeqLayoutClass_Null(null));
+ Assert.True(SimpleBlittableSeqLayoutClass_Null(null));
}
public static void BlittableClassByInAttr()
int a = 10;
int expected = a + 1;
SealedBlittable p = new SealedBlittable(a);
- Assert.IsTrue(pinvoke(p));
- Assert.AreEqual(expected, p.a);
+ Assert.True(pinvoke(p));
+ Assert.Equal(expected, p.a);
}
public static void SealedBlittableClass()
{
Console.WriteLine($"Running {nameof(SealedBlittablePinned)}...");
var blittable = new SealedBlittable(1);
- Assert.IsTrue(PointersEqual(blittable, ref blittable.a));
+ Assert.True(PointersEqual(blittable, ref blittable.a));
}
public static void BlittablePinned()
{
Console.WriteLine($"Running {nameof(BlittablePinned)}...");
var blittable = new Blittable(1);
- Assert.IsTrue(PointersEqual(blittable, ref blittable.a));
+ Assert.True(PointersEqual(blittable, ref blittable.a));
}
public static void NestedLayoutClass()
{
value = p
};
- Assert.IsTrue(SimpleNestedLayoutClassByValue(target));
+ Assert.True(SimpleNestedLayoutClassByValue(target));
}
public static void RecursiveNativeLayout()
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public partial class FunctionPtr
{
IntPtr fcnptr = Marshal.GetFunctionPointerForDelegate<VoidDelegate>(md);
VoidDelegate del = (VoidDelegate)Marshal.GetDelegateForFunctionPointer(fcnptr, typeof(VoidDelegate));
- Assert.AreEqual(md.Target, del.Target, "Failure - the Target of the funcptr->delegate should be equal to the original method.");
- Assert.AreEqual(md.Method, del.Method, "Failure - The Method of the funcptr->delegate should be equal to the MethodInfo of the original method.");
+ Assert.Equal(md.Target, del.Target);
+ Assert.Equal(md.Method, del.Method);
}
// Native FcnPtr -> Delegate
{
IntPtr fcnptr = FunctionPointerNative.GetVoidVoidFcnPtr();
VoidDelegate del = (VoidDelegate)Marshal.GetDelegateForFunctionPointer(fcnptr, typeof(VoidDelegate));
- Assert.AreEqual(null, del.Target, "Failure - the Target of the funcptr->delegate should be null since we provided native funcptr.");
- Assert.AreEqual("Invoke", del.Method.Name, "Failure - The Method of the native funcptr->delegate should be the Invoke method.");
+ Assert.Equal(null, del.Target);
+ Assert.Equal("Invoke", del.Method.Name);
// Round trip of a native function pointer is never legal for a non-concrete Delegate type
Assert.Throws<ArgumentException>(() =>
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
partial class FunctionPtr
{
{
IntPtr fcnptr = Marshal.GetFunctionPointerForDelegate<DelegateWithLong>(s_DelWithLongBool);
- Assert.IsTrue(FunctionPointerNative.CheckFcnPtr(fcnptr));
+ Assert.True(FunctionPointerNative.CheckFcnPtr(fcnptr));
}
{
using System.Security;
using System.Runtime.InteropServices;
using System.Collections.Generic;
-using TestLibrary;
+using Xunit;
#pragma warning disable 618
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
enum TestResult {
Success,
using System.Reflection;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public class FakeNativeLibrary
{
public void Validate(params string[] expectedNames)
{
- Assert.AreAllEqual(expectedNames, invocations, $"Unexpected invocations for {nameof(LoadUnmanagedDll)}.");
+ AssertExtensions.CollectionEqual(expectedNames, invocations);
}
protected override IntPtr LoadUnmanagedDll(string unmanagedDllName)
// ALC implementation returns a fake handle value
IntPtr ptr = NativeLibrary.Load(FakeNativeLibrary.Name, asm, null);
alc.Validate(FakeNativeLibrary.Name);
- Assert.AreEqual(FakeNativeLibrary.Handle, ptr, $"Unexpected return value for {nameof(NativeLibrary.Load)}");
+ Assert.Equal(FakeNativeLibrary.Handle, ptr);
alc.Reset();
ptr = IntPtr.Zero;
bool success = NativeLibrary.TryLoad(FakeNativeLibrary.Name, asm, null, out ptr);
- Assert.IsTrue(success, $"NativeLibrary.TryLoad should have succeeded");
+ Assert.True(success, $"NativeLibrary.TryLoad should have succeeded");
alc.Validate(FakeNativeLibrary.Name);
- Assert.AreEqual(FakeNativeLibrary.Handle, ptr, $"Unexpected return value for {nameof(NativeLibrary.Load)}");
+ Assert.Equal(FakeNativeLibrary.Handle, ptr);
alc.Reset();
// ALC implementation calls NativeLibrary.TryLoad with a different name
ptr = NativeLibrary.Load(FakeNativeLibrary.RedirectName, asm, null);
alc.Validate(FakeNativeLibrary.RedirectName, FakeNativeLibrary.Name);
- Assert.AreEqual(FakeNativeLibrary.Handle, ptr, $"Unexpected return value for {nameof(NativeLibrary.Load)}");
+ Assert.Equal(FakeNativeLibrary.Handle, ptr);
alc.Reset();
ptr = IntPtr.Zero;
success = NativeLibrary.TryLoad(FakeNativeLibrary.RedirectName, asm, null, out ptr);
- Assert.IsTrue(success, $"NativeLibrary.TryLoad should have succeeded");
+ Assert.True(success, $"NativeLibrary.TryLoad should have succeeded");
alc.Validate(FakeNativeLibrary.RedirectName, FakeNativeLibrary.Name);
- Assert.AreEqual(FakeNativeLibrary.Handle, ptr, $"Unexpected return value for {nameof(NativeLibrary.Load)}");
+ Assert.Equal(FakeNativeLibrary.Handle, ptr);
alc.Reset();
int value = NativeSumInAssemblyLoadContext(alc, addend1, addend2);
alc.Validate(NativeLibraryToLoad.InvalidName);
- Assert.AreEqual(expected, value, $"Unexpected return value for {nameof(NativeSum)}");
+ Assert.Equal(expected, value);
}
public static void ValidateResolvingUnmanagedDllEvent()
using (var handler = new Handlers(alc, returnValid: false))
{
Assert.Throws<DllNotFoundException>(() => NativeLibrary.Load(FakeNativeLibrary.Name, assembly, null));
- Assert.IsTrue(handler.EventHandlerInvoked, "Event handler should have been invoked");
+ Assert.True(handler.EventHandlerInvoked);
}
using (var handler = new Handlers(alc, returnValid: true))
{
IntPtr ptr = NativeLibrary.Load(FakeNativeLibrary.Name, assembly, null);
- Assert.IsTrue(handler.EventHandlerInvoked, "Event handler should have been invoked");
- Assert.AreEqual(FakeNativeLibrary.Handle, ptr, $"Unexpected return value for {nameof(NativeLibrary.Load)}");
+ Assert.True(handler.EventHandlerInvoked);
+ Assert.Equal(FakeNativeLibrary.Handle, ptr);
}
}
else
{
TargetInvocationException ex = Assert.Throws<TargetInvocationException>(() => NativeSumInAssemblyLoadContext(alc, addend1, addend2));
- Assert.AreEqual(typeof(DllNotFoundException), ex.InnerException.GetType());
+ Assert.Equal(typeof(DllNotFoundException), ex.InnerException.GetType());
}
- Assert.IsTrue(handler.EventHandlerInvoked, "Event handler should have been invoked");
+ Assert.True(handler.EventHandlerInvoked);
}
// Multiple handlers - first valid result is used
? NativeSum(addend1, addend2)
: NativeSumInAssemblyLoadContext(alc, addend1, addend2);
- Assert.IsTrue(handlerInvalid.EventHandlerInvoked, "Event handler should have been invoked");
- Assert.IsTrue(handlerValid1.EventHandlerInvoked, "Event handler should have been invoked");
- Assert.IsFalse(handlerValid2.EventHandlerInvoked, "Event handler should not have been invoked");
- Assert.AreEqual(expected, value, $"Unexpected return value for {nameof(NativeSum)} in {alc}");
+ Assert.True(handlerInvalid.EventHandlerInvoked);
+ Assert.True(handlerValid1.EventHandlerInvoked);
+ Assert.False(handlerValid2.EventHandlerInvoked);
+ Assert.Equal(expected, value);
}
}
using System.Reflection;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.SafeDirectories)]
public class CallbackTests
DllImportResolver resolver = Resolver.Instance.Callback;
// Invalid arguments
- Assert.Throws<ArgumentNullException>(() => NativeLibrary.SetDllImportResolver(null, resolver), "Exception expected for null assembly parameter");
- Assert.Throws<ArgumentNullException>(() => NativeLibrary.SetDllImportResolver(assembly, null), "Exception expected for null resolver parameter");
+ Assert.Throws<ArgumentNullException>(() => NativeLibrary.SetDllImportResolver(null, resolver));
+ Assert.Throws<ArgumentNullException>(() => NativeLibrary.SetDllImportResolver(assembly, null));
// No callback registered yet
Assert.Throws<DllNotFoundException>(() => NativeSum(10, 10));
NativeLibrary.SetDllImportResolver(assembly, resolver);
// Try to set the resolver again on the same assembly
- Assert.Throws<InvalidOperationException>(() => NativeLibrary.SetDllImportResolver(assembly, resolver), "Should not be able to re-register resolver");
+ Assert.Throws<InvalidOperationException>(() => NativeLibrary.SetDllImportResolver(assembly, resolver));
// Try to set another resolver on the same assembly
DllImportResolver anotherResolver =
(string libraryName, Assembly asm, DllImportSearchPath? dllImportSearchPath) =>
IntPtr.Zero;
- Assert.Throws<InvalidOperationException>(() => NativeLibrary.SetDllImportResolver(assembly, anotherResolver), "Should not be able to register another resolver");
+ Assert.Throws<InvalidOperationException>(() => NativeLibrary.SetDllImportResolver(assembly, anotherResolver));
}
public static void ValidatePInvoke()
Resolver.Instance.Reset();
int value = NativeSum(addend1, addend2);
Resolver.Instance.Validate(NativeLibraryToLoad.InvalidName);
- Assert.AreEqual(expected, value, $"Unexpected return value from {nameof(NativeSum)}");
+ Assert.Equal(expected, value);
}
private class Resolver
public void Validate(params string[] expectedNames)
{
- Assert.AreEqual(expectedNames.Length, invocations.Count, $"Unexpected invocation count for registered {nameof(DllImportResolver)}.");
+ Assert.Equal(expectedNames.Length, invocations.Count);
for (int i = 0; i < expectedNames.Length; i++)
- Assert.AreEqual(expectedNames[i], invocations[i], $"Unexpected library name received by registered resolver.");
+ Assert.Equal(expectedNames[i], invocations[i]);
}
private IntPtr ResolveDllImport(string libraryName, Assembly asm, DllImportSearchPath? dllImportSearchPath)
if (string.Equals(libraryName, NativeLibraryToLoad.InvalidName))
{
- Assert.AreEqual(DllImportSearchPath.System32, dllImportSearchPath, $"Unexpected {nameof(dllImportSearchPath)}: {dllImportSearchPath.ToString()}");
+ Assert.Equal(DllImportSearchPath.System32, dllImportSearchPath);
return NativeLibrary.Load(NativeLibraryToLoad.Name, asm, null);
}
using System;
using System.Runtime.InteropServices;
using System.Threading;
-using TestLibrary;
+using Xunit;
internal static unsafe class ObjectiveC
{
GC.Collect();
GC.WaitForPendingFinalizers();
- Assert.AreEqual(numReleaseCalls + 1, ObjectiveC.getNumReleaseCalls());
+ Assert.Equal(numReleaseCalls + 1, ObjectiveC.getNumReleaseCalls());
}
static void RunScenario(AutoResetEvent evt)
evt.WaitOne();
// Wait 60 ms after the signal to ensure that the thread has finished the work item and has drained the thread's autorelease pool.
Thread.Sleep(60);
- Assert.AreEqual(numReleaseCalls + 1, ObjectiveC.getNumReleaseCalls());
+ Assert.Equal(numReleaseCalls + 1, ObjectiveC.getNumReleaseCalls());
}
}
}
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ObjectiveC;
- using TestLibrary;
+ using Xunit;
class NativeObjCMarshalTests
{
{
if (_contract != null)
{
- Assert.AreEqual(nuint.MaxValue, _contract->RefCountDown); // Validate finalizer queue callback
- Assert.AreEqual(_expectedCount, _contract->RefCountUp); // Validate "is referenced" callback
+ Assert.Equal(nuint.MaxValue, _contract->RefCountDown); // Validate finalizer queue callback
+ Assert.Equal(_expectedCount, _contract->RefCountUp); // Validate "is referenced" callback
}
FinalizeCount++;
_contract = (Contract*)mem;
// Contract should be 0 initialized when supplied.
- Assert.AreEqual((nuint)0, _contract->RefCountDown);
- Assert.AreEqual((nuint)0, _contract->RefCountUp);
+ Assert.Equal((nuint)0, _contract->RefCountDown);
+ Assert.Equal((nuint)0, _contract->RefCountUp);
_expectedCount = (nuint)count;
_contract->RefCountDown = _expectedCount;
GCHandle h = ObjectiveCMarshal.CreateReferenceTrackingHandle(obj, out Span<IntPtr> s);
// Validate contract length for tagged memory.
- Assert.AreEqual(2, s.Length);
+ Assert.Equal(2, s.Length);
// Make the "is referenced" callback run at least 'count' number of times.
fixed (void* p = s)
// Validate the memory is the same but the GCHandles are distinct.
fixed (void* p = s)
- Assert.AreEqual(obj.Contract, new IntPtr(p));
+ Assert.Equal(obj.Contract, new IntPtr(p));
- Assert.AreNotEqual(handle, h);
+ Assert.NotEqual(handle, h);
h.Free();
}
// Validate we finalized all the objects we allocated.
// It is important to validate the count prior to freeing
// the handles to verify they are not keeping objects alive.
- Assert.AreEqual(Base.FinalizeCount, Base.AllocCount);
+ Assert.Equal(Base.FinalizeCount, Base.AllocCount);
// Clean up all allocated handles that are no longer needed.
foreach (var h in handles)
out IntPtr context)
{
var lastMethod = (MethodInfo)MethodBase.GetMethodFromHandle(lastMethodHandle);
- Assert.IsTrue(lastMethod != null);
+ Assert.True(lastMethod != null);
context = IntPtr.Zero;
if (e is IntException ie)
return (delegate* unmanaged<IntPtr, void>)NativeObjCMarshalTests.GetThrowException();
}
- Assert.Fail("Unknown exception type");
+ Assert.True(false, "Unknown exception type");
throw new Exception("Unreachable");
}
{
delegate* unmanaged<int, void> testNativeMethod = scen.Fptr;
int ret = NativeObjCMarshalTests.CallAndCatch((IntPtr)testNativeMethod, scen.Expected);
- Assert.AreEqual(scen.Expected, ret);
+ Assert.Equal(scen.Expected, ret);
}
GC.KeepAlive(delThrowInt);
static void Validate_Initialize_FailsOnSecondAttempt()
{
Console.WriteLine($"Running {nameof(Validate_Initialize_FailsOnSecondAttempt)}...");
-
+
Assert.Throws<InvalidOperationException>(
() =>
{
return 100;
}
}
-}
\ No newline at end of file
+}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
#region Sequential
#region sequential struct definition
[DllImport("MarshalArrayByValArrayNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool TakeLPSTRArrayExpStructByVal([In]S_LPSTRArray_Exp s, int size);
-
+
[DllImport("MarshalArrayByValArrayNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool TakeLPCSTRArrayExpStructByVal([In]S_LPCSTRArray_Exp s, int size);
-
+
[DllImport("MarshalArrayByValArrayNative", CallingConvention = CallingConvention.Cdecl)]
static extern bool TakeBSTRArrayExpStructByVal([In]S_BSTRArray_Exp s, int size);
S_INTArray_Seq s1 = new S_INTArray_Seq();
s1.arr = InitArray<int>(ARRAY_SIZE);
- Assert.IsTrue(TakeIntArraySeqStructByVal(s1, s1.arr.Length), "TakeIntArraySeqStructByVal");
+ Assert.True(TakeIntArraySeqStructByVal(s1, s1.arr.Length));
S_UINTArray_Seq s2 = new S_UINTArray_Seq();
s2.arr = InitArray<uint>(ARRAY_SIZE);
- Assert.IsTrue(TakeUIntArraySeqStructByVal(s2, s2.arr.Length), "TakeUIntArraySeqStructByVal");
+ Assert.True(TakeUIntArraySeqStructByVal(s2, s2.arr.Length));
S_SHORTArray_Seq s3 = new S_SHORTArray_Seq();
s3.arr = InitArray<short>(ARRAY_SIZE);
- Assert.IsTrue(TakeShortArraySeqStructByVal(s3, s3.arr.Length), "TakeShortArraySeqStructByVal");
+ Assert.True(TakeShortArraySeqStructByVal(s3, s3.arr.Length));
S_WORDArray_Seq s4 = new S_WORDArray_Seq();
s4.arr = InitArray<ushort>(ARRAY_SIZE);
- Assert.IsTrue(TakeWordArraySeqStructByVal(s4, s4.arr.Length), "TakeWordArraySeqStructByVal");
+ Assert.True(TakeWordArraySeqStructByVal(s4, s4.arr.Length));
S_LONG64Array_Seq s5 = new S_LONG64Array_Seq();
s5.arr = InitArray<long>(ARRAY_SIZE);
- Assert.IsTrue(TakeLong64ArraySeqStructByVal(s5, s5.arr.Length), "TakeLong64ArraySeqStructByVal");
+ Assert.True(TakeLong64ArraySeqStructByVal(s5, s5.arr.Length));
S_ULONG64Array_Seq s6 = new S_ULONG64Array_Seq();
s6.arr = InitArray<ulong>(ARRAY_SIZE);
- Assert.IsTrue(TakeULong64ArraySeqStructByVal(s6, s6.arr.Length), "TakeULong64ArraySeqStructByVal");
+ Assert.True(TakeULong64ArraySeqStructByVal(s6, s6.arr.Length));
S_DOUBLEArray_Seq s7 = new S_DOUBLEArray_Seq();
s7.arr = InitArray<double>(ARRAY_SIZE);
- Assert.IsTrue(TakeDoubleArraySeqStructByVal(s7, s7.arr.Length), "TakeDoubleArraySeqStructByVal");
+ Assert.True(TakeDoubleArraySeqStructByVal(s7, s7.arr.Length));
S_FLOATArray_Seq s8 = new S_FLOATArray_Seq();
s8.arr = InitArray<float>(ARRAY_SIZE);
- Assert.IsTrue(TakeFloatArraySeqStructByVal(s8, s8.arr.Length), "TakeFloatArraySeqStructByVal");
+ Assert.True(TakeFloatArraySeqStructByVal(s8, s8.arr.Length));
S_BYTEArray_Seq s9 = new S_BYTEArray_Seq();
s9.arr = InitArray<byte>(ARRAY_SIZE);
- Assert.IsTrue(TakeByteArraySeqStructByVal(s9, s9.arr.Length), "TakeByteArraySeqStructByVal");
+ Assert.True(TakeByteArraySeqStructByVal(s9, s9.arr.Length));
S_CHARArray_Seq s10 = new S_CHARArray_Seq();
s10.arr = InitArray<char>(ARRAY_SIZE);
- Assert.IsTrue(TakeCharArraySeqStructByVal(s10, s10.arr.Length), "TakeCharArraySeqStructByVal");
+ Assert.True(TakeCharArraySeqStructByVal(s10, s10.arr.Length));
S_LPSTRArray_Seq s11 = new S_LPSTRArray_Seq();
s11.arr = InitArray<string>(ARRAY_SIZE);
- Assert.IsTrue(TakeLPSTRArraySeqStructByVal(s11, s11.arr.Length),"TakeLPSTRArraySeqStructByVal");
+ Assert.True(TakeLPSTRArraySeqStructByVal(s11, s11.arr.Length),"TakeLPSTRArraySeqStructByVal");
S_LPCSTRArray_Seq s12 = new S_LPCSTRArray_Seq();
s12.arr = InitArray<string>(ARRAY_SIZE);
- Assert.IsTrue(TakeLPCSTRArraySeqStructByVal(s12, s12.arr.Length),"TakeLPCSTRArraySeqStructByVal");
+ Assert.True(TakeLPCSTRArraySeqStructByVal(s12, s12.arr.Length),"TakeLPCSTRArraySeqStructByVal");
if (OperatingSystem.IsWindows())
{
S_BSTRArray_Seq s13 = new S_BSTRArray_Seq();
s13.arr = InitArray<string>(ARRAY_SIZE);
- Assert.IsTrue(TakeBSTRArraySeqStructByVal(s13, s13.arr.Length),"TakeBSTRArraySeqStructByVal");
+ Assert.True(TakeBSTRArraySeqStructByVal(s13, s13.arr.Length),"TakeBSTRArraySeqStructByVal");
}
S_StructArray_Seq s14 = new S_StructArray_Seq();
s14.arr = InitStructArray(ARRAY_SIZE);
- Assert.IsTrue(TakeStructArraySeqStructByVal(s14, s14.arr.Length),"TakeStructArraySeqStructByVal");
+ Assert.True(TakeStructArraySeqStructByVal(s14, s14.arr.Length),"TakeStructArraySeqStructByVal");
EnregisterableNonBlittable_Seq s15 = new EnregisterableNonBlittable_Seq
{
}
};
- Assert.IsTrue(TakeEnregistrableNonBlittableSeqStructByVal(s15, s15.arr), "EnregisterableNonBlittableSeqStructByVal");
+ Assert.True(TakeEnregistrableNonBlittableSeqStructByVal(s15, s15.arr));
EnregisterableUserType s16 = new EnregisterableUserType
{
}
};
- Assert.IsTrue(TakeEnregisterableUserTypeStructByVal(s16, s16.arr), "TakeEnregisterableUserTypeStructByVal");
+ Assert.True(TakeEnregisterableUserTypeStructByVal(s16, s16.arr));
}
static void RunTest2(string report)
C_INTArray_Seq c1 = new C_INTArray_Seq();
c1.arr = InitArray<int>(ARRAY_SIZE);
- Assert.IsTrue(TakeIntArraySeqClassByVal(c1, c1.arr.Length));
+ Assert.True(TakeIntArraySeqClassByVal(c1, c1.arr.Length));
C_UINTArray_Seq c2 = new C_UINTArray_Seq();
c2.arr = InitArray<uint>(ARRAY_SIZE);
- Assert.IsTrue(TakeUIntArraySeqClassByVal(c2, c2.arr.Length));
+ Assert.True(TakeUIntArraySeqClassByVal(c2, c2.arr.Length));
C_SHORTArray_Seq c3 = new C_SHORTArray_Seq();
c3.arr = InitArray<short>(ARRAY_SIZE);
- Assert.IsTrue(TakeShortArraySeqClassByVal(c3, c3.arr.Length));
+ Assert.True(TakeShortArraySeqClassByVal(c3, c3.arr.Length));
C_WORDArray_Seq c4 = new C_WORDArray_Seq();
c4.arr = InitArray<ushort>(ARRAY_SIZE);
- Assert.IsTrue(TakeWordArraySeqClassByVal(c4, c4.arr.Length));
+ Assert.True(TakeWordArraySeqClassByVal(c4, c4.arr.Length));
C_LONG64Array_Seq c5 = new C_LONG64Array_Seq();
c5.arr = InitArray<long>(ARRAY_SIZE);
- Assert.IsTrue(TakeLong64ArraySeqClassByVal(c5, c5.arr.Length));
+ Assert.True(TakeLong64ArraySeqClassByVal(c5, c5.arr.Length));
C_ULONG64Array_Seq c6 = new C_ULONG64Array_Seq();
c6.arr = InitArray<ulong>(ARRAY_SIZE);
- Assert.IsTrue(TakeULong64ArraySeqClassByVal(c6, c6.arr.Length));
+ Assert.True(TakeULong64ArraySeqClassByVal(c6, c6.arr.Length));
C_DOUBLEArray_Seq c7 = new C_DOUBLEArray_Seq();
c7.arr = InitArray<double>(ARRAY_SIZE);
- Assert.IsTrue(TakeDoubleArraySeqClassByVal(c7, c7.arr.Length));
+ Assert.True(TakeDoubleArraySeqClassByVal(c7, c7.arr.Length));
C_FLOATArray_Seq c8 = new C_FLOATArray_Seq();
c8.arr = InitArray<float>(ARRAY_SIZE);
- Assert.IsTrue(TakeFloatArraySeqClassByVal(c8, c8.arr.Length));
+ Assert.True(TakeFloatArraySeqClassByVal(c8, c8.arr.Length));
C_BYTEArray_Seq c9 = new C_BYTEArray_Seq();
c9.arr = InitArray<byte>(ARRAY_SIZE);
- Assert.IsTrue(TakeByteArraySeqClassByVal(c9, c9.arr.Length));
+ Assert.True(TakeByteArraySeqClassByVal(c9, c9.arr.Length));
C_CHARArray_Seq c10 = new C_CHARArray_Seq();
c10.arr = InitArray<char>(ARRAY_SIZE);
- Assert.IsTrue(TakeCharArraySeqClassByVal(c10, c10.arr.Length));
+ Assert.True(TakeCharArraySeqClassByVal(c10, c10.arr.Length));
C_LPSTRArray_Seq c11 = new C_LPSTRArray_Seq();
c11.arr = InitArray<string>(ARRAY_SIZE);
- Assert.IsTrue(TakeLPSTRArraySeqClassByVal(c11, c11.arr.Length));
+ Assert.True(TakeLPSTRArraySeqClassByVal(c11, c11.arr.Length));
C_LPCSTRArray_Seq c12 = new C_LPCSTRArray_Seq();
c12.arr = InitArray<string>(ARRAY_SIZE);
- Assert.IsTrue(TakeLPCSTRArraySeqClassByVal(c12, c12.arr.Length));
+ Assert.True(TakeLPCSTRArraySeqClassByVal(c12, c12.arr.Length));
if (OperatingSystem.IsWindows())
{
C_BSTRArray_Seq c13 = new C_BSTRArray_Seq();
c13.arr = InitArray<string>(ARRAY_SIZE);
- Assert.IsTrue(TakeBSTRArraySeqClassByVal(c13, c13.arr.Length));
+ Assert.True(TakeBSTRArraySeqClassByVal(c13, c13.arr.Length));
}
C_StructArray_Seq c14 = new C_StructArray_Seq();
c14.arr = InitStructArray(ARRAY_SIZE);
- Assert.IsTrue(TakeStructArraySeqClassByVal(c14, c14.arr.Length));
+ Assert.True(TakeStructArraySeqClassByVal(c14, c14.arr.Length));
}
static void RunTest3(string report)
S_INTArray_Exp s1 = new S_INTArray_Exp();
s1.arr = InitArray<int>(ARRAY_SIZE);
- Assert.IsTrue(TakeIntArrayExpStructByVal(s1, s1.arr.Length), "TakeIntArrayExpStructByVal");
+ Assert.True(TakeIntArrayExpStructByVal(s1, s1.arr.Length));
S_UINTArray_Exp s2 = new S_UINTArray_Exp();
s2.arr = InitArray<uint>(ARRAY_SIZE);
- Assert.IsTrue(TakeUIntArrayExpStructByVal(s2, s2.arr.Length), "TakeUIntArrayExpStructByVal");
+ Assert.True(TakeUIntArrayExpStructByVal(s2, s2.arr.Length));
S_SHORTArray_Exp s3 = new S_SHORTArray_Exp();
s3.arr = InitArray<short>(ARRAY_SIZE);
- Assert.IsTrue(TakeShortArrayExpStructByVal(s3, s3.arr.Length), "TakeShortArrayExpStructByVal");
+ Assert.True(TakeShortArrayExpStructByVal(s3, s3.arr.Length));
S_WORDArray_Exp s4 = new S_WORDArray_Exp();
s4.arr = InitArray<ushort>(ARRAY_SIZE);
- Assert.IsTrue(TakeWordArrayExpStructByVal(s4, s4.arr.Length), "TakeWordArrayExpStructByVal");
+ Assert.True(TakeWordArrayExpStructByVal(s4, s4.arr.Length));
S_LONG64Array_Exp s5 = new S_LONG64Array_Exp();
s5.arr = InitArray<long>(ARRAY_SIZE);
- Assert.IsTrue(TakeLong64ArrayExpStructByVal(s5, s5.arr.Length), "TakeLong64ArrayExpStructByVal");
+ Assert.True(TakeLong64ArrayExpStructByVal(s5, s5.arr.Length));
S_ULONG64Array_Exp s6 = new S_ULONG64Array_Exp();
s6.arr = InitArray<ulong>(ARRAY_SIZE);
- Assert.IsTrue(TakeULong64ArrayExpStructByVal(s6, s6.arr.Length), "TakeULong64ArrayExpStructByVal");
+ Assert.True(TakeULong64ArrayExpStructByVal(s6, s6.arr.Length));
S_DOUBLEArray_Exp s7 = new S_DOUBLEArray_Exp();
s7.arr = InitArray<double>(ARRAY_SIZE);
- Assert.IsTrue(TakeDoubleArrayExpStructByVal(s7, s7.arr.Length), "TakeDoubleArrayExpStructByVal");
+ Assert.True(TakeDoubleArrayExpStructByVal(s7, s7.arr.Length));
S_FLOATArray_Exp s8 = new S_FLOATArray_Exp();
s8.arr = InitArray<float>(ARRAY_SIZE);
- Assert.IsTrue(TakeFloatArrayExpStructByVal(s8, s8.arr.Length), "TakeFloatArrayExpStructByVal");
+ Assert.True(TakeFloatArrayExpStructByVal(s8, s8.arr.Length));
S_BYTEArray_Exp s9 = new S_BYTEArray_Exp();
s9.arr = InitArray<byte>(ARRAY_SIZE);
- Assert.IsTrue(TakeByteArrayExpStructByVal(s9, s9.arr.Length), "TakeByteArrayExpStructByVal");
+ Assert.True(TakeByteArrayExpStructByVal(s9, s9.arr.Length));
S_CHARArray_Exp s10 = new S_CHARArray_Exp();
s10.arr = InitArray<char>(ARRAY_SIZE);
- Assert.IsTrue(TakeCharArrayExpStructByVal(s10, s10.arr.Length), "TakeCharArrayExpStructByVal");
+ Assert.True(TakeCharArrayExpStructByVal(s10, s10.arr.Length));
S_LPSTRArray_Exp s11 = new S_LPSTRArray_Exp();
s11.arr = InitArray<string>(ARRAY_SIZE);
- Assert.IsTrue(TakeLPSTRArrayExpStructByVal(s11, s11.arr.Length));
+ Assert.True(TakeLPSTRArrayExpStructByVal(s11, s11.arr.Length));
S_LPCSTRArray_Exp s12 = new S_LPCSTRArray_Exp();
s12.arr = InitArray<string>(ARRAY_SIZE);
- Assert.IsTrue(TakeLPCSTRArrayExpStructByVal(s12, s12.arr.Length));
+ Assert.True(TakeLPCSTRArrayExpStructByVal(s12, s12.arr.Length));
if (OperatingSystem.IsWindows())
{
S_BSTRArray_Exp c13 = new S_BSTRArray_Exp();
c13.arr = InitArray<string>(ARRAY_SIZE);
- Assert.IsTrue(TakeBSTRArrayExpStructByVal(c13, c13.arr.Length));
+ Assert.True(TakeBSTRArrayExpStructByVal(c13, c13.arr.Length));
}
S_StructArray_Exp s14 = new S_StructArray_Exp();
s14.arr = InitStructArray(ARRAY_SIZE);
- Assert.IsTrue(TakeStructArrayExpStructByVal(s14, s14.arr.Length));
+ Assert.True(TakeStructArrayExpStructByVal(s14, s14.arr.Length));
}
static void RunTest4(string report)
C_INTArray_Exp c1 = new C_INTArray_Exp();
c1.arr = InitArray<int>(ARRAY_SIZE);
- Assert.IsTrue(TakeIntArrayExpClassByVal(c1, c1.arr.Length));
+ Assert.True(TakeIntArrayExpClassByVal(c1, c1.arr.Length));
C_UINTArray_Exp c2 = new C_UINTArray_Exp();
c2.arr = InitArray<uint>(ARRAY_SIZE);
- Assert.IsTrue(TakeUIntArrayExpClassByVal(c2, c2.arr.Length));
+ Assert.True(TakeUIntArrayExpClassByVal(c2, c2.arr.Length));
C_SHORTArray_Exp c3 = new C_SHORTArray_Exp();
c3.arr = InitArray<short>(ARRAY_SIZE);
- Assert.IsTrue(TakeShortArrayExpClassByVal(c3, c3.arr.Length));
+ Assert.True(TakeShortArrayExpClassByVal(c3, c3.arr.Length));
C_WORDArray_Exp c4 = new C_WORDArray_Exp();
c4.arr = InitArray<ushort>(ARRAY_SIZE);
- Assert.IsTrue(TakeWordArrayExpClassByVal(c4, c4.arr.Length));
+ Assert.True(TakeWordArrayExpClassByVal(c4, c4.arr.Length));
C_LONG64Array_Exp c5 = new C_LONG64Array_Exp();
c5.arr = InitArray<long>(ARRAY_SIZE);
- Assert.IsTrue(TakeLong64ArrayExpClassByVal(c5, c5.arr.Length));
+ Assert.True(TakeLong64ArrayExpClassByVal(c5, c5.arr.Length));
C_ULONG64Array_Exp c6 = new C_ULONG64Array_Exp();
c6.arr = InitArray<ulong>(ARRAY_SIZE);
- Assert.IsTrue(TakeULong64ArrayExpClassByVal(c6, c6.arr.Length));
+ Assert.True(TakeULong64ArrayExpClassByVal(c6, c6.arr.Length));
C_DOUBLEArray_Exp c7 = new C_DOUBLEArray_Exp();
c7.arr = InitArray<double>(ARRAY_SIZE);
- Assert.IsTrue(TakeDoubleArrayExpClassByVal(c7, c7.arr.Length));
+ Assert.True(TakeDoubleArrayExpClassByVal(c7, c7.arr.Length));
C_FLOATArray_Exp c8 = new C_FLOATArray_Exp();
c8.arr = InitArray<float>(ARRAY_SIZE);
- Assert.IsTrue(TakeFloatArrayExpClassByVal(c8, c8.arr.Length));
+ Assert.True(TakeFloatArrayExpClassByVal(c8, c8.arr.Length));
C_BYTEArray_Exp c9 = new C_BYTEArray_Exp();
c9.arr = InitArray<byte>(ARRAY_SIZE);
- Assert.IsTrue(TakeByteArrayExpClassByVal(c9, c9.arr.Length));
+ Assert.True(TakeByteArrayExpClassByVal(c9, c9.arr.Length));
C_CHARArray_Exp c10 = new C_CHARArray_Exp();
c10.arr = InitArray<char>(ARRAY_SIZE);
- Assert.IsTrue(TakeCharArrayExpClassByVal(c10, c10.arr.Length));
+ Assert.True(TakeCharArrayExpClassByVal(c10, c10.arr.Length));
C_LPSTRArray_Exp c11 = new C_LPSTRArray_Exp();
c11.arr = InitArray<string>(ARRAY_SIZE);
- Assert.IsTrue(TakeLPSTRArrayExpClassByVal(c11, c11.arr.Length));
+ Assert.True(TakeLPSTRArrayExpClassByVal(c11, c11.arr.Length));
C_LPCSTRArray_Exp c12 = new C_LPCSTRArray_Exp();
c12.arr = InitArray<string>(ARRAY_SIZE);
- Assert.IsTrue(TakeLPCSTRArrayExpClassByVal(c12, c12.arr.Length));
+ Assert.True(TakeLPCSTRArrayExpClassByVal(c12, c12.arr.Length));
if (OperatingSystem.IsWindows())
{
C_BSTRArray_Exp c13 = new C_BSTRArray_Exp();
c13.arr = InitArray<string>(ARRAY_SIZE);
- Assert.IsTrue(TakeBSTRArrayExpClassByVal(c13, c13.arr.Length));
+ Assert.True(TakeBSTRArrayExpClassByVal(c13, c13.arr.Length));
}
C_StructArray_Exp c14 = new C_StructArray_Exp();
c14.arr = InitStructArray(ARRAY_SIZE);
- Assert.IsTrue(TakeStructArrayExpClassByVal(c14, c14.arr.Length));
+ Assert.True(TakeStructArrayExpClassByVal(c14, c14.arr.Length));
}
static void RunTest5(string report)
{
Console.WriteLine(report);
-
+
S_INTArray_Seq retval = S_INTArray_Ret_ByValue();
- Assert.IsTrue(Equals(InitArray<int>(ARRAY_SIZE), retval.arr));
+ Assert.True(Equals(InitArray<int>(ARRAY_SIZE), retval.arr));
C_INTArray_Seq retval1 = S_INTArray_Ret();
- Assert.IsTrue(Equals(InitArray<int>(ARRAY_SIZE), retval1.arr));
+ Assert.True(Equals(InitArray<int>(ARRAY_SIZE), retval1.arr));
C_UINTArray_Seq retval2 = S_UINTArray_Ret();
- Assert.IsTrue(Equals(InitArray<uint>(ARRAY_SIZE), retval2.arr));
+ Assert.True(Equals(InitArray<uint>(ARRAY_SIZE), retval2.arr));
C_SHORTArray_Seq retval3 = S_SHORTArray_Ret();
- Assert.IsTrue(Equals(InitArray<short>(ARRAY_SIZE), retval3.arr));
+ Assert.True(Equals(InitArray<short>(ARRAY_SIZE), retval3.arr));
C_WORDArray_Seq retval4 = S_WORDArray_Ret();
- Assert.IsTrue(Equals(InitArray<ushort>(ARRAY_SIZE), retval4.arr));
+ Assert.True(Equals(InitArray<ushort>(ARRAY_SIZE), retval4.arr));
C_LONG64Array_Seq retval5 = S_LONG64Array_Ret();
- Assert.IsTrue(Equals(InitArray<long>(ARRAY_SIZE), retval5.arr));
+ Assert.True(Equals(InitArray<long>(ARRAY_SIZE), retval5.arr));
C_ULONG64Array_Seq retval6 = S_ULONG64Array_Ret();
- Assert.IsTrue(Equals(InitArray<ulong>(ARRAY_SIZE), retval6.arr));
+ Assert.True(Equals(InitArray<ulong>(ARRAY_SIZE), retval6.arr));
C_DOUBLEArray_Seq retval7 = S_DOUBLEArray_Ret();
- Assert.IsTrue(Equals(InitArray<double>(ARRAY_SIZE), retval7.arr));
+ Assert.True(Equals(InitArray<double>(ARRAY_SIZE), retval7.arr));
C_FLOATArray_Seq retval8 = S_FLOATArray_Ret();
- Assert.IsTrue(Equals(InitArray<float>(ARRAY_SIZE), retval8.arr));
+ Assert.True(Equals(InitArray<float>(ARRAY_SIZE), retval8.arr));
C_BYTEArray_Seq retval9 = S_BYTEArray_Ret();
- Assert.IsTrue(Equals(InitArray<byte>(ARRAY_SIZE), retval9.arr));
+ Assert.True(Equals(InitArray<byte>(ARRAY_SIZE), retval9.arr));
C_CHARArray_Seq retval10 = S_CHARArray_Ret();
- Assert.IsTrue(Equals(InitArray<char>(ARRAY_SIZE), retval10.arr));
+ Assert.True(Equals(InitArray<char>(ARRAY_SIZE), retval10.arr));
C_LPSTRArray_Seq retval11 = S_LPSTRArray_Ret();
- Assert.IsTrue(Equals(InitArray<string>(ARRAY_SIZE), retval11.arr));
+ Assert.True(Equals(InitArray<string>(ARRAY_SIZE), retval11.arr));
if (OperatingSystem.IsWindows())
{
C_BSTRArray_Seq retval12 = S_BSTRArray_Ret();
- Assert.IsTrue(Equals(InitArray<string>(ARRAY_SIZE), retval12.arr));
+ Assert.True(Equals(InitArray<string>(ARRAY_SIZE), retval12.arr));
}
C_StructArray_Seq retval13 = S_StructArray_Ret();
- Assert.IsTrue(TestStructEquals(InitStructArray(ARRAY_SIZE), retval13.arr));
+ Assert.True(TestStructEquals(InitStructArray(ARRAY_SIZE), retval13.arr));
}
static void RunTest6(string report)
Console.WriteLine(report);
C_INTArray_Exp retval1 = S_INTArray_Ret2();
- Assert.IsTrue(Equals(InitArray<int>(ARRAY_SIZE), retval1.arr));
+ Assert.True(Equals(InitArray<int>(ARRAY_SIZE), retval1.arr));
C_UINTArray_Exp retval2 = S_UINTArray_Ret2();
- Assert.IsTrue(Equals(InitArray<uint>(ARRAY_SIZE), retval2.arr));
+ Assert.True(Equals(InitArray<uint>(ARRAY_SIZE), retval2.arr));
C_SHORTArray_Exp retval3 = S_SHORTArray_Ret2();
- Assert.IsTrue(Equals(InitArray<short>(ARRAY_SIZE), retval3.arr));
+ Assert.True(Equals(InitArray<short>(ARRAY_SIZE), retval3.arr));
C_WORDArray_Exp retval4 = S_WORDArray_Ret2();
- Assert.IsTrue(Equals(InitArray<ushort>(ARRAY_SIZE), retval4.arr));
+ Assert.True(Equals(InitArray<ushort>(ARRAY_SIZE), retval4.arr));
C_LONG64Array_Exp retval5 = S_LONG64Array_Ret2();
- Assert.IsTrue(Equals(InitArray<long>(ARRAY_SIZE), retval5.arr));
+ Assert.True(Equals(InitArray<long>(ARRAY_SIZE), retval5.arr));
C_ULONG64Array_Exp retval6 = S_ULONG64Array_Ret2();
- Assert.IsTrue(Equals(InitArray<ulong>(ARRAY_SIZE), retval6.arr));
+ Assert.True(Equals(InitArray<ulong>(ARRAY_SIZE), retval6.arr));
C_DOUBLEArray_Exp retval7 = S_DOUBLEArray_Ret2();
- Assert.IsTrue(Equals(InitArray<double>(ARRAY_SIZE), retval7.arr));
+ Assert.True(Equals(InitArray<double>(ARRAY_SIZE), retval7.arr));
C_FLOATArray_Exp retval8 = S_FLOATArray_Ret2();
- Assert.IsTrue(Equals(InitArray<float>(ARRAY_SIZE), retval8.arr));
+ Assert.True(Equals(InitArray<float>(ARRAY_SIZE), retval8.arr));
C_BYTEArray_Exp retval9 = S_BYTEArray_Ret2();
- Assert.IsTrue(Equals(InitArray<byte>(ARRAY_SIZE), retval9.arr));
+ Assert.True(Equals(InitArray<byte>(ARRAY_SIZE), retval9.arr));
C_CHARArray_Exp retval10 = S_CHARArray_Ret2();
- Assert.IsTrue(Equals(InitArray<char>(ARRAY_SIZE), retval10.arr));
+ Assert.True(Equals(InitArray<char>(ARRAY_SIZE), retval10.arr));
C_LPSTRArray_Exp retval11 = S_LPSTRArray_Ret2();
- Assert.IsTrue(Equals(InitArray<string>(ARRAY_SIZE), retval11.arr));
+ Assert.True(Equals(InitArray<string>(ARRAY_SIZE), retval11.arr));
if (OperatingSystem.IsWindows())
{
C_BSTRArray_Exp retval12 = S_BSTRArray_Ret2();
- Assert.IsTrue(Equals(InitArray<string>(ARRAY_SIZE), retval12.arr));
+ Assert.True(Equals(InitArray<string>(ARRAY_SIZE), retval12.arr));
}
C_StructArray_Exp retval13 = S_StructArray_Ret2();
- Assert.IsTrue(TestStructEquals(InitStructArray(ARRAY_SIZE), retval13.arr));
+ Assert.True(TestStructEquals(InitStructArray(ARRAY_SIZE), retval13.arr));
}
static int Main(string[] args)
RunTest4("RunTest4 : Marshal array as field as ByValArray in explicit class as parameter.");
RunTest5("RunTest5 : Marshal array as field as ByValArray in sequential class as return type.");
RunTest6("RunTest6 : Marshal array as field as ByValArray in explicit class as return type.");
-
+
Console.WriteLine("\nTest PASS.");
return 100;
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
class Test
{
Console.WriteLine(report);
S_INTArray_Seq s1 = new S_INTArray_Seq();
s1.arr = InitArray<int>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeIntArraySeqStructByVal(s1, ARRAY_SIZE), "TakeIntArraySeqStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeIntArraySeqStructByVal(s1, ARRAY_SIZE));
S_UINTArray_Seq s2 = new S_UINTArray_Seq();
s2.arr = InitArray<uint>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeUIntArraySeqStructByVal(s2, ARRAY_SIZE), "TakeUIntArraySeqStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeUIntArraySeqStructByVal(s2, ARRAY_SIZE));
S_SHORTArray_Seq s3 = new S_SHORTArray_Seq();
s3.arr = InitArray<short>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeShortArraySeqStructByVal(s3, ARRAY_SIZE), "TakeShortArraySeqStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeShortArraySeqStructByVal(s3, ARRAY_SIZE));
S_WORDArray_Seq s4 = new S_WORDArray_Seq();
s4.arr = InitArray<ushort>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeWordArraySeqStructByVal(s4, ARRAY_SIZE), "TakeWordArraySeqStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeWordArraySeqStructByVal(s4, ARRAY_SIZE));
S_LONG64Array_Seq s5 = new S_LONG64Array_Seq();
s5.arr = InitArray<long>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeLong64ArraySeqStructByVal(s5, ARRAY_SIZE), "TakeLong64ArraySeqStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeLong64ArraySeqStructByVal(s5, ARRAY_SIZE));
S_ULONG64Array_Seq s6 = new S_ULONG64Array_Seq();
s6.arr = InitArray<ulong>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeULong64ArraySeqStructByVal(s6, ARRAY_SIZE), "TakeULong64ArraySeqStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeULong64ArraySeqStructByVal(s6, ARRAY_SIZE));
S_DOUBLEArray_Seq s7 = new S_DOUBLEArray_Seq();
s7.arr = InitArray<double>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeDoubleArraySeqStructByVal(s7, ARRAY_SIZE), "TakeDoubleArraySeqStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeDoubleArraySeqStructByVal(s7, ARRAY_SIZE));
S_FLOATArray_Seq s8 = new S_FLOATArray_Seq();
s8.arr = InitArray<float>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeFloatArraySeqStructByVal(s8, ARRAY_SIZE), "TakeFloatArraySeqStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeFloatArraySeqStructByVal(s8, ARRAY_SIZE));
S_BYTEArray_Seq s9 = new S_BYTEArray_Seq();
s9.arr = InitArray<byte>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeByteArraySeqStructByVal(s9, ARRAY_SIZE), "TakeByteArraySeqStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeByteArraySeqStructByVal(s9, ARRAY_SIZE));
S_CHARArray_Seq s10 = new S_CHARArray_Seq();
s10.arr = InitArray<char>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeCharArraySeqStructByVal(s10, ARRAY_SIZE), "TakeCharArraySeqStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeCharArraySeqStructByVal(s10, ARRAY_SIZE));
S_LPSTRArray_Seq s11 = new S_LPSTRArray_Seq();
s11.arr = InitArray<string>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeLPSTRArraySeqStructByVal(s11, ARRAY_SIZE), "TakeLPSTRArraySeqStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeLPSTRArraySeqStructByVal(s11, ARRAY_SIZE));
S_LPCSTRArray_Seq s12 = new S_LPCSTRArray_Seq();
s12.arr = InitArray<string>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeLPCSTRArraySeqStructByVal(s12, ARRAY_SIZE), "TakeLPCSTRArraySeqStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeLPCSTRArraySeqStructByVal(s12, ARRAY_SIZE));
if (OperatingSystem.IsWindows())
{
S_BSTRArray_Seq s13 = new S_BSTRArray_Seq();
s13.arr = InitArray<string>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeBSTRArraySeqStructByVal(s13, ARRAY_SIZE), "TakeBSTRArraySeqStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeBSTRArraySeqStructByVal(s13, ARRAY_SIZE));
}
S_StructArray_Seq s14 = new S_StructArray_Seq();
s14.arr = InitStructArray(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeStructArraySeqStructByVal(s14, ARRAY_SIZE), "TakeStructArraySeqStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeStructArraySeqStructByVal(s14, ARRAY_SIZE));
}
static void RunTest2(string report)
Console.WriteLine(report);
C_INTArray_Seq c1 = new C_INTArray_Seq();
c1.arr = InitArray<int>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeIntArraySeqClassByVal(c1, ARRAY_SIZE), "TakeIntArraySeqClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeIntArraySeqClassByVal(c1, ARRAY_SIZE));
C_UINTArray_Seq c2 = new C_UINTArray_Seq();
c2.arr = InitArray<uint>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeUIntArraySeqClassByVal(c2, ARRAY_SIZE), "TakeUIntArraySeqClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeUIntArraySeqClassByVal(c2, ARRAY_SIZE));
C_SHORTArray_Seq c3 = new C_SHORTArray_Seq();
c3.arr = InitArray<short>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeShortArraySeqClassByVal(c3, ARRAY_SIZE), "TakeShortArraySeqClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeShortArraySeqClassByVal(c3, ARRAY_SIZE));
C_WORDArray_Seq c4 = new C_WORDArray_Seq();
c4.arr = InitArray<ushort>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeWordArraySeqClassByVal(c4, ARRAY_SIZE), "TakeWordArraySeqClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeWordArraySeqClassByVal(c4, ARRAY_SIZE));
C_LONG64Array_Seq c5 = new C_LONG64Array_Seq();
c5.arr = InitArray<long>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeLong64ArraySeqClassByVal(c5, ARRAY_SIZE), "TakeLong64ArraySeqClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeLong64ArraySeqClassByVal(c5, ARRAY_SIZE));
C_ULONG64Array_Seq c6 = new C_ULONG64Array_Seq();
c6.arr = InitArray<ulong>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeULong64ArraySeqClassByVal(c6, ARRAY_SIZE), "TakeULong64ArraySeqClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeULong64ArraySeqClassByVal(c6, ARRAY_SIZE));
C_DOUBLEArray_Seq c7 = new C_DOUBLEArray_Seq();
c7.arr = InitArray<double>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeDoubleArraySeqClassByVal(c7, ARRAY_SIZE), "TakeDoubleArraySeqClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeDoubleArraySeqClassByVal(c7, ARRAY_SIZE));
C_FLOATArray_Seq c8 = new C_FLOATArray_Seq();
c8.arr = InitArray<float>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeFloatArraySeqClassByVal(c8, ARRAY_SIZE), "TakeFloatArraySeqClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeFloatArraySeqClassByVal(c8, ARRAY_SIZE));
C_BYTEArray_Seq c9 = new C_BYTEArray_Seq();
c9.arr = InitArray<byte>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeByteArraySeqClassByVal(c9, ARRAY_SIZE), "TakeByteArraySeqClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeByteArraySeqClassByVal(c9, ARRAY_SIZE));
C_CHARArray_Seq c10 = new C_CHARArray_Seq();
c10.arr = InitArray<char>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeCharArraySeqClassByVal(c10, ARRAY_SIZE), "TakeCharArraySeqClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeCharArraySeqClassByVal(c10, ARRAY_SIZE));
C_LPSTRArray_Seq c11 = new C_LPSTRArray_Seq();
c11.arr = InitArray<string>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeLPSTRArraySeqClassByVal(c11, ARRAY_SIZE), "TakeLPSTRArraySeqClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeLPSTRArraySeqClassByVal(c11, ARRAY_SIZE));
C_LPCSTRArray_Seq c12 = new C_LPCSTRArray_Seq();
c12.arr = InitArray<string>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeLPCSTRArraySeqClassByVal(c12, ARRAY_SIZE), "TakeLPCSTRArraySeqClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeLPCSTRArraySeqClassByVal(c12, ARRAY_SIZE));
if (OperatingSystem.IsWindows())
{
C_BSTRArray_Seq c13 = new C_BSTRArray_Seq();
c13.arr = InitArray<string>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeBSTRArraySeqClassByVal(c13, ARRAY_SIZE), "TakeBSTRArraySeqClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeBSTRArraySeqClassByVal(c13, ARRAY_SIZE));
}
C_StructArray_Seq c14 = new C_StructArray_Seq();
c14.arr = InitStructArray(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeStructArraySeqClassByVal(c14, ARRAY_SIZE), "TakeStructArraySeqClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeStructArraySeqClassByVal(c14, ARRAY_SIZE));
}
static void RunTest3(string report)
S_INTArray_Exp s1 = new S_INTArray_Exp();
s1.arr = InitArray<int>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeIntArrayExpStructByVal(s1, ARRAY_SIZE), "TakeIntArrayExpStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeIntArrayExpStructByVal(s1, ARRAY_SIZE));
S_UINTArray_Exp s2 = new S_UINTArray_Exp();
s2.arr = InitArray<uint>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeUIntArrayExpStructByVal(s2, ARRAY_SIZE), "TakeUIntArrayExpStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeUIntArrayExpStructByVal(s2, ARRAY_SIZE));
S_SHORTArray_Exp s3 = new S_SHORTArray_Exp();
s3.arr = InitArray<short>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeShortArrayExpStructByVal(s3, ARRAY_SIZE), "TakeShortArrayExpStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeShortArrayExpStructByVal(s3, ARRAY_SIZE));
S_WORDArray_Exp s4 = new S_WORDArray_Exp();
s4.arr = InitArray<ushort>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeWordArrayExpStructByVal(s4, ARRAY_SIZE), "TakeWordArrayExpStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeWordArrayExpStructByVal(s4, ARRAY_SIZE));
S_LONG64Array_Exp s5 = new S_LONG64Array_Exp();
s5.arr = InitArray<long>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeLong64ArrayExpStructByVal(s5, ARRAY_SIZE), "TakeLong64ArrayExpStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeLong64ArrayExpStructByVal(s5, ARRAY_SIZE));
S_ULONG64Array_Exp s6 = new S_ULONG64Array_Exp();
s6.arr = InitArray<ulong>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeULong64ArrayExpStructByVal(s6, ARRAY_SIZE), "TakeULong64ArrayExpStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeULong64ArrayExpStructByVal(s6, ARRAY_SIZE));
S_DOUBLEArray_Exp s7 = new S_DOUBLEArray_Exp();
s7.arr = InitArray<double>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeDoubleArrayExpStructByVal(s7, ARRAY_SIZE), "TakeDoubleArrayExpStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeDoubleArrayExpStructByVal(s7, ARRAY_SIZE));
S_FLOATArray_Exp s8 = new S_FLOATArray_Exp();
s8.arr = InitArray<float>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeFloatArrayExpStructByVal(s8, ARRAY_SIZE), "TakeFloatArrayExpStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeFloatArrayExpStructByVal(s8, ARRAY_SIZE));
S_BYTEArray_Exp s9 = new S_BYTEArray_Exp();
s9.arr = InitArray<byte>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeByteArrayExpStructByVal(s9, ARRAY_SIZE), "TakeByteArrayExpStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeByteArrayExpStructByVal(s9, ARRAY_SIZE));
S_CHARArray_Exp s10 = new S_CHARArray_Exp();
s10.arr = InitArray<char>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeCharArrayExpStructByVal(s10, ARRAY_SIZE), "TakeCharArrayExpStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeCharArrayExpStructByVal(s10, ARRAY_SIZE));
S_LPSTRArray_Exp s11 = new S_LPSTRArray_Exp();
s11.arr = InitArray<string>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeLPSTRArrayExpStructByVal(s11, ARRAY_SIZE), "TakeLPSTRArrayExpStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeLPSTRArrayExpStructByVal(s11, ARRAY_SIZE));
S_LPCSTRArray_Exp s12 = new S_LPCSTRArray_Exp();
s12.arr = InitArray<string>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeLPCSTRArrayExpStructByVal(s12, ARRAY_SIZE), "TakeLPCSTRArrayExpStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeLPCSTRArrayExpStructByVal(s12, ARRAY_SIZE));
if (OperatingSystem.IsWindows())
{
S_BSTRArray_Exp s13 = new S_BSTRArray_Exp();
s13.arr = InitArray<string>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeBSTRArrayExpStructByVal(s13, ARRAY_SIZE), "TakeBSTRArrayExpStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeBSTRArrayExpStructByVal(s13, ARRAY_SIZE));
}
S_StructArray_Exp s14 = new S_StructArray_Exp();
s14.arr = InitStructArray(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeStructArrayExpStructByVal(s14, ARRAY_SIZE), "TakeStructArrayExpStructByVal");
+ Assert.Throws<TypeLoadException>(() => TakeStructArrayExpStructByVal(s14, ARRAY_SIZE));
}
static void RunTest4(string report)
C_INTArray_Exp c1 = new C_INTArray_Exp();
c1.arr = InitArray<int>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeIntArrayExpClassByVal(c1, ARRAY_SIZE), "TakeIntArrayExpClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeIntArrayExpClassByVal(c1, ARRAY_SIZE));
C_UINTArray_Exp c2 = new C_UINTArray_Exp();
c2.arr = InitArray<uint>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeUIntArrayExpClassByVal(c2, ARRAY_SIZE), "TakeUIntArrayExpClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeUIntArrayExpClassByVal(c2, ARRAY_SIZE));
C_SHORTArray_Exp c3 = new C_SHORTArray_Exp();
c3.arr = InitArray<short>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeShortArrayExpClassByVal(c3, ARRAY_SIZE), "TakeShortArrayExpClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeShortArrayExpClassByVal(c3, ARRAY_SIZE));
C_WORDArray_Exp c4 = new C_WORDArray_Exp();
c4.arr = InitArray<ushort>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeWordArrayExpClassByVal(c4, ARRAY_SIZE), "TakeWordArrayExpClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeWordArrayExpClassByVal(c4, ARRAY_SIZE));
C_LONG64Array_Exp c5 = new C_LONG64Array_Exp();
c5.arr = InitArray<long>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeLong64ArrayExpClassByVal(c5, ARRAY_SIZE), "TakeLong64ArrayExpClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeLong64ArrayExpClassByVal(c5, ARRAY_SIZE));
C_ULONG64Array_Exp c6 = new C_ULONG64Array_Exp();
c6.arr = InitArray<ulong>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeULong64ArrayExpClassByVal(c6, ARRAY_SIZE), "TakeULong64ArrayExpClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeULong64ArrayExpClassByVal(c6, ARRAY_SIZE));
C_DOUBLEArray_Exp c7 = new C_DOUBLEArray_Exp();
c7.arr = InitArray<double>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeDoubleArrayExpClassByVal(c7, ARRAY_SIZE), "TakeDoubleArrayExpClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeDoubleArrayExpClassByVal(c7, ARRAY_SIZE));
C_FLOATArray_Exp c8 = new C_FLOATArray_Exp();
c8.arr = InitArray<float>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeFloatArrayExpClassByVal(c8, ARRAY_SIZE), "TakeFloatArrayExpClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeFloatArrayExpClassByVal(c8, ARRAY_SIZE));
C_BYTEArray_Exp c9 = new C_BYTEArray_Exp();
c9.arr = InitArray<byte>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeByteArrayExpClassByVal(c9, ARRAY_SIZE), "TakeByteArrayExpClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeByteArrayExpClassByVal(c9, ARRAY_SIZE));
C_CHARArray_Exp c10 = new C_CHARArray_Exp();
c10.arr = InitArray<char>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeCharArrayExpClassByVal(c10, ARRAY_SIZE), "TakeCharArrayExpClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeCharArrayExpClassByVal(c10, ARRAY_SIZE));
C_LPSTRArray_Exp c11 = new C_LPSTRArray_Exp();
c11.arr = InitArray<string>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeLPSTRArrayExpClassByVal(c11, ARRAY_SIZE), "TakeLPSTRArrayExpClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeLPSTRArrayExpClassByVal(c11, ARRAY_SIZE));
C_LPCSTRArray_Exp c12 = new C_LPCSTRArray_Exp();
c12.arr = InitArray<string>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeLPCSTRArrayExpClassByVal(c12, ARRAY_SIZE), "TakeLPCSTRArrayExpClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeLPCSTRArrayExpClassByVal(c12, ARRAY_SIZE));
if (OperatingSystem.IsWindows())
{
C_BSTRArray_Exp c13 = new C_BSTRArray_Exp();
c13.arr = InitArray<string>(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeBSTRArrayExpClassByVal(c13, ARRAY_SIZE), "TakeBSTRArrayExpClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeBSTRArrayExpClassByVal(c13, ARRAY_SIZE));
}
C_StructArray_Exp c14 = new C_StructArray_Exp();
c14.arr = InitStructArray(ARRAY_SIZE);
- Assert.Throws<TypeLoadException>(() => TakeStructArrayExpClassByVal(c14, ARRAY_SIZE), "TakeStructArrayExpClassByVal");
+ Assert.Throws<TypeLoadException>(() => TakeStructArrayExpClassByVal(c14, ARRAY_SIZE));
}
static int Main(string[] args)
RunTest2("RunTest 2 : Marshal Array In Sequential Class As LPArray. ");
if (OperatingSystem.IsWindows())
{
- RunTest3("RunTest 3 : Marshal Array In Explicit Struct As LPArray. ");
+ RunTest3("RunTest 3 : Marshal Array In Explicit Struct As LPArray. ");
}
RunTest4("RunTest 4 : Marshal Array In Explicit Class As LPArray. ");
Console.WriteLine("\nTest PASS.");
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public class ArrayMarshal
{
{
Console.WriteLine("ByVal marshaling CLR array as c-style-array no attributes");
- Assert.IsTrue(CStyle_Array_Int(InitArray<int>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Int");
- Assert.IsTrue(CStyle_Array_Uint(InitArray<uint>(ARRAY_SIZE), ARRAY_SIZE),"CStyle_Array_Uint") ;
- Assert.IsTrue(CStyle_Array_Short(InitArray<short>(ARRAY_SIZE), ARRAY_SIZE),"CStyle_Array_Short");
- Assert.IsTrue(CStyle_Array_Word(InitArray<ushort>(ARRAY_SIZE), ARRAY_SIZE),"CStyle_Array_Word");
- Assert.IsTrue(CStyle_Array_Long64(InitArray<long>(ARRAY_SIZE), ARRAY_SIZE),"CStyle_Array_Long64");
- Assert.IsTrue(CStyle_Array_ULong64(InitArray<ulong>(ARRAY_SIZE), ARRAY_SIZE),"CStyle_Array_ULong64");
- Assert.IsTrue(CStyle_Array_Double(InitArray<double>(ARRAY_SIZE), ARRAY_SIZE),"CStyle_Array_Double");
- Assert.IsTrue(CStyle_Array_Float(InitArray<float>(ARRAY_SIZE), ARRAY_SIZE),"CStyle_Array_Float");
- Assert.IsTrue(CStyle_Array_Byte(InitArray<byte>(ARRAY_SIZE), ARRAY_SIZE),"CStyle_Array_Byte");
- Assert.IsTrue(CStyle_Array_Char(InitArray<char>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Char");
+ Assert.True(CStyle_Array_Int(InitArray<int>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Uint(InitArray<uint>(ARRAY_SIZE), ARRAY_SIZE),"CStyle_Array_Uint") ;
+ Assert.True(CStyle_Array_Short(InitArray<short>(ARRAY_SIZE), ARRAY_SIZE),"CStyle_Array_Short");
+ Assert.True(CStyle_Array_Word(InitArray<ushort>(ARRAY_SIZE), ARRAY_SIZE),"CStyle_Array_Word");
+ Assert.True(CStyle_Array_Long64(InitArray<long>(ARRAY_SIZE), ARRAY_SIZE),"CStyle_Array_Long64");
+ Assert.True(CStyle_Array_ULong64(InitArray<ulong>(ARRAY_SIZE), ARRAY_SIZE),"CStyle_Array_ULong64");
+ Assert.True(CStyle_Array_Double(InitArray<double>(ARRAY_SIZE), ARRAY_SIZE),"CStyle_Array_Double");
+ Assert.True(CStyle_Array_Float(InitArray<float>(ARRAY_SIZE), ARRAY_SIZE),"CStyle_Array_Float");
+ Assert.True(CStyle_Array_Byte(InitArray<byte>(ARRAY_SIZE), ARRAY_SIZE),"CStyle_Array_Byte");
+ Assert.True(CStyle_Array_Char(InitArray<char>(ARRAY_SIZE), ARRAY_SIZE));
string[] strArr = InitArray<string>(ARRAY_SIZE);
// Test nesting null value scenario
strArr[strArr.Length / 2] = null;
- Assert.IsTrue(CStyle_Array_LPCSTR(strArr, ARRAY_SIZE), "CStyle_Array_LPCSTR");
- Assert.IsTrue(CStyle_Array_LPSTR(strArr, ARRAY_SIZE), "CStyle_Array_LPSTR");
- Assert.IsTrue(CStyle_Array_Struct(InitStructArray(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Struct");
+ Assert.True(CStyle_Array_LPCSTR(strArr, ARRAY_SIZE));
+ Assert.True(CStyle_Array_LPSTR(strArr, ARRAY_SIZE));
+ Assert.True(CStyle_Array_Struct(InitStructArray(ARRAY_SIZE), ARRAY_SIZE));
- Assert.IsTrue(CStyle_Array_Bool(InitBoolArray(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Bool");
+ Assert.True(CStyle_Array_Bool(InitBoolArray(ARRAY_SIZE), ARRAY_SIZE));
if (OperatingSystem.IsWindows())
{
object[] oArr = InitArray<object>(ARRAY_SIZE);
// Test nesting null value scenario
oArr[oArr.Length / 2] = null;
- Assert.IsTrue(CStyle_Array_Object(oArr, ARRAY_SIZE), "CStyle_Array_Object");
+ Assert.True(CStyle_Array_Object(oArr, ARRAY_SIZE));
}
}
{
Console.WriteLine("ByVal marshaling CLR array as c-style-array with InAttribute applied");
- Assert.IsTrue(CStyle_Array_Int_In(InitArray<int>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Int_In");
- Assert.IsTrue(CStyle_Array_Uint_In(InitArray<uint>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Uint_In");
- Assert.IsTrue(CStyle_Array_Short_In(InitArray<short>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Short_In");
- Assert.IsTrue(CStyle_Array_Word_In(InitArray<ushort>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Word_In");
- Assert.IsTrue(CStyle_Array_Long64_In(InitArray<long>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Long64_In");
- Assert.IsTrue(CStyle_Array_ULong64_In(InitArray<ulong>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_ULong64_In");
- Assert.IsTrue(CStyle_Array_Double_In(InitArray<double>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Double_In");
- Assert.IsTrue(CStyle_Array_Float_In(InitArray<float>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Float_In");
- Assert.IsTrue(CStyle_Array_Byte_In(InitArray<byte>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Byte_In");
- Assert.IsTrue(CStyle_Array_Char_In(InitArray<char>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Char_In");
+ Assert.True(CStyle_Array_Int_In(InitArray<int>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Uint_In(InitArray<uint>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Short_In(InitArray<short>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Word_In(InitArray<ushort>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Long64_In(InitArray<long>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_ULong64_In(InitArray<ulong>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Double_In(InitArray<double>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Float_In(InitArray<float>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Byte_In(InitArray<byte>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Char_In(InitArray<char>(ARRAY_SIZE), ARRAY_SIZE));
string[] strArr = InitArray<string>(ARRAY_SIZE);
// Test nesting null value scenario
strArr[strArr.Length / 2] = null;
- Assert.IsTrue(CStyle_Array_LPCSTR_In(strArr, ARRAY_SIZE), "CStyle_Array_LPCSTR_In");
- Assert.IsTrue(CStyle_Array_LPSTR_In(strArr, ARRAY_SIZE), "CStyle_Array_LPSTR_In");
- Assert.IsTrue(CStyle_Array_Struct_In(InitStructArray(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Struct_In");
- Assert.IsTrue(CStyle_Array_Bool_In(InitBoolArray(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Bool_In");
+ Assert.True(CStyle_Array_LPCSTR_In(strArr, ARRAY_SIZE));
+ Assert.True(CStyle_Array_LPSTR_In(strArr, ARRAY_SIZE));
+ Assert.True(CStyle_Array_Struct_In(InitStructArray(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Bool_In(InitBoolArray(ARRAY_SIZE), ARRAY_SIZE));
if (OperatingSystem.IsWindows())
{
object[] oArr = InitArray<object>(ARRAY_SIZE);
// Test nesting null value scenario
oArr[oArr.Length / 2] = null;
- Assert.IsTrue(CStyle_Array_Object_In(oArr, ARRAY_SIZE), "CStyle_Array_Object_In");
+ Assert.True(CStyle_Array_Object_In(oArr, ARRAY_SIZE));
}
}
Console.WriteLine("By value marshaling CLR array as c-style-array with InAttribute and OutAttribute applied");
Console.WriteLine("CStyle_Array_Int_InOut");
int[] iArr = InitArray<int>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Int_InOut(iArr, ARRAY_SIZE), "CStyle_Array_Int_InOut");
- Assert.IsTrue(Equals<int>(iArr, GetExpectedOutArray<int>(ARRAY_SIZE)), "CStyle_Array_Int_InOut:Equals<int>");
+ Assert.True(CStyle_Array_Int_InOut(iArr, ARRAY_SIZE));
+ Assert.True(Equals<int>(iArr, GetExpectedOutArray<int>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Int_InOut_Null");
int[] iArrNull = null;
- Assert.IsTrue(CStyle_Array_Int_InOut_Null(iArrNull), "CStyle_Array_Int_InOut_Null");
- Assert.IsNull(iArrNull, "CStyle_Array_Int_InOut_Null:Equals<null>");
+ Assert.True(CStyle_Array_Int_InOut_Null(iArrNull));
+ Assert.Null(iArrNull);
Console.WriteLine("CStyle_Array_Int_InOut_ZeroLength");
int[] iArrLength0 = InitArray<int>(0);
- Assert.IsTrue(CStyle_Array_Int_InOut_ZeroLength(iArrLength0), "CStyle_Array_Int_InOut_ZeroLength");
- Assert.AreEqual(0, iArrLength0.Length, "CStyle_Array_Int_InOut_ZeroLength:Length<!0>");
+ Assert.True(CStyle_Array_Int_InOut_ZeroLength(iArrLength0));
+ Assert.Equal(0, iArrLength0.Length);
Console.WriteLine("CStyle_Array_Uint_InOut");
uint[] uiArr = InitArray<uint>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Uint_InOut(uiArr, ARRAY_SIZE), "CStyle_Array_Uint_InOut");
- Assert.IsTrue(Equals<uint>(uiArr, GetExpectedOutArray<uint>(ARRAY_SIZE)), "CStyle_Array_Uint_InOut:Equals<uint>");
+ Assert.True(CStyle_Array_Uint_InOut(uiArr, ARRAY_SIZE));
+ Assert.True(Equals<uint>(uiArr, GetExpectedOutArray<uint>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Short_InOut");
short[] sArr = InitArray<short>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Short_InOut(sArr, ARRAY_SIZE), "CStyle_Array_Short_InOut");
- Assert.IsTrue(Equals<short>(sArr, GetExpectedOutArray<short>(ARRAY_SIZE)), "CStyle_Array_Short_InOut:Equals<short>");
+ Assert.True(CStyle_Array_Short_InOut(sArr, ARRAY_SIZE));
+ Assert.True(Equals<short>(sArr, GetExpectedOutArray<short>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Word_InOut");
ushort[] usArr = InitArray<ushort>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Word_InOut(usArr, ARRAY_SIZE), "CStyle_Array_Word_InOut");
- Assert.IsTrue(Equals<ushort>(usArr, GetExpectedOutArray<ushort>(ARRAY_SIZE)), "CStyle_Array_Word_InOut:Equals<ushort>");
+ Assert.True(CStyle_Array_Word_InOut(usArr, ARRAY_SIZE));
+ Assert.True(Equals<ushort>(usArr, GetExpectedOutArray<ushort>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Long64_InOut");
long[] lArr = InitArray<long>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Long64_InOut(lArr, ARRAY_SIZE), "CStyle_Array_Long64_InOut");
- Assert.IsTrue(Equals<long>(lArr, GetExpectedOutArray<long>(ARRAY_SIZE)), "CStyle_Array_Long64_InOut:Equals<long>");
+ Assert.True(CStyle_Array_Long64_InOut(lArr, ARRAY_SIZE));
+ Assert.True(Equals<long>(lArr, GetExpectedOutArray<long>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_ULong64_InOut");
ulong[] ulArr = InitArray<ulong>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_ULong64_InOut(ulArr, ARRAY_SIZE), "CStyle_Array_ULong64_InOut");
- Assert.IsTrue(Equals<ulong>(ulArr, GetExpectedOutArray<ulong>(ARRAY_SIZE)), "CStyle_Array_ULong64_InOut:Equals<ulong>");
+ Assert.True(CStyle_Array_ULong64_InOut(ulArr, ARRAY_SIZE));
+ Assert.True(Equals<ulong>(ulArr, GetExpectedOutArray<ulong>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Double_InOut");
double[] dArr = InitArray<double>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Double_InOut(dArr, ARRAY_SIZE), "CStyle_Array_Double_InOut");
- Assert.IsTrue(Equals<double>(dArr, GetExpectedOutArray<double>(ARRAY_SIZE)), "CStyle_Array_Double_InOut:Equals<double>");
+ Assert.True(CStyle_Array_Double_InOut(dArr, ARRAY_SIZE));
+ Assert.True(Equals<double>(dArr, GetExpectedOutArray<double>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Float_InOut");
float[] fArr = InitArray<float>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Float_InOut(fArr, ARRAY_SIZE), "CStyle_Array_Float_InOut");
- Assert.IsTrue(Equals<float>(fArr, GetExpectedOutArray<float>(ARRAY_SIZE)), "CStyle_Array_Float_InOut:Equals<float>");
+ Assert.True(CStyle_Array_Float_InOut(fArr, ARRAY_SIZE));
+ Assert.True(Equals<float>(fArr, GetExpectedOutArray<float>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Byte_InOut");
byte[] bArr = InitArray<byte>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Byte_InOut(bArr, ARRAY_SIZE), "CStyle_Array_Byte_InOut");
- Assert.IsTrue(Equals<byte>(bArr, GetExpectedOutArray<byte>(ARRAY_SIZE)), "CStyle_Array_Byte_InOut:Equals<byte>");
+ Assert.True(CStyle_Array_Byte_InOut(bArr, ARRAY_SIZE));
+ Assert.True(Equals<byte>(bArr, GetExpectedOutArray<byte>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Char_InOut");
char[] cArr = InitArray<char>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Char_InOut(cArr, ARRAY_SIZE), "CStyle_Array_Char_InOut");
- Assert.IsTrue(Equals<char>(cArr, GetExpectedOutArray<char>(ARRAY_SIZE)), "CStyle_Array_Char_InOut:Equals<char>");
+ Assert.True(CStyle_Array_Char_InOut(cArr, ARRAY_SIZE));
+ Assert.True(Equals<char>(cArr, GetExpectedOutArray<char>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_LPSTR_InOut");
string[] strArr = InitArray<string>(ARRAY_SIZE);
strArr[strArr.Length / 2] = null;
- Assert.IsTrue(CStyle_Array_LPSTR_InOut(strArr, ARRAY_SIZE), "CStyle_Array_LPSTR_InOut");
+ Assert.True(CStyle_Array_LPSTR_InOut(strArr, ARRAY_SIZE));
string[] expectedArr = GetExpectedOutArray<string>(ARRAY_SIZE);
// Test nesting null value scenario
expectedArr[expectedArr.Length / 2 - 1] = null;
- Assert.IsTrue(Equals<string>(strArr, expectedArr), "CStyle_Array_LPSTR_InOut:Equals<string>");
+ Assert.True(Equals<string>(strArr, expectedArr));
Console.WriteLine("CStyle_Array_Struct_InOut");
TestStruct[] tsArr = InitStructArray(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Struct_InOut(tsArr, ARRAY_SIZE), "CStyle_Array_Struct_InOut");
- Assert.IsTrue(Equals<TestStruct>(tsArr, GetExpectedOutStructArray(ARRAY_SIZE)), "CStyle_Array_Struct_InOut:Equals<TestStruct>");
+ Assert.True(CStyle_Array_Struct_InOut(tsArr, ARRAY_SIZE));
+ Assert.True(Equals<TestStruct>(tsArr, GetExpectedOutStructArray(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Bool_InOut");
bool[] boolArr = InitBoolArray(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Bool_InOut(boolArr, ARRAY_SIZE), "CStyle_Array_Bool_InOut");
- Assert.IsTrue(Equals<bool>(boolArr, GetExpectedOutBoolArray(ARRAY_SIZE)), "CStyle_Array_Bool_InOut:Equals<bool>");
+ Assert.True(CStyle_Array_Bool_InOut(boolArr, ARRAY_SIZE));
+ Assert.True(Equals<bool>(boolArr, GetExpectedOutBoolArray(ARRAY_SIZE)));
if (OperatingSystem.IsWindows())
{
Console.WriteLine("CStyle_Array_Object_InOut");
object[] oArr = InitArray<object>(ARRAY_SIZE);
oArr[oArr.Length / 2] = null;
- Assert.IsTrue(CStyle_Array_Object_InOut(oArr, ARRAY_SIZE), "CStyle_Array_Object_InOut");
+ Assert.True(CStyle_Array_Object_InOut(oArr, ARRAY_SIZE));
object[] expectedOArr = GetExpectedOutArray<object>(ARRAY_SIZE);
// Test nesting null value scenario
expectedOArr[expectedOArr.Length / 2 - 1] = null;
- Assert.IsTrue(Equals<object>(oArr, expectedOArr), "CStyle_Array_Object_InOut:Equals<object>");
+ Assert.True(Equals<object>(oArr, expectedOArr));
}
}
Console.WriteLine("CStyle_Array_Int_Out");
int[] iArr = new int[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Int_Out(iArr, ARRAY_SIZE), "CStyle_Array_Int_Out");
- Assert.IsTrue(Equals<int>(iArr, GetExpectedOutArray<int>(ARRAY_SIZE)), "CStyle_Array_Int_Out:Equals<int>");
+ Assert.True(CStyle_Array_Int_Out(iArr, ARRAY_SIZE));
+ Assert.True(Equals<int>(iArr, GetExpectedOutArray<int>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Int_Out_Null");
int[] iArrNull = null;
- Assert.IsTrue(CStyle_Array_Int_Out_Null(iArrNull), "CStyle_Array_Int_Out_Null");
- Assert.IsNull(iArrNull, "CStyle_Array_Int_Out_Null:Equals<null>");
+ Assert.True(CStyle_Array_Int_Out_Null(iArrNull));
+ Assert.Null(iArrNull);
Console.WriteLine("CStyle_Array_Int_Out_ZeroLength");
int[] iArrLength0 = new int[0];
- Assert.IsTrue(CStyle_Array_Int_Out_ZeroLength(iArrLength0), "CStyle_Array_Int_Out_ZeroLength");
- Assert.AreEqual(0, iArrLength0.Length, "CStyle_Array_Int_Out_ZeroLength:Length<!0>");
+ Assert.True(CStyle_Array_Int_Out_ZeroLength(iArrLength0));
+ Assert.Equal(0, iArrLength0.Length);
Console.WriteLine("CStyle_Array_Uint_Out");
uint[] uiArr = new uint[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Uint_Out(uiArr, ARRAY_SIZE), "CStyle_Array_Uint_Out");
- Assert.IsTrue(Equals<uint>(uiArr, GetExpectedOutArray<uint>(ARRAY_SIZE)), "CStyle_Array_Uint_Out:Equals<uint>");
+ Assert.True(CStyle_Array_Uint_Out(uiArr, ARRAY_SIZE));
+ Assert.True(Equals<uint>(uiArr, GetExpectedOutArray<uint>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Short_Out");
short[] sArr = new short[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Short_Out(sArr, ARRAY_SIZE), "CStyle_Array_Short_Out");
- Assert.IsTrue(Equals<short>(sArr, GetExpectedOutArray<short>(ARRAY_SIZE)), "CStyle_Array_Short_Out:Equals<short>");
+ Assert.True(CStyle_Array_Short_Out(sArr, ARRAY_SIZE));
+ Assert.True(Equals<short>(sArr, GetExpectedOutArray<short>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Word_Out");
ushort[] usArr = new ushort[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Word_Out(usArr, ARRAY_SIZE), "CStyle_Array_Word_Out");
- Assert.IsTrue(Equals<ushort>(usArr, GetExpectedOutArray<ushort>(ARRAY_SIZE)), "CStyle_Array_Word_Out:Equals<ushort>");
+ Assert.True(CStyle_Array_Word_Out(usArr, ARRAY_SIZE));
+ Assert.True(Equals<ushort>(usArr, GetExpectedOutArray<ushort>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Long64_Out");
long[] lArr = new long[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Long64_Out(lArr, ARRAY_SIZE), "CStyle_Array_Long64_Out");
- Assert.IsTrue(Equals<long>(lArr, GetExpectedOutArray<long>(ARRAY_SIZE)), "CStyle_Array_Long64_Out:Equals<long>");
+ Assert.True(CStyle_Array_Long64_Out(lArr, ARRAY_SIZE));
+ Assert.True(Equals<long>(lArr, GetExpectedOutArray<long>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_ULong64_Out");
ulong[] ulArr = new ulong[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_ULong64_Out(ulArr, ARRAY_SIZE), "CStyle_Array_ULong64_Out");
- Assert.IsTrue(Equals<ulong>(ulArr, GetExpectedOutArray<ulong>(ARRAY_SIZE)), "CStyle_Array_ULong64_Out:Equals<ulong>");
+ Assert.True(CStyle_Array_ULong64_Out(ulArr, ARRAY_SIZE));
+ Assert.True(Equals<ulong>(ulArr, GetExpectedOutArray<ulong>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Double_Out");
double[] dArr = new double[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Double_Out(dArr, ARRAY_SIZE), "CStyle_Array_Double_Out");
- Assert.IsTrue(Equals<double>(dArr, GetExpectedOutArray<double>(ARRAY_SIZE)), "CStyle_Array_Double_Out:Equals<double>");
+ Assert.True(CStyle_Array_Double_Out(dArr, ARRAY_SIZE));
+ Assert.True(Equals<double>(dArr, GetExpectedOutArray<double>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Float_Out");
float[] fArr = new float[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Float_Out(fArr, ARRAY_SIZE), "CStyle_Array_Float_Out");
- Assert.IsTrue(Equals<float>(fArr, GetExpectedOutArray<float>(ARRAY_SIZE)), "CStyle_Array_Float_Out:Equals<float>");
+ Assert.True(CStyle_Array_Float_Out(fArr, ARRAY_SIZE));
+ Assert.True(Equals<float>(fArr, GetExpectedOutArray<float>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Byte_Out");
byte[] bArr = new byte[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Byte_Out(bArr, ARRAY_SIZE), "CStyle_Array_Byte_Out");
- Assert.IsTrue(Equals<byte>(bArr, GetExpectedOutArray<byte>(ARRAY_SIZE)), "CStyle_Array_Byte_Out:Equals<byte>");
+ Assert.True(CStyle_Array_Byte_Out(bArr, ARRAY_SIZE));
+ Assert.True(Equals<byte>(bArr, GetExpectedOutArray<byte>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Char_Out");
char[] cArr = new char[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Char_Out(cArr, ARRAY_SIZE), "CStyle_Array_Char_Out");
- Assert.IsTrue(Equals<char>(cArr, GetExpectedOutArray<char>(ARRAY_SIZE)), "CStyle_Array_Char_Out:Equals<char>");
+ Assert.True(CStyle_Array_Char_Out(cArr, ARRAY_SIZE));
+ Assert.True(Equals<char>(cArr, GetExpectedOutArray<char>(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_LPSTR_Out");
string[] strArr = new string[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_LPSTR_Out(strArr, ARRAY_SIZE), "CStyle_Array_LPSTR_Out");
+ Assert.True(CStyle_Array_LPSTR_Out(strArr, ARRAY_SIZE));
string[] expectedArr = GetExpectedOutArray<string>(ARRAY_SIZE);
// Test nesting null value scenario
expectedArr[expectedArr.Length / 2 - 1] = null;
- Assert.IsTrue(Equals<string>(strArr, expectedArr), "CStyle_Array_LPSTR_Out:Equals<string>");
+ Assert.True(Equals<string>(strArr, expectedArr));
Console.WriteLine("CStyle_Array_Struct_Out");
TestStruct[] tsArr = new TestStruct[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Struct_Out(tsArr, ARRAY_SIZE), "CStyle_Array_Struct_Out");
- Assert.IsTrue(Equals<TestStruct>(tsArr, GetExpectedOutStructArray(ARRAY_SIZE)), "Equals<TestStruct>");
+ Assert.True(CStyle_Array_Struct_Out(tsArr, ARRAY_SIZE));
+ Assert.True(Equals<TestStruct>(tsArr, GetExpectedOutStructArray(ARRAY_SIZE)));
Console.WriteLine("CStyle_Array_Bool_Out");
bool[] boolArr = new bool[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Bool_Out(boolArr, ARRAY_SIZE), "CStyle_Array_Bool_Out");
- Assert.IsTrue(Equals<bool>(boolArr, GetExpectedOutBoolArray(ARRAY_SIZE)), "CStyle_Array_Bool_Out:Equals<bool>");
+ Assert.True(CStyle_Array_Bool_Out(boolArr, ARRAY_SIZE));
+ Assert.True(Equals<bool>(boolArr, GetExpectedOutBoolArray(ARRAY_SIZE)));
if (OperatingSystem.IsWindows())
{
Console.WriteLine("CStyle_Array_Object_Out");
object[] oArr = new object[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Object_Out(oArr, ARRAY_SIZE), "CStyle_Array_Object_Out");
+ Assert.True(CStyle_Array_Object_Out(oArr, ARRAY_SIZE));
object[] expectedOArr = GetExpectedOutArray<object>(ARRAY_SIZE);
// Test nesting null value scenario
expectedOArr[expectedOArr.Length / 2 - 1] = null;
- Assert.IsTrue(Equals<object>(oArr, expectedOArr), "CStyle_Array_Object_Out:Equals<object>");
+ Assert.True(Equals<object>(oArr, expectedOArr));
}
}
sum += item;
}
- Assert.AreEqual(sum, Get_Multidimensional_Array_Sum(array, ROWS, COLUMNS));
+ Assert.Equal(sum, Get_Multidimensional_Array_Sum(array, ROWS, COLUMNS));
}
public static int Main()
TestMarshalInOut_ByVal();
TestMarshalOut_ByVal();
TestMultidimensional();
-
+
Console.WriteLine("\nTest PASS.");
return 100;
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public class ArrayMarshal
{
[DllImport("MarshalArrayLPArrayNative")]
private static extern bool CStyle_Array_Bool([MarshalAs(UnmanagedType.LPArray)] bool[] actual, int cActual);
-
+
[DllImport("MarshalArrayLPArrayNative")]
private static extern bool MarshalArrayOfStructAsLPArrayByVal([MarshalAs(UnmanagedType.LPArray, SizeConst = ARRAY_SIZE)] S2[] arrS2, int cActual, [In, MarshalAs(UnmanagedType.LPArray, SizeConst = ARRAY_SIZE)]S2[] pExpect);
[DllImport("MarshalArrayLPArrayNative", EntryPoint = "CStyle_Array_Bool")]
private static extern bool CStyle_Array_Bool_In([In, MarshalAs(UnmanagedType.LPArray)] bool[] actual, int cActual);
-
+
[DllImport("MarshalArrayLPArrayNative", EntryPoint = "MarshalArrayOfStructAsLPArrayByVal")]
private static extern bool MarshalArrayOfStructAsLPArrayByValIn([In, MarshalAs(UnmanagedType.LPArray, SizeConst = ARRAY_SIZE)] S2[] arrS2, int cActual, [In, MarshalAs(UnmanagedType.LPArray, SizeConst = ARRAY_SIZE)]S2[] pExpect);
[DllImport("MarshalArrayLPArrayNative")]
private static extern bool CStyle_Array_Int_Out_Null([Out, MarshalAs(UnmanagedType.LPArray)] int[] actual);
-
+
[DllImport("MarshalArrayLPArrayNative")]
private static extern bool CStyle_Array_Int_Out_ZeroLength([Out, MarshalAs(UnmanagedType.LPArray)] int[] actual);
{
Console.WriteLine("ByVal marshaling CLR array as c-style-array no attributes");
- Assert.IsTrue(CStyle_Array_Int(InitArray<int>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Int");
- Assert.IsTrue(CStyle_Array_Uint(InitArray<uint>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Uint");
- Assert.IsTrue(CStyle_Array_Short(InitArray<short>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Short");
- Assert.IsTrue(CStyle_Array_Word(InitArray<ushort>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Word");
- Assert.IsTrue(CStyle_Array_Long64(InitArray<long>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Long64");
- Assert.IsTrue(CStyle_Array_ULong64(InitArray<ulong>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_ULong64");
- Assert.IsTrue(CStyle_Array_Double(InitArray<double>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Double");
- Assert.IsTrue(CStyle_Array_Float(InitArray<float>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Float");
- Assert.IsTrue(CStyle_Array_Byte(InitArray<byte>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Byte");
- Assert.IsTrue(CStyle_Array_Char(InitArray<char>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Char");
+ Assert.True(CStyle_Array_Int(InitArray<int>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Uint(InitArray<uint>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Short(InitArray<short>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Word(InitArray<ushort>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Long64(InitArray<long>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_ULong64(InitArray<ulong>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Double(InitArray<double>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Float(InitArray<float>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Byte(InitArray<byte>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Char(InitArray<char>(ARRAY_SIZE), ARRAY_SIZE));
string[] strArr = InitArray<string>(ARRAY_SIZE);
// Test nesting null value scenario
strArr[strArr.Length / 2] = null;
- Assert.IsTrue(CStyle_Array_LPCSTR(strArr, ARRAY_SIZE), "CStyle_Array_LPCSTR");
- Assert.IsTrue(CStyle_Array_LPSTR(strArr, ARRAY_SIZE), "CStyle_Array_LPSTRs");
- Assert.IsTrue(CStyle_Array_Struct(InitStructArray(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Struct");
- Assert.IsTrue(CStyle_Array_Bool(InitBoolArray(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Bool");
+ Assert.True(CStyle_Array_LPCSTR(strArr, ARRAY_SIZE));
+ Assert.True(CStyle_Array_LPSTR(strArr, ARRAY_SIZE));
+ Assert.True(CStyle_Array_Struct(InitStructArray(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Bool(InitBoolArray(ARRAY_SIZE), ARRAY_SIZE));
if (OperatingSystem.IsWindows())
{
object[] oArr = InitArray<object>(ARRAY_SIZE);
// Test nesting null value scenario
oArr[oArr.Length / 2] = null;
- Assert.IsTrue(CStyle_Array_Object(oArr, ARRAY_SIZE), "CStyle_Array_Object");
- }
-
+ Assert.True(CStyle_Array_Object(oArr, ARRAY_SIZE));
+ }
+
}
private static void TestMarshalByVal_In()
{
Console.WriteLine("ByVal marshaling CLR array as c-style-array with InAttribute applied");
- Assert.IsTrue(CStyle_Array_Int_In(InitArray<int>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Int_In");
- Assert.IsTrue(CStyle_Array_Uint_In(InitArray<uint>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Uint_In");
- Assert.IsTrue(CStyle_Array_Short_In(InitArray<short>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Short_In");
- Assert.IsTrue(CStyle_Array_Word_In(InitArray<ushort>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Word_In");
- Assert.IsTrue(CStyle_Array_Long64_In(InitArray<long>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Long64_In");
- Assert.IsTrue(CStyle_Array_ULong64_In(InitArray<ulong>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_ULong64_In");
- Assert.IsTrue(CStyle_Array_Double_In(InitArray<double>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Double_In");
- Assert.IsTrue(CStyle_Array_Float_In(InitArray<float>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Float_In");
- Assert.IsTrue(CStyle_Array_Byte_In(InitArray<byte>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Byte_In");
- Assert.IsTrue(CStyle_Array_Char_In(InitArray<char>(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Char_In");
+ Assert.True(CStyle_Array_Int_In(InitArray<int>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Uint_In(InitArray<uint>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Short_In(InitArray<short>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Word_In(InitArray<ushort>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Long64_In(InitArray<long>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_ULong64_In(InitArray<ulong>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Double_In(InitArray<double>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Float_In(InitArray<float>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Byte_In(InitArray<byte>(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Char_In(InitArray<char>(ARRAY_SIZE), ARRAY_SIZE));
string[] strArr = InitArray<string>(ARRAY_SIZE);
// Test nesting null value scenario
strArr[strArr.Length / 2] = null;
- Assert.IsTrue(CStyle_Array_LPCSTR_In(strArr, ARRAY_SIZE), "CStyle_Array_LPCSTR_In");
- Assert.IsTrue(CStyle_Array_LPSTR_In(strArr, ARRAY_SIZE), "CStyle_Array_LPSTR_In");
- Assert.IsTrue(CStyle_Array_Struct_In(InitStructArray(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Struct_In");
- Assert.IsTrue(CStyle_Array_Bool_In(InitBoolArray(ARRAY_SIZE), ARRAY_SIZE), "CStyle_Array_Bool_In");
+ Assert.True(CStyle_Array_LPCSTR_In(strArr, ARRAY_SIZE));
+ Assert.True(CStyle_Array_LPSTR_In(strArr, ARRAY_SIZE));
+ Assert.True(CStyle_Array_Struct_In(InitStructArray(ARRAY_SIZE), ARRAY_SIZE));
+ Assert.True(CStyle_Array_Bool_In(InitBoolArray(ARRAY_SIZE), ARRAY_SIZE));
if (OperatingSystem.IsWindows())
{
object[] oArr = InitArray<object>(ARRAY_SIZE);
// Test nesting null value scenario
oArr[oArr.Length / 2] = null;
- Assert.IsTrue(CStyle_Array_Object_In(oArr, ARRAY_SIZE), "CStyle_Array_Object_In");
+ Assert.True(CStyle_Array_Object_In(oArr, ARRAY_SIZE));
}
}
#endregion
{
Console.WriteLine("By value marshaling CLR array as c-style-array with InAttribute and OutAttribute applied");
int[] iArr = InitArray<int>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Int_InOut(iArr, ARRAY_SIZE), "CStyle_Array_Int_InOut");
- Assert.IsTrue(Equals<int>(iArr, GetExpectedOutArray<int>(ARRAY_SIZE)), "CStyle_Array_Int_InOut:Equals<int>");
+ Assert.True(CStyle_Array_Int_InOut(iArr, ARRAY_SIZE));
+ Assert.True(Equals<int>(iArr, GetExpectedOutArray<int>(ARRAY_SIZE)));
int[] iArrNull = null;
- Assert.IsTrue(CStyle_Array_Int_InOut_Null(iArrNull), "CStyle_Array_Int_InOut_Null");
- Assert.IsNull(iArrNull, "CStyle_Array_Int_InOut_Null:Equals<null>");
+ Assert.True(CStyle_Array_Int_InOut_Null(iArrNull));
+ Assert.Null(iArrNull);
int[] iArrLength0 = InitArray<int>(0);
- Assert.IsTrue(CStyle_Array_Int_InOut_ZeroLength(iArrLength0), "CStyle_Array_Int_InOut_ZeroLength");
- Assert.AreEqual(0, iArrLength0.Length, "CStyle_Array_Int_InOut_ZeroLength:Length<!0>");
+ Assert.True(CStyle_Array_Int_InOut_ZeroLength(iArrLength0));
+ Assert.Equal(0, iArrLength0.Length);
uint[] uiArr = InitArray<uint>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Uint_InOut(uiArr, ARRAY_SIZE), "CStyle_Array_Uint_InOut");
- Assert.IsTrue(Equals<uint>(uiArr, GetExpectedOutArray<uint>(ARRAY_SIZE)), "CStyle_Array_Uint_InOut:Equals<uint>");
+ Assert.True(CStyle_Array_Uint_InOut(uiArr, ARRAY_SIZE));
+ Assert.True(Equals<uint>(uiArr, GetExpectedOutArray<uint>(ARRAY_SIZE)));
short[] sArr = InitArray<short>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Short_InOut(sArr, ARRAY_SIZE), "CStyle_Array_Short_InOut");
- Assert.IsTrue(Equals<short>(sArr, GetExpectedOutArray<short>(ARRAY_SIZE)), "CStyle_Array_Short_InOut:Equals<short>");
+ Assert.True(CStyle_Array_Short_InOut(sArr, ARRAY_SIZE));
+ Assert.True(Equals<short>(sArr, GetExpectedOutArray<short>(ARRAY_SIZE)));
ushort[] usArr = InitArray<ushort>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Word_InOut(usArr, ARRAY_SIZE), "CStyle_Array_Word_InOut");
- Assert.IsTrue(Equals<ushort>(usArr, GetExpectedOutArray<ushort>(ARRAY_SIZE)), "CStyle_Array_Word_InOut:Equals<ushort>");
+ Assert.True(CStyle_Array_Word_InOut(usArr, ARRAY_SIZE));
+ Assert.True(Equals<ushort>(usArr, GetExpectedOutArray<ushort>(ARRAY_SIZE)));
long[] lArr = InitArray<long>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Long64_InOut(lArr, ARRAY_SIZE), "CStyle_Array_Long64_InOut");
- Assert.IsTrue(Equals<long>(lArr, GetExpectedOutArray<long>(ARRAY_SIZE)), "CStyle_Array_Long64_InOut:Equals<long>");
+ Assert.True(CStyle_Array_Long64_InOut(lArr, ARRAY_SIZE));
+ Assert.True(Equals<long>(lArr, GetExpectedOutArray<long>(ARRAY_SIZE)));
ulong[] ulArr = InitArray<ulong>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_ULong64_InOut(ulArr, ARRAY_SIZE), "CStyle_Array_ULong64_InOut");
- Assert.IsTrue(Equals<ulong>(ulArr, GetExpectedOutArray<ulong>(ARRAY_SIZE)), "CStyle_Array_ULong64_InOut:Equals<ulong>");
+ Assert.True(CStyle_Array_ULong64_InOut(ulArr, ARRAY_SIZE));
+ Assert.True(Equals<ulong>(ulArr, GetExpectedOutArray<ulong>(ARRAY_SIZE)));
double[] dArr = InitArray<double>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Double_InOut(dArr, ARRAY_SIZE), "CStyle_Array_Double_InOut");
- Assert.IsTrue(Equals<double>(dArr, GetExpectedOutArray<double>(ARRAY_SIZE)), "CStyle_Array_Double_InOut:Equals<double>");
+ Assert.True(CStyle_Array_Double_InOut(dArr, ARRAY_SIZE));
+ Assert.True(Equals<double>(dArr, GetExpectedOutArray<double>(ARRAY_SIZE)));
float[] fArr = InitArray<float>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Float_InOut(fArr, ARRAY_SIZE), "CStyle_Array_Float_InOut");
- Assert.IsTrue(Equals<float>(fArr, GetExpectedOutArray<float>(ARRAY_SIZE)), "CStyle_Array_Float_InOut:Equals<float>");
+ Assert.True(CStyle_Array_Float_InOut(fArr, ARRAY_SIZE));
+ Assert.True(Equals<float>(fArr, GetExpectedOutArray<float>(ARRAY_SIZE)));
byte[] bArr = InitArray<byte>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Byte_InOut(bArr, ARRAY_SIZE), "CStyle_Array_Byte_InOut");
- Assert.IsTrue(Equals<byte>(bArr, GetExpectedOutArray<byte>(ARRAY_SIZE)), "CStyle_Array_Byte_InOut:Equals<byte>");
+ Assert.True(CStyle_Array_Byte_InOut(bArr, ARRAY_SIZE));
+ Assert.True(Equals<byte>(bArr, GetExpectedOutArray<byte>(ARRAY_SIZE)));
char[] cArr = InitArray<char>(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Char_InOut(cArr, ARRAY_SIZE), "CStyle_Array_Char_InOut");
- Assert.IsTrue(Equals<char>(cArr, GetExpectedOutArray<char>(ARRAY_SIZE)), "CStyle_Array_Char_InOut:Equals<char>");
+ Assert.True(CStyle_Array_Char_InOut(cArr, ARRAY_SIZE));
+ Assert.True(Equals<char>(cArr, GetExpectedOutArray<char>(ARRAY_SIZE)));
string[] strArr = InitArray<string>(ARRAY_SIZE);
strArr[strArr.Length / 2] = null;
- Assert.IsTrue(CStyle_Array_LPSTR_InOut(strArr, ARRAY_SIZE), "CStyle_Array_LPSTR_InOut");
+ Assert.True(CStyle_Array_LPSTR_InOut(strArr, ARRAY_SIZE));
string[] expectedArr = GetExpectedOutArray<string>(ARRAY_SIZE);
// Test nesting null value scenario
expectedArr[expectedArr.Length / 2 - 1] = null;
- Assert.IsTrue(Equals<string>(strArr, expectedArr), "CStyle_Array_LPSTR_InOut:Equals<string>");
+ Assert.True(Equals<string>(strArr, expectedArr));
TestStruct[] tsArr = InitStructArray(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Struct_InOut(tsArr, ARRAY_SIZE), "CStyle_Array_Struct_InOut");
- Assert.IsTrue(Equals<TestStruct>(tsArr, GetExpectedOutStructArray(ARRAY_SIZE)), "CStyle_Array_Struct_InOut:Equals<TestStruct>");
+ Assert.True(CStyle_Array_Struct_InOut(tsArr, ARRAY_SIZE));
+ Assert.True(Equals<TestStruct>(tsArr, GetExpectedOutStructArray(ARRAY_SIZE)));
bool[] boolArr = InitBoolArray(ARRAY_SIZE);
- Assert.IsTrue(CStyle_Array_Bool_InOut(boolArr, ARRAY_SIZE), "CStyle_Array_Bool_InOut");
- Assert.IsTrue(Equals<bool>(boolArr, GetExpectedOutBoolArray(ARRAY_SIZE)), "CStyle_Array_Bool_InOut:Equals<bool>");
+ Assert.True(CStyle_Array_Bool_InOut(boolArr, ARRAY_SIZE));
+ Assert.True(Equals<bool>(boolArr, GetExpectedOutBoolArray(ARRAY_SIZE)));
}
private static bool Equals<T>(T[] arr1, T[] arr2)
Console.WriteLine("By value marshaling CLR array as c-style-array with OutAttribute applied");
int[] iArr = new int[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Int_Out(iArr, ARRAY_SIZE), "CStyle_Array_Int_Out");
- Assert.IsTrue(Equals<int>(iArr, GetExpectedOutArray<int>(ARRAY_SIZE)), "CStyle_Array_Int_Out:Equals<int>");
+ Assert.True(CStyle_Array_Int_Out(iArr, ARRAY_SIZE));
+ Assert.True(Equals<int>(iArr, GetExpectedOutArray<int>(ARRAY_SIZE)));
int[] iArrNull = null;
- Assert.IsTrue(CStyle_Array_Int_Out_Null(iArrNull), "CStyle_Array_Int_Out_Null");
- Assert.IsNull(iArrNull, "CStyle_Array_Int_Out_Null:Equals<null>");
+ Assert.True(CStyle_Array_Int_Out_Null(iArrNull));
+ Assert.Null(iArrNull);
int[] iArrLength0 = new int[0];
- Assert.IsTrue(CStyle_Array_Int_Out_ZeroLength(iArrLength0), "CStyle_Array_Int_Out_ZeroLength");
- Assert.AreEqual(0, iArrLength0.Length, "CStyle_Array_Int_Out_ZeroLength:Length<!0>");
+ Assert.True(CStyle_Array_Int_Out_ZeroLength(iArrLength0));
+ Assert.Equal(0, iArrLength0.Length);
uint[] uiArr = new uint[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Uint_Out(uiArr, ARRAY_SIZE), "CStyle_Array_Uint_Out");
- Assert.IsTrue(Equals<uint>(uiArr, GetExpectedOutArray<uint>(ARRAY_SIZE)), "CStyle_Array_Uint_Out:Equals<uint>");
+ Assert.True(CStyle_Array_Uint_Out(uiArr, ARRAY_SIZE));
+ Assert.True(Equals<uint>(uiArr, GetExpectedOutArray<uint>(ARRAY_SIZE)));
short[] sArr = new short[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Short_Out(sArr, ARRAY_SIZE), "CStyle_Array_Short_Out");
- Assert.IsTrue(Equals<short>(sArr, GetExpectedOutArray<short>(ARRAY_SIZE)), "CStyle_Array_Short_Out:Equals<short>");
+ Assert.True(CStyle_Array_Short_Out(sArr, ARRAY_SIZE));
+ Assert.True(Equals<short>(sArr, GetExpectedOutArray<short>(ARRAY_SIZE)));
ushort[] usArr = new ushort[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Word_Out(usArr, ARRAY_SIZE), "CStyle_Array_Word_Out");
- Assert.IsTrue(Equals<ushort>(usArr, GetExpectedOutArray<ushort>(ARRAY_SIZE)), "CStyle_Array_Word_Out:Equals<ushort>");
+ Assert.True(CStyle_Array_Word_Out(usArr, ARRAY_SIZE));
+ Assert.True(Equals<ushort>(usArr, GetExpectedOutArray<ushort>(ARRAY_SIZE)));
long[] lArr = new long[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Long64_Out(lArr, ARRAY_SIZE), "CStyle_Array_Long64_Out");
- Assert.IsTrue(Equals<long>(lArr, GetExpectedOutArray<long>(ARRAY_SIZE)), "CStyle_Array_Long64_Out:Equals<long>");
+ Assert.True(CStyle_Array_Long64_Out(lArr, ARRAY_SIZE));
+ Assert.True(Equals<long>(lArr, GetExpectedOutArray<long>(ARRAY_SIZE)));
ulong[] ulArr = new ulong[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_ULong64_Out(ulArr, ARRAY_SIZE), "CStyle_Array_ULong64_Out");
- Assert.IsTrue(Equals<ulong>(ulArr, GetExpectedOutArray<ulong>(ARRAY_SIZE)), "CStyle_Array_ULong64_Out:Equals<ulong>");
+ Assert.True(CStyle_Array_ULong64_Out(ulArr, ARRAY_SIZE));
+ Assert.True(Equals<ulong>(ulArr, GetExpectedOutArray<ulong>(ARRAY_SIZE)));
double[] dArr = new double[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Double_Out(dArr, ARRAY_SIZE), "CStyle_Array_Double_Out");
- Assert.IsTrue(Equals<double>(dArr, GetExpectedOutArray<double>(ARRAY_SIZE)), "CStyle_Array_Double_Out:Equals<double>");
+ Assert.True(CStyle_Array_Double_Out(dArr, ARRAY_SIZE));
+ Assert.True(Equals<double>(dArr, GetExpectedOutArray<double>(ARRAY_SIZE)));
float[] fArr = new float[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Float_Out(fArr, ARRAY_SIZE), "CStyle_Array_Float_Out");
- Assert.IsTrue(Equals<float>(fArr, GetExpectedOutArray<float>(ARRAY_SIZE)), "CStyle_Array_Float_Out:Equals<float>");
+ Assert.True(CStyle_Array_Float_Out(fArr, ARRAY_SIZE));
+ Assert.True(Equals<float>(fArr, GetExpectedOutArray<float>(ARRAY_SIZE)));
byte[] bArr = new byte[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Byte_Out(bArr, ARRAY_SIZE), "CStyle_Array_Byte_Out");
- Assert.IsTrue(Equals<byte>(bArr, GetExpectedOutArray<byte>(ARRAY_SIZE)), "CStyle_Array_Byte_Out:Equals<byte>");
+ Assert.True(CStyle_Array_Byte_Out(bArr, ARRAY_SIZE));
+ Assert.True(Equals<byte>(bArr, GetExpectedOutArray<byte>(ARRAY_SIZE)));
char[] cArr = new char[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Char_Out(cArr, ARRAY_SIZE), "CStyle_Array_Char_Out");
- Assert.IsTrue(Equals<char>(cArr, GetExpectedOutArray<char>(ARRAY_SIZE)), "CStyle_Array_Char_Out:Equals<char>");
+ Assert.True(CStyle_Array_Char_Out(cArr, ARRAY_SIZE));
+ Assert.True(Equals<char>(cArr, GetExpectedOutArray<char>(ARRAY_SIZE)));
string[] strArr = new string[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_LPSTR_Out(strArr, ARRAY_SIZE), "CStyle_Array_LPSTR_Out");
+ Assert.True(CStyle_Array_LPSTR_Out(strArr, ARRAY_SIZE));
string[] expectedArr = GetExpectedOutArray<string>(ARRAY_SIZE);
// Test nesting null value scenario
expectedArr[expectedArr.Length / 2 - 1] = null;
- Assert.IsTrue(Equals<string>(strArr, expectedArr), "CStyle_Array_LPSTR_Out:Equals<string>");
+ Assert.True(Equals<string>(strArr, expectedArr));
TestStruct[] tsArr = new TestStruct[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Struct_Out(tsArr, ARRAY_SIZE), "CStyle_Array_Struct_Out");
- Assert.IsTrue(Equals<TestStruct>(tsArr, GetExpectedOutStructArray(ARRAY_SIZE)), "CStyle_Array_Struct_Out:Equals<TestStruct>");
+ Assert.True(CStyle_Array_Struct_Out(tsArr, ARRAY_SIZE));
+ Assert.True(Equals<TestStruct>(tsArr, GetExpectedOutStructArray(ARRAY_SIZE)));
bool[] boolArr = new bool[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Bool_Out(boolArr, ARRAY_SIZE), "CStyle_Array_Bool_Out");
- Assert.IsTrue(Equals<bool>(boolArr, GetExpectedOutBoolArray(ARRAY_SIZE)), "CStyle_Array_Bool_Out:Equals<bool>");
-
+ Assert.True(CStyle_Array_Bool_Out(boolArr, ARRAY_SIZE));
+ Assert.True(Equals<bool>(boolArr, GetExpectedOutBoolArray(ARRAY_SIZE)));
+
if (OperatingSystem.IsWindows())
{
object[] oArr = new object[ARRAY_SIZE];
- Assert.IsTrue(CStyle_Array_Object_Out(oArr, ARRAY_SIZE), "CStyle_Array_Object_Out");
+ Assert.True(CStyle_Array_Object_Out(oArr, ARRAY_SIZE));
object[] expectedOArr = GetExpectedOutArray<object>(ARRAY_SIZE);
// Test nesting null value scenario
expectedOArr[expectedOArr.Length / 2 - 1] = null;
- Assert.IsTrue(Equals<object>(oArr, expectedOArr), "CStyle_Array_Object_Out:Equals<object>");
+ Assert.True(Equals<object>(oArr, expectedOArr));
}
}
TestMarshalByVal_In();
TestMarshalByVal_InOut();
TestMarshalByVal_Out();
-
+
Console.WriteLine("\nTest PASS.");
return 100;
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe class ArrayWithOffsetTest
{
fixed (int* expectedSubArray = expected.Slice(i))
fixed (int* newValueSubArray = newValue.Slice(i))
{
- Assert.IsTrue(ArrayWithOffsetNative.Marshal_InOut(expectedSubArray, offset, expected.Length - i, newValueSubArray), $"Native call failed with element offset {i}.");
+ Assert.True(ArrayWithOffsetNative.Marshal_InOut(expectedSubArray, offset, expected.Length - i, newValueSubArray), $"Native call failed with element offset {i}.");
}
for (int j = 0; j < i; j++)
{
- Assert.AreEqual(expected[j], array[j]);
+ Assert.Equal(expected[j], array[j]);
}
for (int j = i; j < array.Length; j++)
{
- Assert.AreEqual(newValue[j], array[j]);
+ Assert.Equal(newValue[j], array[j]);
}
}
using System.Text;
using System.Runtime.InteropServices;
using System.Reflection;
-using TestLibrary;
+using Xunit;
#pragma warning disable CS0612, CS0618
private static readonly string MappableString = "" + NormalChar1 + mappableChar + NormalChar2;
private static readonly string UnmappableString = "" + NormalChar1 + unmappableChar + NormalChar2;
-
+
[DllImport("AsAnyNative")]
public static extern bool PassArraySbyte(
[MarshalAs(UnmanagedType.AsAny)] object sbyteArray,
sbyte[] expected,
int len
);
-
+
[DllImport("AsAnyNative")]
public static extern bool PassArrayByte(
[MarshalAs(UnmanagedType.AsAny)] object byteArray,
UIntPtr[] expected,
int len
);
-
+
[DllImport("AsAnyNative")]
public static extern long PassLayout(
[MarshalAs(UnmanagedType.AsAny)] Object i);
- [DllImport("AsAnyNative", EntryPoint = "PassUnicodeStr", CharSet = CharSet.Unicode,
+ [DllImport("AsAnyNative", EntryPoint = "PassUnicodeStr", CharSet = CharSet.Unicode,
BestFitMapping = true, ThrowOnUnmappableChar = true)]
public static extern bool PassUnicodeStrTT(
[MarshalAs(UnmanagedType.AsAny)]
[DllImport("AsAnyNative", EntryPoint = "PassUnicodeStr", CharSet = CharSet.Unicode,
BestFitMapping = false, ThrowOnUnmappableChar = false)]
- public static extern bool PassUnicodeStrFF(
+ public static extern bool PassUnicodeStrFF(
[MarshalAs(UnmanagedType.AsAny)]
Object i);
CharArrayInit(unMappableCharArray_In, unMappableCharArray_InOut, unMappableCharArray_Out,
mappableCharArray_In, mappableCharArray_InOut, mappableCharArray_Out, UnmappableString, MappableString);
- Assert.IsTrue(PassAnsiCharArrayTT(mappableCharArray_In, mappableCharArray_InOut, mappableCharArray_Out, false));
- Assert.AreAllEqual(mappableAnsiStr_back.ToCharArray(), mappableCharArray_InOut);
- Assert.AreAllEqual(mappableAnsiStr_back.ToCharArray(), mappableCharArray_Out);
+ Assert.True(PassAnsiCharArrayTT(mappableCharArray_In, mappableCharArray_InOut, mappableCharArray_Out, false));
+ AssertExtensions.CollectionEqual(mappableAnsiStr_back.ToCharArray(), mappableCharArray_InOut);
+ AssertExtensions.CollectionEqual(mappableAnsiStr_back.ToCharArray(), mappableCharArray_Out);
CharArrayInit(unMappableCharArray_In, unMappableCharArray_InOut, unMappableCharArray_Out,
mappableCharArray_In, mappableCharArray_InOut, mappableCharArray_Out, UnmappableString, MappableString);
CharArrayInit(unMappableCharArray_In, unMappableCharArray_InOut, unMappableCharArray_Out,
mappableCharArray_In, mappableCharArray_InOut, mappableCharArray_Out, UnmappableString, MappableString);
- Assert.IsTrue(PassAnsiCharArrayFF(unMappableCharArray_In, unMappableCharArray_InOut, unMappableCharArray_Out, true));
- Assert.AreAllEqual(unMappableAnsiStr_back.ToCharArray(), unMappableCharArray_InOut);
- Assert.AreAllEqual(unMappableAnsiStr_back.ToCharArray(), unMappableCharArray_Out);
+ Assert.True(PassAnsiCharArrayFF(unMappableCharArray_In, unMappableCharArray_InOut, unMappableCharArray_Out, true));
+ AssertExtensions.CollectionEqual(unMappableAnsiStr_back.ToCharArray(), unMappableCharArray_InOut);
+ AssertExtensions.CollectionEqual(unMappableAnsiStr_back.ToCharArray(), unMappableCharArray_Out);
}
private static void TestUnicodeStringArray()
CharArrayInit(unMappableCharArray_In, unMappableCharArray_InOut, unMappableCharArray_Out,
mappableCharArray_In, mappableCharArray_InOut, mappableCharArray_Out, UnmappableString, MappableString);
- Assert.IsTrue(PassUnicodeCharArrayTT(unMappableCharArray_In, unMappableCharArray_InOut, unMappableCharArray_Out));
- Assert.AreAllEqual(unMappableUnicodeStr_back.ToCharArray(), unMappableCharArray_InOut);
- Assert.AreAllEqual(unMappableUnicodeStr_back.ToCharArray(), unMappableCharArray_Out);
+ Assert.True(PassUnicodeCharArrayTT(unMappableCharArray_In, unMappableCharArray_InOut, unMappableCharArray_Out));
+ AssertExtensions.CollectionEqual(unMappableUnicodeStr_back.ToCharArray(), unMappableCharArray_InOut);
+ AssertExtensions.CollectionEqual(unMappableUnicodeStr_back.ToCharArray(), unMappableCharArray_Out);
CharArrayInit(unMappableCharArray_In, unMappableCharArray_InOut, unMappableCharArray_Out,
mappableCharArray_In, mappableCharArray_InOut, mappableCharArray_Out, UnmappableString, MappableString);
- Assert.IsTrue(PassUnicodeCharArrayFT(unMappableCharArray_In, unMappableCharArray_InOut, unMappableCharArray_Out));
- Assert.AreAllEqual(unMappableUnicodeStr_back.ToCharArray(), unMappableCharArray_InOut);
- Assert.AreAllEqual(unMappableUnicodeStr_back.ToCharArray(), unMappableCharArray_Out);
+ Assert.True(PassUnicodeCharArrayFT(unMappableCharArray_In, unMappableCharArray_InOut, unMappableCharArray_Out));
+ AssertExtensions.CollectionEqual(unMappableUnicodeStr_back.ToCharArray(), unMappableCharArray_InOut);
+ AssertExtensions.CollectionEqual(unMappableUnicodeStr_back.ToCharArray(), unMappableCharArray_Out);
CharArrayInit(unMappableCharArray_In, unMappableCharArray_InOut, unMappableCharArray_Out,
mappableCharArray_In, mappableCharArray_InOut, mappableCharArray_Out, UnmappableString, MappableString);
- Assert.IsTrue(PassUnicodeCharArrayFF(unMappableCharArray_In, unMappableCharArray_InOut, unMappableCharArray_Out));
- Assert.AreAllEqual(unMappableUnicodeStr_back.ToCharArray(), unMappableCharArray_InOut);
- Assert.AreAllEqual(unMappableUnicodeStr_back.ToCharArray(), unMappableCharArray_Out);
+ Assert.True(PassUnicodeCharArrayFF(unMappableCharArray_In, unMappableCharArray_InOut, unMappableCharArray_Out));
+ AssertExtensions.CollectionEqual(unMappableUnicodeStr_back.ToCharArray(), unMappableCharArray_InOut);
+ AssertExtensions.CollectionEqual(unMappableUnicodeStr_back.ToCharArray(), unMappableCharArray_Out);
}
private static void TestAnsiStringBuilder()
StringBuilder mappableStrbd = new StringBuilder(MappableString);
Assert.Throws<ArgumentException>(() => PassAnsiStrbdTT(unMappableStrbd, true));
- Assert.IsTrue(PassAnsiStrbdTT(mappableStrbd, false));
+ Assert.True(PassAnsiStrbdTT(mappableStrbd, false));
Assert.Throws<ArgumentException>(() => PassAnsiStrbdFT(unMappableStrbd, true));
Assert.Throws<ArgumentException>(() => PassAnsiStrbdFT(mappableStrbd, false));
- Assert.IsTrue(PassAnsiStrbdFF(unMappableStrbd, true));
+ Assert.True(PassAnsiStrbdFF(unMappableStrbd, true));
}
private static void TestUnicodeStringBuilder()
{
StringBuilder unMappableStrbd = new StringBuilder(UnmappableString);
- Assert.IsTrue(PassUnicodeStrbdTT(unMappableStrbd));
- Assert.IsTrue(PassUnicodeStrbdFT(unMappableStrbd));
- Assert.IsTrue(PassUnicodeStrbdFF(unMappableStrbd));
+ Assert.True(PassUnicodeStrbdTT(unMappableStrbd));
+ Assert.True(PassUnicodeStrbdFT(unMappableStrbd));
+ Assert.True(PassUnicodeStrbdFF(unMappableStrbd));
}
private static void TestAnsiStringBestFitMapping()
{
Assert.Throws<ArgumentException>(() => PassAnsiStrTT(UnmappableString, true));
- Assert.IsTrue(PassAnsiStrTT(MappableString, false));
+ Assert.True(PassAnsiStrTT(MappableString, false));
Assert.Throws<ArgumentException>(() => PassAnsiStrFT(UnmappableString, true));
Assert.Throws<ArgumentException>(() => PassAnsiStrFT(MappableString, false));
- Assert.IsTrue(PassAnsiStrFF(UnmappableString, true));
+ Assert.True(PassAnsiStrFF(UnmappableString, true));
}
private static void TestUnicodeString()
{
- Assert.IsTrue(PassUnicodeStrTT(UnmappableString));
- Assert.IsTrue(PassUnicodeStrFT(UnmappableString));
- Assert.IsTrue(PassUnicodeStrFF(UnmappableString));
+ Assert.True(PassUnicodeStrTT(UnmappableString));
+ Assert.True(PassUnicodeStrFT(UnmappableString));
+ Assert.True(PassUnicodeStrFF(UnmappableString));
}
private static void TestUIntPtrArray()
UIntPtr[] uIntPtrArray_Out = new UIntPtr[] { new UIntPtr(0), new UIntPtr(1), new UIntPtr(2) };
UIntPtr[] uIntPtrArray_Back = new UIntPtr[] { new UIntPtr(10), new UIntPtr(11), new UIntPtr(12) };
UIntPtr[] expected = new UIntPtr[] { new UIntPtr(0), new UIntPtr(1), new UIntPtr(2) };
- Assert.IsTrue(PassArrayUIntPtr(uIntPtrArray, uIntPtrArray_In, uIntPtrArray_InOut, uIntPtrArray_Out, expected, 3));
- Assert.AreAllEqual(uIntPtrArray_Back, uIntPtrArray_InOut);
- Assert.AreAllEqual(uIntPtrArray_Back, uIntPtrArray_Out);
+ Assert.True(PassArrayUIntPtr(uIntPtrArray, uIntPtrArray_In, uIntPtrArray_InOut, uIntPtrArray_Out, expected, 3));
+ AssertExtensions.CollectionEqual(uIntPtrArray_Back, uIntPtrArray_InOut);
+ AssertExtensions.CollectionEqual(uIntPtrArray_Back, uIntPtrArray_Out);
}
private static void TestIntPtrArray()
IntPtr[] intPtrArray_Out = new IntPtr[] { new IntPtr(0), new IntPtr(1), new IntPtr(2) };
IntPtr[] intPtrArray_Back = new IntPtr[] { new IntPtr(10), new IntPtr(11), new IntPtr(12) };
IntPtr[] expected = new IntPtr[] { new IntPtr(0), new IntPtr(1), new IntPtr(2) };
- Assert.IsTrue(PassArrayIntPtr(intPtrArray, intPtrArray_In, intPtrArray_InOut, intPtrArray_Out, expected, 3));
- Assert.AreAllEqual(intPtrArray_Back, intPtrArray_InOut);
- Assert.AreAllEqual(intPtrArray_Back, intPtrArray_Out);
+ Assert.True(PassArrayIntPtr(intPtrArray, intPtrArray_In, intPtrArray_InOut, intPtrArray_Out, expected, 3));
+ AssertExtensions.CollectionEqual(intPtrArray_Back, intPtrArray_InOut);
+ AssertExtensions.CollectionEqual(intPtrArray_Back, intPtrArray_Out);
}
private static void TestBoolArray()
bool[] boolArray_InOut = new bool[] { true, false, false };
bool[] boolArray_Out = new bool[] { true, false, false };
bool[] boolArray_Back = new bool[] { false, true, true };
- Assert.IsTrue(PassArrayBool(boolArray, boolArray_In, boolArray_InOut, boolArray_Out, new bool[] { true, false, false }, 3));
- Assert.AreAllEqual(boolArray_Back, boolArray_InOut);
- Assert.AreAllEqual(boolArray_Back, boolArray_Out);
+ Assert.True(PassArrayBool(boolArray, boolArray_In, boolArray_InOut, boolArray_Out, new bool[] { true, false, false }, 3));
+ AssertExtensions.CollectionEqual(boolArray_Back, boolArray_InOut);
+ AssertExtensions.CollectionEqual(boolArray_Back, boolArray_Out);
}
private static void TestCharArray()
char[] charArray_InOut = new char[] { 'a', 'b', 'c' };
char[] charArray_Out = new char[] { 'a', 'b', 'c' };
char[] charArray_Back = new char[] { 'd', 'e', 'f' };
- Assert.IsTrue(PassArrayChar(charArray, charArray_In, charArray_InOut, charArray_Out, new char[] { 'a', 'b', 'c' }, 3));
- Assert.AreAllEqual(charArray_Back, charArray_InOut);
- Assert.AreAllEqual(charArray_Back, charArray_Out);
+ Assert.True(PassArrayChar(charArray, charArray_In, charArray_InOut, charArray_Out, new char[] { 'a', 'b', 'c' }, 3));
+ AssertExtensions.CollectionEqual(charArray_Back, charArray_InOut);
+ AssertExtensions.CollectionEqual(charArray_Back, charArray_Out);
}
private static void TestDoubleArray()
double[] doubleArray_InOut = new double[] { 0.0, 1.1, 2.2 };
double[] doubleArray_Out = new double[] { 0.0, 1.1, 2.2 };
double[] doubleArray_Back = new double[] { 10.0, 11.1, 12.2 };
- Assert.IsTrue(PassArrayDouble(doubleArray, doubleArray_In, doubleArray_InOut, doubleArray_Out, new double[] { 0.0, 1.1, 2.2 }, 3));
- Assert.AreAllEqual(doubleArray_Back, doubleArray_InOut);
- Assert.AreAllEqual(doubleArray_Back, doubleArray_Out);
+ Assert.True(PassArrayDouble(doubleArray, doubleArray_In, doubleArray_InOut, doubleArray_Out, new double[] { 0.0, 1.1, 2.2 }, 3));
+ AssertExtensions.CollectionEqual(doubleArray_Back, doubleArray_InOut);
+ AssertExtensions.CollectionEqual(doubleArray_Back, doubleArray_Out);
}
private static void TestSingleArray()
float[] singleArray_InOut = new float[] { 0, 1, 2 };
float[] singleArray_Out = new float[] { 0, 1, 2 };
float[] singleArray_Back = new float[] { 10, 11, 12 };
- Assert.IsTrue(PassArraySingle(singleArray, singleArray_In, singleArray_InOut, singleArray_Out, new float[] { 0, 1, 2 }, 3));
- Assert.AreAllEqual(singleArray_Back, singleArray_InOut);
- Assert.AreAllEqual(singleArray_Back, singleArray_Out);
+ Assert.True(PassArraySingle(singleArray, singleArray_In, singleArray_InOut, singleArray_Out, new float[] { 0, 1, 2 }, 3));
+ AssertExtensions.CollectionEqual(singleArray_Back, singleArray_InOut);
+ AssertExtensions.CollectionEqual(singleArray_Back, singleArray_Out);
}
private static void TestULongArray()
ulong[] ulongArray_InOut = new ulong[] { 0, 1, 2 };
ulong[] ulongArray_Out = new ulong[] { 0, 1, 2 };
ulong[] ulongArray_Back = new ulong[] { 10, 11, 12 };
- Assert.IsTrue(PassArrayUlong(ulongArray, ulongArray_In, ulongArray_InOut, ulongArray_Out, new ulong[] { 0, 1, 2 }, 3));
- Assert.AreAllEqual(ulongArray_Back, ulongArray_InOut);
- Assert.AreAllEqual(ulongArray_Back, ulongArray_Out);
+ Assert.True(PassArrayUlong(ulongArray, ulongArray_In, ulongArray_InOut, ulongArray_Out, new ulong[] { 0, 1, 2 }, 3));
+ AssertExtensions.CollectionEqual(ulongArray_Back, ulongArray_InOut);
+ AssertExtensions.CollectionEqual(ulongArray_Back, ulongArray_Out);
}
private static void TestLongArray()
long[] longArray_InOut = new long[] { 0, 1, 2 };
long[] longArray_Out = new long[] { 0, 1, 2 };
long[] longArray_Back = new long[] { 10, 11, 12 };
- Assert.IsTrue(PassArrayLong(longArray, longArray_In, longArray_InOut, longArray_Out, new long[] { 0, 1, 2 }, 3));
- Assert.AreAllEqual(longArray_Back, longArray_InOut);
- Assert.AreAllEqual(longArray_Back, longArray_Out);
+ Assert.True(PassArrayLong(longArray, longArray_In, longArray_InOut, longArray_Out, new long[] { 0, 1, 2 }, 3));
+ AssertExtensions.CollectionEqual(longArray_Back, longArray_InOut);
+ AssertExtensions.CollectionEqual(longArray_Back, longArray_Out);
}
private static void TestUInt32Array()
uint[] uintArray_InOut = new uint[] { 0, 1, 2 };
uint[] uintArray_Out = new uint[] { 0, 1, 2 };
uint[] uintArray_Back = new uint[] { 10, 11, 12 };
- Assert.IsTrue(PassArrayUint(uintArray, uintArray_In, uintArray_InOut, uintArray_Out, new uint[] { 0, 1, 2 }, 3));
- Assert.AreAllEqual(uintArray_Back, uintArray_InOut);
- Assert.AreAllEqual(uintArray_Back, uintArray_Out);
+ Assert.True(PassArrayUint(uintArray, uintArray_In, uintArray_InOut, uintArray_Out, new uint[] { 0, 1, 2 }, 3));
+ AssertExtensions.CollectionEqual(uintArray_Back, uintArray_InOut);
+ AssertExtensions.CollectionEqual(uintArray_Back, uintArray_Out);
}
private static void TestInt32Array()
int[] intArray_InOut = new int[] { 0, 1, 2 };
int[] intArray_Out = new int[] { 0, 1, 2 };
int[] intArray_Back = new int[] { 10, 11, 12 };
- Assert.IsTrue(PassArrayInt(intArray, intArray_In, intArray_InOut, intArray_Out, new int[] { 0, 1, 2 }, 3));
- Assert.AreAllEqual(intArray_Back, intArray_InOut);
- Assert.AreAllEqual(intArray_Back, intArray_Out);
+ Assert.True(PassArrayInt(intArray, intArray_In, intArray_InOut, intArray_Out, new int[] { 0, 1, 2 }, 3));
+ AssertExtensions.CollectionEqual(intArray_Back, intArray_InOut);
+ AssertExtensions.CollectionEqual(intArray_Back, intArray_Out);
}
private static void TestUInt16Array()
ushort[] ushortArray_InOut = new ushort[] { 0, 1, 2 };
ushort[] ushortArray_Out = new ushort[] { 0, 1, 2 };
ushort[] ushortArray_Back = new ushort[] { 10, 11, 12 };
- Assert.IsTrue(PassArrayUshort(ushortArray, ushortArray_In, ushortArray_InOut, ushortArray_Out, new ushort[] { 0, 1, 2 }, 3));
- Assert.AreAllEqual(ushortArray_Back, ushortArray_InOut);
- Assert.AreAllEqual(ushortArray_Back, ushortArray_Out);
+ Assert.True(PassArrayUshort(ushortArray, ushortArray_In, ushortArray_InOut, ushortArray_Out, new ushort[] { 0, 1, 2 }, 3));
+ AssertExtensions.CollectionEqual(ushortArray_Back, ushortArray_InOut);
+ AssertExtensions.CollectionEqual(ushortArray_Back, ushortArray_Out);
}
private static void TestInt16Array()
short[] shortArray_InOut = new short[] { -1, 0, 1 };
short[] shortArray_Out = new short[] { -1, 0, 1 };
short[] shortArray_Back = new short[] { 9, 10, 11 };
- Assert.IsTrue(PassArrayShort(shortArray, shortArray_In, shortArray_InOut, shortArray_Out, new short[] { -1, 0, 1 }, 3));
- Assert.AreAllEqual(shortArray_Back, shortArray_InOut);
- Assert.AreAllEqual(shortArray_Back, shortArray_Out);
+ Assert.True(PassArrayShort(shortArray, shortArray_In, shortArray_InOut, shortArray_Out, new short[] { -1, 0, 1 }, 3));
+ AssertExtensions.CollectionEqual(shortArray_Back, shortArray_InOut);
+ AssertExtensions.CollectionEqual(shortArray_Back, shortArray_Out);
}
private static void TestByteArray()
byte[] byteArray_InOut = new byte[] { 0, 1, 2 };
byte[] byteArray_Out = new byte[] { 0, 1, 2 };
byte[] byteArray_Back = new byte[] { 10, 11, 12 };
- Assert.IsTrue(PassArrayByte(byteArray, byteArray_In, byteArray_InOut, byteArray_Out, new byte[] { 0, 1, 2 }, 3));
- Assert.AreAllEqual(byteArray_Back, byteArray_InOut);
- Assert.AreAllEqual(byteArray_Back, byteArray_Out);
+ Assert.True(PassArrayByte(byteArray, byteArray_In, byteArray_InOut, byteArray_Out, new byte[] { 0, 1, 2 }, 3));
+ AssertExtensions.CollectionEqual(byteArray_Back, byteArray_InOut);
+ AssertExtensions.CollectionEqual(byteArray_Back, byteArray_Out);
}
private static void TestSByteArray()
sbyte[] sbyteArray_InOut = new sbyte[] { -1, 0, 1 };
sbyte[] sbyteArray_Out = new sbyte[] { -1, 0, 1 };
sbyte[] sbyteArray_Back = new sbyte[] { 9, 10, 11 };
- Assert.IsTrue(PassArraySbyte(sbyteArray, sbyteArray_In, sbyteArray_InOut, sbyteArray_Out, new sbyte[] {-1, 0, 1}, 3));
- Assert.AreAllEqual(sbyteArray_Back, sbyteArray_InOut);
- Assert.AreAllEqual(sbyteArray_Back, sbyteArray_Out);
+ Assert.True(PassArraySbyte(sbyteArray, sbyteArray_In, sbyteArray_InOut, sbyteArray_Out, new sbyte[] {-1, 0, 1}, 3));
+ AssertExtensions.CollectionEqual(sbyteArray_Back, sbyteArray_InOut);
+ AssertExtensions.CollectionEqual(sbyteArray_Back, sbyteArray_Out);
}
public static void TestLayout() {
a = 12,
b = 3
};
-
- Assert.AreEqual(layoutStruct.b, PassLayout(layoutStruct));
+
+ Assert.Equal(layoutStruct.b, PassLayout(layoutStruct));
Console.WriteLine("------------------------");
}
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
-using TestLibrary;
+using Xunit;
class LCIDNative
{
{
string testString = "Test string";
LCIDNative.ReverseString(testString, out string reversed);
- Assert.AreEqual(Reverse(testString), reversed);
+ Assert.Equal(Reverse(testString), reversed);
CultureInfo originalCulture = CultureInfo.CurrentCulture;
try
{
CultureInfo spanishCulture = new CultureInfo("es-ES", false);
CultureInfo.CurrentCulture = spanishCulture;
- Assert.IsTrue(LCIDNative.VerifyValidLCIDPassed(CultureInfo.CurrentCulture.LCID));
+ Assert.True(LCIDNative.VerifyValidLCIDPassed(CultureInfo.CurrentCulture.LCID));
}
finally
{
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = false)]
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.True(Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetValidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc5");
- Assert.AreEqual('?', cTemp, "[Error] Location tc6");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal('?', cTemp);
cTemp = GetValidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc8");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs8");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferStringBuilder()
{
StringBuilder sb = GetInvalidStringBuilder();
- Assert.IsTrue(CharBuffer_In_StringBuilder(sb), "[Error] Location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(sb));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb7");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb8");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = false)]
static void testChar()
{
- Assert.Throws<ArgumentException>(() => Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.Throws<ArgumentException>(() => Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
- Assert.Throws<ArgumentException>(() => Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.Throws<ArgumentException>(() => Char_InByRef(ref cTemp));
cTemp = GetValidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
- Assert.Throws<ArgumentException>(() => Char_InOutByRef(ref cTemp), "[Error] Location tc5");
+ Assert.Throws<ArgumentException>(() => Char_InOutByRef(ref cTemp));
cTemp = GetValidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc6");
+ Assert.True(Char_InOutByRef(ref cTemp));
}
static void testCharBufferString()
{
- Assert.Throws<ArgumentException>(() => CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.Throws<ArgumentException>(() => CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
}
static void testCharBufferStringBuilder()
{
- Assert.Throws<ArgumentException>(() => CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
+ Assert.Throws<ArgumentException>(() => CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb6");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb7");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = false)]
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetInvalidChar()));
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc6");
+ Assert.True(Char_InByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tc8");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc10");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tcbs8");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs10");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferStringBuilder()
{
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
-
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
+
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb7");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb8");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb9");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb10");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = false)]
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
-
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetInvalidChar()));
+
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
char cTempClone = GetInvalidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
-
+ Assert.True(Char_InByRef(ref cTemp));
+
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc5");
+ Assert.True(Char_InOutByRef(ref cTemp));
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc6");
+ Assert.True(Char_InOutByRef(ref cTemp));
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = GetInvalidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
}
static void testCharBufferStringBuilder()
{
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = true)]
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.True(Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetValidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc5");
- Assert.AreEqual('?', cTemp, "[Error] Location tc66");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal('?', cTemp);
cTemp = GetValidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc8");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs88");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferStringBuilder()
{
StringBuilder sb = GetInvalidStringBuilder();
- Assert.IsTrue(CharBuffer_In_StringBuilder(sb), "[Error] Location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(sb));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb7");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb8");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = true)]
static void testChar()
{
- Assert.Throws<ArgumentException>(() => Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.Throws<ArgumentException>(() => Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
- Assert.Throws<ArgumentException>(() => Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.Throws<ArgumentException>(() => Char_InByRef(ref cTemp));
cTemp = GetValidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
- Assert.Throws<ArgumentException>(() => Char_InOutByRef(ref cTemp), "[Error] Location tc5");
+ Assert.Throws<ArgumentException>(() => Char_InOutByRef(ref cTemp));
cTemp = GetValidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc6");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc7");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferString()
{
- Assert.Throws<ArgumentException>(() => CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.Throws<ArgumentException>(() => CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs6");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs7");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferStringBuilder()
{
- Assert.Throws<ArgumentException>(() => CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
+ Assert.Throws<ArgumentException>(() => CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb6");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb7");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = true)]
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.True(Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc6");
+ Assert.True(Char_InByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tc8");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc10");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tcbs8");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Locationtcbs9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs10");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferStringBuilder()
{
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb7");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb8");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb9");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb10");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = true)]
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
-
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetInvalidChar()));
+
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
char cTempClone = GetInvalidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc5");
+ Assert.True(Char_InOutByRef(ref cTemp));
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc6");
+ Assert.True(Char_InOutByRef(ref cTemp));
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = GetInvalidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
}
static void testCharBufferStringBuilder()
{
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = false)]
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.True(Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetValidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc5");
- Assert.AreEqual('?', cTemp, "[Error] Location tc6");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal('?', cTemp);
cTemp = GetValidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc8");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs8");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferStringBuilder()
{
StringBuilder sb = GetInvalidStringBuilder();
- Assert.IsTrue(CharBuffer_In_StringBuilder(sb), "[Error] Location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(sb));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb7");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb8");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = false)]
static void testChar()
{
- Assert.Throws<ArgumentException>(() => Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.Throws<ArgumentException>(() => Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
- Assert.Throws<ArgumentException>(() => Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.Throws<ArgumentException>(() => Char_InByRef(ref cTemp));
cTemp = GetValidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
- Assert.Throws<ArgumentException>(() => Char_InOutByRef(ref cTemp), "[Error] Location tc5");
+ Assert.Throws<ArgumentException>(() => Char_InOutByRef(ref cTemp));
cTemp = GetValidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc6");
+ Assert.True(Char_InOutByRef(ref cTemp));
}
static void testCharBufferString()
{
- Assert.Throws<ArgumentException>(() => CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.Throws<ArgumentException>(() => CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
}
static void testCharBufferStringBuilder()
{
- Assert.Throws<ArgumentException>(() => CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
+ Assert.Throws<ArgumentException>(() => CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb7");
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = false)]
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.True(Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc6");
+ Assert.True(Char_InByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tc8");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc10");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "Error location tcbs1");
-
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "Error location tcbs2");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
+
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "Error location tcbs3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "Error location tcbs5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "Error location tcbs7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tcbs8");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "Error location tcbs9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs10");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferStringBuilder()
{
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "Error location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "Error location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "Error location tcbsb3");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "Error location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "Error location tcbsb5");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "Error location tcbsb6");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "Error location tcbsb7");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "Error location tcbsb8");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "Error location tcbsb9");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "Error location tcbsb10");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = false)]
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.True(Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
char cTempClone = GetInvalidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc5");
+ Assert.True(Char_InOutByRef(ref cTemp));
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc6");
+ Assert.True(Char_InOutByRef(ref cTemp));
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = GetInvalidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
}
static void testCharBufferStringBuilder()
{
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = true)]
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.True(Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetValidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc5");
- Assert.AreEqual('?', cTemp, "[Error] Location tc6");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal('?', cTemp);
cTemp = GetValidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc6");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs8");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferStringBuilder()
{
StringBuilder sb = GetInvalidStringBuilder();
- Assert.IsTrue(CharBuffer_In_StringBuilder(sb), "[Error] Location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(sb));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb7");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb8");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = true)]
static void testChar()
{
- Assert.Throws<ArgumentException>(() => Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.Throws<ArgumentException>(() => Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
- Assert.Throws<ArgumentException>(() => Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.Throws<ArgumentException>(() => Char_InByRef(ref cTemp));
cTemp = GetValidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location t4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
- Assert.Throws<ArgumentException>(() => Char_InOutByRef(ref cTemp), "[Error] Location tc55");
+ Assert.Throws<ArgumentException>(() => Char_InOutByRef(ref cTemp));
cTemp = GetValidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc6");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc7");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferString()
{
- Assert.Throws<ArgumentException>(() => CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.Throws<ArgumentException>(() => CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs6");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs7");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferStringBuilder()
{
- Assert.Throws<ArgumentException>(() => CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
+ Assert.Throws<ArgumentException>(() => CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb6");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb7");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = true)]
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.True(Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc6");
+ Assert.True(Char_InByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tc8");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc10");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tcbs8");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs10");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferStringBuilder()
{
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb7");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb8");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb9");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb10");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = true)]
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.True(Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
char cTempClone = GetInvalidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc5");
+ Assert.True(Char_InOutByRef(ref cTemp));
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc6");
+ Assert.True(Char_InOutByRef(ref cTemp));
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = GetInvalidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
}
static void testCharBufferStringBuilder()
{
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = false)]
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.True(Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetValidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc5");
- Assert.AreEqual('?', cTemp, "[Error] Location tc6");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal('?', cTemp);
cTemp = GetValidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc8");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs8");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferStringBuilder()
{
StringBuilder sb = GetInvalidStringBuilder();
- Assert.IsTrue(CharBuffer_In_StringBuilder(sb), "[Error] Location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(sb));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb7");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb8");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = true)]
static void testChar()
{
- Assert.Throws<ArgumentException>(() => Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.Throws<ArgumentException>(() => Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
- Assert.Throws<ArgumentException>(() => Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.Throws<ArgumentException>(() => Char_InByRef(ref cTemp));
cTemp = GetValidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
- Assert.Throws<ArgumentException>(() => Char_InOutByRef(ref cTemp), "[Error] Location tc5");
+ Assert.Throws<ArgumentException>(() => Char_InOutByRef(ref cTemp));
cTemp = GetValidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc6");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc7");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferString()
{
- Assert.Throws<ArgumentException>(() => CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.Throws<ArgumentException>(() => CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs6");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs7");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferStringBuilder()
{
- Assert.Throws<ArgumentException>(() => CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
+ Assert.Throws<ArgumentException>(() => CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb6");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb7");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = false)]
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.True(Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc6");
+ Assert.True(Char_InByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tc8");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc10");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tcbs8");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs10");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferStringBuilder()
{
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb7");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb8");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb9");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb10");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static char[] GetInvalidArray()
{
char[] c = GetInvalidArray();
ArrayWithOffset arrWOff_0 = new ArrayWithOffset(c, 0);
- Assert.IsTrue(Char_InOut_ArrayWithOffset(arrWOff_0), "[Error] Location ctlpsawo11");
+ Assert.True(Char_InOut_ArrayWithOffset(arrWOff_0));
c = GetValidArray();
ArrayWithOffset arrWOff_1 = new ArrayWithOffset(c, 1);
- Assert.IsTrue(Char_InOut_ArrayWithOffset(arrWOff_1), "[Error] Location ctlpsawo22");
+ Assert.True(Char_InOut_ArrayWithOffset(arrWOff_1));
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = true)]
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.True(Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
char cTempClone = GetInvalidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc5");
+ Assert.True(Char_InOutByRef(ref cTemp));
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc6");
+ Assert.True(Char_InOutByRef(ref cTemp));
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = GetInvalidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
}
static void testCharBufferStringBuilder()
{
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public class BFM_CharMarshaler
{
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.True(Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetValidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location t4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc55");
- Assert.AreEqual('?', cTemp, "[Error] Location tc6");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal('?', cTemp);
cTemp = GetValidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc6");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs77");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs8");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferStringBuilder()
{
StringBuilder sb = GetInvalidStringBuilder();
- Assert.IsTrue(CharBuffer_In_StringBuilder(sb), "[Error] Location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(sb));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb7");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb8");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public class BFM_CharMarshaler
{
static void testChar()
{
- Assert.Throws<ArgumentException>(() => Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.Throws<ArgumentException>(() => Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
- Assert.Throws<ArgumentException>(() => Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.Throws<ArgumentException>(() => Char_InByRef(ref cTemp));
cTemp = GetValidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
- Assert.Throws<ArgumentException>(() => Char_InOutByRef(ref cTemp), "[Error] Location tc5");
+ Assert.Throws<ArgumentException>(() => Char_InOutByRef(ref cTemp));
cTemp = GetValidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc6");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc7");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferString()
{
- Assert.Throws<ArgumentException>(() => CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.Throws<ArgumentException>(() => CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs6");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs7");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferStringBuilder()
{
- Assert.Throws<ArgumentException>(() => CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
+ Assert.Throws<ArgumentException>(() => CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
+ Assert.Throws<ArgumentException>(() => CharBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb6");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb7");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public class BFM_CharMarshaler
{
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.True(Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
char cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc6");
+ Assert.True(Char_InByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tc8");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tc10");
+ Assert.True(Char_InOutByRef(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "Error location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "Error location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "Error location tcbs3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "Error location tcbs5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "Error location tcbs7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tcbs8");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "Error location tcbs9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs10");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testCharBufferStringBuilder()
{
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "Error location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "Error location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "Error location tcbsb3");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "Error location tcbsb5");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "Error location tcbsb7");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb8");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "Error location tcbsb9");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb10");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public class BFM_CharMarshaler
{
static void testChar()
{
- Assert.IsTrue(Char_In(GetInvalidChar()), "[Error] Location tc1");
+ Assert.True(Char_In(GetInvalidChar()));
- Assert.IsTrue(Char_In(GetValidChar()), "[Error] Location tc2");
+ Assert.True(Char_In(GetValidChar()));
char cTemp = GetInvalidChar();
char cTempClone = GetInvalidChar();
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc3");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InByRef(ref cTemp), "[Error] Location tc4");
+ Assert.True(Char_InByRef(ref cTemp));
cTemp = GetInvalidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location t5");
+ Assert.True(Char_InOutByRef(ref cTemp));
cTemp = GetValidChar();
cTempClone = cTemp;
- Assert.IsTrue(Char_InOutByRef(ref cTemp), "[Error] Location tc6");
+ Assert.True(Char_InOutByRef(ref cTemp));
}
static void testCharBufferString()
{
- Assert.IsTrue(CharBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(CharBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(CharBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(CharBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = GetInvalidString();
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(CharBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs6");
+ Assert.True(CharBuffer_InOutByRef_String(ref cTemp));
}
static void testCharBufferStringBuilder()
{
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
+ Assert.True(CharBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(CharBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(CharBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(CharBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(CharBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb6");
+ Assert.True(CharBuffer_InOutByRef_StringBuilder(ref cTemp));
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = false)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tcbs6");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs88");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
StringBuilder sb = GetInvalidStringBuilder();
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(sb), "[Error] Location tcbsb1");
+ Assert.True(LPStrBuffer_In_StringBuilder(sb));
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
;
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb6");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb7");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tcbsb8");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Struct_String(lpss), "[Error] Location tlpsbs1");
+ Assert.True(LPStrBuffer_In_Struct_String(lpss));
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct cTemp = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbs3");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetInvalidStruct();
LPStrTestStruct cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbs5");
- Assert.AreNotEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.NotEqual(cTempClone.str, cTemp.str);
cTemp = GetValidStruct();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbs7");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbs8");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferClass()
{
LPStrTestClass lpss = new LPStrTestClass();
lpss.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(lpss), "[Error] Location tlpsbc1");
+ Assert.True(LPStrBuffer_In_Class_String(lpss));
lpss.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(lpss), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(lpss));
LPStrTestClass cTemp = new LPStrTestClass();
cTemp.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetInvalidString();
LPStrTestClass cTempClone = new LPStrTestClass();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc5");
- Assert.AreNotEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.NotEqual(cTempClone.str, cTemp.str);
cTemp.str = GetValidString();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc7");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc8");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferArray()
{
String[] lpss = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(lpss), "[Error] Location tlpsba1");
+ Assert.True(LPStrBuffer_In_Array_String(lpss));
- Assert.IsTrue(LPStrBuffer_In_Array_String(GetValidArray()), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(GetValidArray()));
String[] cTemp = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetInvalidArray();
String[] cTempClone = new String[3];
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba5");
- Assert.AreNotEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.NotEqual(cTempClone[0], cTemp[0]);
cTemp = GetValidArray();
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba7");
- Assert.AreEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba8");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.Equal(cTempClone[0], cTemp[0]);
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsba11");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsba22");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsba33");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsba44");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsba55");
- Assert.AreNotEqual(lpssClone[0].str, lpss[0].str, "[Error] Location tlpsba66");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.NotEqual(lpssClone[0].str, lpss[0].str);
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsba77");
- Assert.AreEqual(lpssClone[0].str, lpss[0].str, "[Error] Location tlpsba88");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.Equal(lpssClone[0].str, lpss[0].str);
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = false)]
static void testLPStrBufferString()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs6");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs7");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb6");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb7");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
return inValidStruct;
}
-
+
static LPStrTestStruct GetValidStruct()
{
LPStrTestStruct validStruct = new LPStrTestStruct();
static void testLPStrBufferStruct()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_Struct_String(GetInvalidStruct()));
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct cTemp = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
LPStrTestStruct cTempClone = new LPStrTestStruct();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst6");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbst7");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferClass()
{
LPStrTestClass cTest = new LPStrTestClass();
cTest.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Class_String(cTest), "[Error] Location tlpsbc1");
-
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_Class_String(cTest));
+
cTest.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(cTest), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(cTest));
LPStrTestClass cTemp = new LPStrTestClass();
cTemp.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_Class_String(ref cTemp));
LPStrTestClass cTempClone = new LPStrTestClass();
cTemp.str = GetValidString();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc6");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc7");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferArray()
{
String[] cTest = null;
cTest = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Array_String(cTest), "[Error] Location tlpsba1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_Array_String(cTest));
cTest = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(cTest), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(cTest));
String[] cTemp = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_Array_String(ref cTemp));
String[] cTempClone = new String[3];
cTemp = GetValidArray();
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba6");
- Assert.AreEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba7");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.Equal(cTempClone[0], cTemp[0]);
}
static void testLPStrBufferArrayOfStructs()
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
LPStrTestStruct[] lpssClone = new LPStrTestStruct[2];
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
- Assert.AreEqual(lpss[0].str, lpssClone[0].str, "[Error] Location tlpsbaos7");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.Equal(lpss[0].str, lpssClone[0].str);
}
static void runTest()
Console.WriteLine("--- Success");
return 100;
}
-
+
try
{
runTest();
}
catch (Exception e)
{
- Console.WriteLine($"Test Failure: {e}");
+ Console.WriteLine($"Test Failure: {e}");
return 101;
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = false)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tlpsbs8");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs10");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb6");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb7");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb8");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb9");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb10");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
+ Assert.True(LPStrBuffer_In_Struct_String(GetInvalidStruct()));
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst3");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst5");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
}
static String[] GetValidArray()
static void testLPStrBufferArray()
{
String[] s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba1");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
}
static void testLPStrBufferClass()
{
LPStrTestClass sClass = new LPStrTestClass();
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpsbc1");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpsbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpsbc5");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpsbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
}
Console.WriteLine("--- Success");
return 100;
}
-
+
try
{
runTest();
}
catch (Exception e)
{
- Console.WriteLine($"Test Failure: {e}");
+ Console.WriteLine($"Test Failure: {e}");
return 101;
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = false)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs5");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
}
static void testLPStrBufferStringBuilder()
{
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb6");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetInvalidStruct()));
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst3");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst5");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
}
static String[] GetValidArray()
static void testLPStrBufferArray()
{
String[] s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba1");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
}
static void testLPStrBufferClass()
{
LPStrTestClass sClass = new LPStrTestClass();
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpsbc1");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpsbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpsbc5");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpsbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
}
static void runTest()
Console.WriteLine("--- Success");
return 100;
}
-
+
try
{
runTest();
}
catch (Exception e)
{
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = true)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tcbs6");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tcbs8");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
StringBuilder sb = GetInvalidStringBuilder();
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(sb), "[Error] Location tlpsbsb1");
+ Assert.True(LPStrBuffer_In_StringBuilder(sb));
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb6");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb7");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb8");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Struct_String(lpss), "[Error] Location tlpsbst1");
+ Assert.True(LPStrBuffer_In_Struct_String(lpss));
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct cTemp = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst3");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetInvalidStruct();
LPStrTestStruct cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst5");
- Assert.AreNotEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbst6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.NotEqual(cTempClone.str, cTemp.str);
cTemp = GetValidStruct();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst7");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbst8");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferClass()
{
LPStrTestClass lpss = new LPStrTestClass();
lpss.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(lpss), "[Error] Location tlpsbc1");
+ Assert.True(LPStrBuffer_In_Class_String(lpss));
lpss.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(lpss), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(lpss));
LPStrTestClass cTemp = new LPStrTestClass();
cTemp.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetInvalidString();
LPStrTestClass cTempClone = new LPStrTestClass();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc5");
- Assert.AreNotEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.NotEqual(cTempClone.str, cTemp.str);
cTemp.str = GetValidString();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc7");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc8");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferArray()
{
String[] lpss = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(lpss), "[Error] Location tlpsba1");
- Assert.IsTrue(LPStrBuffer_In_Array_String(GetValidArray()), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(lpss));
+ Assert.True(LPStrBuffer_In_Array_String(GetValidArray()));
String[] cTemp = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetInvalidArray();
String[] cTempClone = new String[3];
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba5");
- Assert.AreNotEqual(cTempClone[0], cTemp[0], "[Error] Location ttlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.NotEqual(cTempClone[0], cTemp[0]);
cTemp = GetValidArray();
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba7");
- Assert.AreEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba8");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.Equal(cTempClone[0], cTemp[0]);
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
LPStrTestStruct[] lpssClone = new LPStrTestStruct[2];
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
- Assert.AreNotEqual(lpss[0].str, lpssClone[0].str, "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.NotEqual(lpss[0].str, lpssClone[0].str);
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpssClone = new LPStrTestStruct[2];
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos7");
- Assert.AreEqual(lpss[0].str, lpssClone[0].str, "[Error] Location tlpsbaos8");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.Equal(lpss[0].str, lpssClone[0].str);
}
static void runTest()
}
catch (Exception e)
{
- Console.WriteLine($"Test Failure: {e}");
+ Console.WriteLine($"Test Failure: {e}");
return 101;
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = true)]
static void testLPStrBufferString()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs6");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs7");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb6");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb7");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_Struct_String(GetInvalidStruct()));
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct cTemp = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
LPStrTestStruct cTempClone = new LPStrTestStruct();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst6");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbst7");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferClass()
{
LPStrTestClass cTest = new LPStrTestClass();
cTest.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Class_String(cTest), "[Error] Location tlpsbc1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_Class_String(cTest));
cTest.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(cTest), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(cTest));
LPStrTestClass cTemp = new LPStrTestClass();
cTemp.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
LPStrTestClass cTempClone = new LPStrTestClass();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc6");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc7");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferArray()
{
String[] cTest = null;
cTest = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Array_String(cTest), "[Error] Location tlpsba1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_Array_String(cTest));
cTest = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(cTest), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(cTest));
String[] cTemp = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
String[] cTempClone = new String[3];
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba6");
- Assert.AreEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba7");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.Equal(cTempClone[0], cTemp[0]);
}
static void testLPStrBufferArrayOfStructs()
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
LPStrTestStruct[] lpssClone = new LPStrTestStruct[2];
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
- Assert.AreEqual(lpss[0].str, lpssClone[0].str, "[Error] Location tlpsbaos7");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.Equal(lpss[0].str, lpssClone[0].str);
}
static void runTest()
}
catch (Exception e)
{
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = true)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tlpsbs8");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs10");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb6");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb7");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb8");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb9");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb10");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetInvalidStruct()));
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst3");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst5");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
}
static String[] GetValidArray()
static void testLPStrBufferArray()
{
String[] s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba1");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
}
static void testLPStrBufferClass()
{
LPStrTestClass sClass = new LPStrTestClass();
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpsbc1");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpsbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpsbc5");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpsbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
}
static void runTest()
}
catch (Exception e)
{
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = true)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs5");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
}
static void testLPStrBufferStringBuilder()
{
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb6");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
LPStrTestStruct_nothrow lpss_nt = GetInvalidStruct_nothrow();
- Assert.IsTrue(LPStrBuffer_In_Struct_String_nothrow(lpss_nt), "[Error] Location tlpsbst1");
+ Assert.True(LPStrBuffer_In_Struct_String_nothrow(lpss_nt));
lpss_nt = GetValidStruct_nothrow();
- Assert.IsTrue(LPStrBuffer_In_Struct_String_nothrow(lpss_nt), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String_nothrow(lpss_nt));
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Struct_String(lpss), "[Error] Location tlpsbst3");
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_In_Struct_String(lpss));
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst5");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst6");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst7");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst8");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
}
static String[] GetValidArray()
static void testLPStrBufferArray()
{
String[] s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba1");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
}
static void testLPStrBufferClass()
{
LPStrTestClass sClass = new LPStrTestClass();
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpsbc1");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpsbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpsbc5");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpsbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
}
static void runTest()
}
catch (Exception e)
{
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = false)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs5");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs8");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
StringBuilder sb = GetInvalidStringBuilder();
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(sb), "[Error] Location tlpsbsb1");
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(sb));
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb6");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb7");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb8");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Struct_String(lpss), "[Error] Location tlpsbst1");
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(lpss));
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct cTemp = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst3");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetInvalidStruct();
LPStrTestStruct cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst5");
- Assert.AreNotEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbst6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.NotEqual(cTempClone.str, cTemp.str);
cTemp = GetValidStruct();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst7");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbst8");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferClass()
{
LPStrTestClass lpss = new LPStrTestClass();
lpss.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(lpss), "[Error] Location tlpsbc1");
+ Assert.True(LPStrBuffer_In_Class_String(lpss));
lpss.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(lpss), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(lpss));
LPStrTestClass cTemp = new LPStrTestClass();
cTemp.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetInvalidString();
LPStrTestClass cTempClone = new LPStrTestClass();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc5");
- Assert.AreNotEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.NotEqual(cTempClone.str, cTemp.str);
cTemp.str = GetValidString();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc7");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc8");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferArray()
{
String[] lpss = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(lpss), "[Error] Location tlpsba1");
- Assert.IsTrue(LPStrBuffer_In_Array_String(GetValidArray()), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(lpss));
+ Assert.True(LPStrBuffer_In_Array_String(GetValidArray()));
String[] cTemp = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetInvalidArray();
String[] cTempClone = new String[3];
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba5");
- Assert.AreNotEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.NotEqual(cTempClone[0], cTemp[0]);
cTemp = GetValidArray();
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba7");
- Assert.AreEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba8");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.Equal(cTempClone[0], cTemp[0]);
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
LPStrTestStruct[] lpssClone = new LPStrTestStruct[2];
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
- Assert.AreNotEqual(lpss[0].str, lpssClone[0].str, "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.NotEqual(lpss[0].str, lpssClone[0].str);
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpssClone = new LPStrTestStruct[2];
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos7");
- Assert.AreEqual(lpss[0].str, lpssClone[0].str, "[Error] Location tlpsbaos8");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.Equal(lpss[0].str, lpssClone[0].str);
}
static void runTest()
}
catch (Exception e)
{
- Console.WriteLine($"Test Failure: {e}");
+ Console.WriteLine($"Test Failure: {e}");
return 101;
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = false)]
static void testLPStrBufferString()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_String(GetInvalidString()));
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs6");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs7");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb6");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb7");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_Struct_String(GetInvalidStruct()));
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct cTemp = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
LPStrTestStruct cTempClone = new LPStrTestStruct();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst6");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbst7");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferClass()
{
LPStrTestClass cTest = new LPStrTestClass();
cTest.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Class_String(cTest), "[Error] Location tlpsbc1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_Class_String(cTest));
cTest.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(cTest), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(cTest));
LPStrTestClass cTemp = new LPStrTestClass();
cTemp.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
LPStrTestClass cTempClone = new LPStrTestClass();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc6");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc7");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferArray()
{
String[] cTest = null;
cTest = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Array_String(cTest), "[Error] Location tlpsba1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_Array_String(cTest));
cTest = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(cTest), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(cTest));
String[] cTemp = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
String[] cTempClone = new String[3];
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba6");
- Assert.AreEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba7");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.Equal(cTempClone[0], cTemp[0]);
}
static void testLPStrBufferArrayOfStructs()
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
LPStrTestStruct[] lpssClone = new LPStrTestStruct[2];
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
- Assert.AreEqual(lpss[0].str, lpssClone[0].str, "[Error] Location tlpsbaos7");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.Equal(lpss[0].str, lpssClone[0].str);
}
static void runTest()
}
catch (Exception e)
{
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = false)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tlpsbs8");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs10");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb6");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb7");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb8");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb9");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb10");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetInvalidStruct()));
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst3");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst5");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
}
static String[] GetValidArray()
static void testLPStrBufferArray()
{
String[] s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba1");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
}
static void testLPStrBufferClass()
{
LPStrTestClass sClass = new LPStrTestClass();
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpsbc1");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpsbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpsbc5");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpsbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
}
static void runTest()
}
catch (Exception e)
{
- Console.WriteLine($"Test Failure: {e}");
+ Console.WriteLine($"Test Failure: {e}");
return 101;
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = false)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs5");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
}
static void testLPStrBufferStringBuilder()
{
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb6");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
+ Assert.True(LPStrBuffer_In_Struct_String(GetInvalidStruct()));
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst3");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst5");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
}
static String[] GetValidArray()
static void testLPStrBufferArray()
{
String[] s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba1");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
}
static void testLPStrBufferClass()
{
LPStrTestClass sClass = new LPStrTestClass();
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpbc1");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpbc2");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpbc5");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = true)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs5");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
StringBuilder sb = GetInvalidStringBuilder();
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(sb), "[Error] Location tlpsbsb1");
+ Assert.True(LPStrBuffer_In_StringBuilder(sb));
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb6");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb7");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb8");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Struct_String(lpss), "[Error] Location tlpsbst1");
+ Assert.True(LPStrBuffer_In_Struct_String(lpss));
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct cTemp = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst3");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetInvalidStruct();
LPStrTestStruct cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst5");
- Assert.AreNotEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbsqt6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.NotEqual(cTempClone.str, cTemp.str);
cTemp = GetValidStruct();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst7");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbst8");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferClass()
{
LPStrTestClass lpss = new LPStrTestClass();
lpss.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(lpss), "[Error] Location tlpsbc1");
+ Assert.True(LPStrBuffer_In_Class_String(lpss));
lpss.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(lpss), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(lpss));
LPStrTestClass cTemp = new LPStrTestClass();
cTemp.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetInvalidString();
LPStrTestClass cTempClone = new LPStrTestClass();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc5");
- Assert.AreNotEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.NotEqual(cTempClone.str, cTemp.str);
cTemp.str = GetValidString();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc7");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc8");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferArray()
{
String[] lpss = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(lpss), "[Error] Location tlpsba1");
+ Assert.True(LPStrBuffer_In_Array_String(lpss));
- Assert.IsTrue(LPStrBuffer_In_Array_String(GetValidArray()), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(GetValidArray()));
String[] cTemp = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetInvalidArray();
String[] cTempClone = new String[3];
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba5");
- Assert.AreNotEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.NotEqual(cTempClone[0], cTemp[0]);
cTemp = GetValidArray();
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba7");
- Assert.AreEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba8");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.Equal(cTempClone[0], cTemp[0]);
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
LPStrTestStruct[] lpssClone = new LPStrTestStruct[2];
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
- Assert.AreNotEqual(lpssClone[0].str, lpss[0].str, "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.NotEqual(lpssClone[0].str, lpss[0].str);
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpssClone = new LPStrTestStruct[2];
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos7");
- Assert.AreEqual(lpssClone[0].str, lpss[0].str, "[Error] Location tlpsbaos8");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.Equal(lpssClone[0].str, lpss[0].str);
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = true)]
static void testLPStrBufferString()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs5");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs7");
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb6");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb7");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Struct_String(GetInvalidStruct()));
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct cTemp = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst3");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst5");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
LPStrTestStruct cTempClone = new LPStrTestStruct();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst6");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbst7");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferClass()
{
LPStrTestClass cTest = new LPStrTestClass();
cTest.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Class_String(cTest), "[Error] Location tlpsbc1");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Class_String(cTest));
cTest.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(cTest), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(cTest));
LPStrTestClass cTemp = new LPStrTestClass();
cTemp.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc3");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc5");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
LPStrTestClass cTempClone = new LPStrTestClass();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc6");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc7");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferArray()
{
String[] cTest = null;
cTest = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Array_String(cTest), "[Error] Location tlpsba1");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Array_String(cTest));
cTest = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(cTest), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(cTest));
String[] cTemp = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba3");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba5");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
String[] cTempClone = new String[3];
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba6");
- Assert.AreEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba7");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.Equal(cTempClone[0], cTemp[0]);
}
static void testLPStrBufferArrayOfStructs()
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
LPStrTestStruct[] lpssClone = new LPStrTestStruct[2];
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
- Assert.AreEqual(lpss[0].str, lpssClone[0].str, "[Error] Location tlpsbaos7");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.Equal(lpss[0].str, lpssClone[0].str);
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = true)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tlpsbs8");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs10");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb6");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb7");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb8");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb9");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb10");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
+ Assert.True(LPStrBuffer_In_Struct_String(GetInvalidStruct()));
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst3");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst5");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
}
static String[] GetValidArray()
static void testLPStrBufferArray()
{
String[] s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba1");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
}
static void testLPStrBufferClass()
{
LPStrTestClass sClass = new LPStrTestClass();
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpbc1");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpbc2");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpbc5");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = true)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs5");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
}
static void testLPStrBufferStringBuilder()
{
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb6");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
+ Assert.True(LPStrBuffer_In_Struct_String(GetInvalidStruct()));
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst3");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst5");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
}
static String[] GetValidArray()
static void testLPStrBufferArray()
{
String[] s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba1");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
}
static void testLPStrBufferClass()
{
LPStrTestClass sClass = new LPStrTestClass();
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpbc1");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpbc2");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpbc5");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = false)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs5");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs8");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
StringBuilder sb = GetInvalidStringBuilder();
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(sb), "[Error] Location tlpsbsb1");
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(sb));
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb6");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb7");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb8");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Struct_String(lpss), "[Error] Location tlpsbst1");
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(lpss));
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct cTemp = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst3");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetInvalidStruct();
LPStrTestStruct cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst5");
- Assert.AreNotEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbst6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.NotEqual(cTempClone.str, cTemp.str);
cTemp = GetValidStruct();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst7");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbst8");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferClass()
{
LPStrTestClass lpss = new LPStrTestClass();
lpss.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(lpss), "[Error] Location tlpsbc1");
+ Assert.True(LPStrBuffer_In_Class_String(lpss));
lpss.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(lpss), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(lpss));
LPStrTestClass cTemp = new LPStrTestClass();
cTemp.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetInvalidString();
LPStrTestClass cTempClone = new LPStrTestClass();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc5");
- Assert.AreNotEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.NotEqual(cTempClone.str, cTemp.str);
cTemp.str = GetValidString();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc7");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc8");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferArray()
{
String[] lpss = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(lpss), "[Error] Location tlpsba1");
- Assert.IsTrue(LPStrBuffer_In_Array_String(GetValidArray()), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(lpss));
+ Assert.True(LPStrBuffer_In_Array_String(GetValidArray()));
String[] cTemp = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetInvalidArray();
String[] cTempClone = new String[3];
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba5");
- Assert.AreNotEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.NotEqual(cTempClone[0], cTemp[0]);
cTemp = GetValidArray();
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba7");
- Assert.AreEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba8");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.Equal(cTempClone[0], cTemp[0]);
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
LPStrTestStruct[] lpssClone = new LPStrTestStruct[2];
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
- Assert.AreNotEqual(lpss[0].str, lpssClone[0].str, "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.NotEqual(lpss[0].str, lpssClone[0].str);
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpssClone = new LPStrTestStruct[2];
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos7");
- Assert.AreEqual(lpss[0].str, lpssClone[0].str , "[Error] Location tlpsbaos8");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.Equal(lpss[0].str, lpssClone[0].str );
}
static void runTest()
}
catch (Exception e)
{
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(false, ThrowOnUnmappableChar = true)]
static void testLPStrBufferString()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_String(GetInvalidString()));
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs6");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs7");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb6");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString() , "[Error] Location tlpsbsb7");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString() );
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_Struct_String(GetInvalidStruct()));
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct cTemp = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
LPStrTestStruct cTempClone = new LPStrTestStruct();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst6");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbst7");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferClass()
{
LPStrTestClass cTest = new LPStrTestClass();
cTest.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Class_String(cTest), "[Error] Location tlpsbc1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_Class_String(cTest));
cTest.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(cTest), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(cTest));
LPStrTestClass cTemp = new LPStrTestClass();
cTemp.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
LPStrTestClass cTempClone = new LPStrTestClass();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc6");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc7");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferArray()
{
String[] cTest = null;
cTest = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Array_String(cTest), "[Error] Location tlpsba1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_Array_String(cTest));
cTest = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(cTest), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(cTest));
String[] cTemp = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
String[] cTempClone = new String[3];
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba6");
- Assert.AreEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba7");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.Equal(cTempClone[0], cTemp[0]);
}
static void testLPStrBufferArrayOfStructs()
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.Throws<ArgumentException>(()Â =>Â LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
LPStrTestStruct[] lpssClone = new LPStrTestStruct[2];
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
- Assert.AreEqual(lpss[0].str, lpssClone[0].str, "[Error] Location tlpsbaos7");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.Equal(lpss[0].str, lpssClone[0].str);
}
static void runTest()
}
catch (Exception e)
{
- Console.WriteLine($"Test Failure: {e}");
+ Console.WriteLine($"Test Failure: {e}");
return 101;
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = false)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tlpsbs8");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs10");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb6");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb7");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb8");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb9");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb10");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetInvalidStruct()));
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst3");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst5");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
}
static String[] GetValidArray()
static void testLPStrBufferArray()
{
String[] s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba1");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba5");
-
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
+
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
}
static void testLPStrBufferClass()
{
LPStrTestClass sClass = new LPStrTestClass();
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpsbc1");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpsbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpsbc5");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpsbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
}
static void runTest()
}
catch (Exception e)
{
- Console.WriteLine($"Test Failure: {e}");
+ Console.WriteLine($"Test Failure: {e}");
return 101;
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[assembly: BestFitMapping(true, ThrowOnUnmappableChar = true)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs5");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
}
static void testLPStrBufferStringBuilder()
{
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb6");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetInvalidStruct()));
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst3");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst5");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
}
static String[] GetValidArray()
static void testLPStrBufferArray()
{
String[] s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba1");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
}
static void testLPStrBufferClass()
{
LPStrTestClass sClass = new LPStrTestClass();
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpsbc1");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpsbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpsbc5");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpsbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
}
static void runTest()
}
catch (Exception e)
{
- Console.WriteLine($"Test Failure: {e}");
+ Console.WriteLine($"Test Failure: {e}");
return 101;
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[StructLayout(LayoutKind.Sequential)]
[BestFitMapping(false, ThrowOnUnmappableChar = false)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs5");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tlpsbs6");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs7");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs8");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
StringBuilder sb = GetInvalidStringBuilder();
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(sb), "[Error] Location tlpsbsb1");
+ Assert.True(LPStrBuffer_In_StringBuilder(sb));
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb6");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb7");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb8");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Struct_String(lpss), "[Error] Location tlpsbst1");
+ Assert.True(LPStrBuffer_In_Struct_String(lpss));
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct cTemp = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst3");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetInvalidStruct();
LPStrTestStruct cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst5");
- Assert.AreNotEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbst6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.NotEqual(cTempClone.str, cTemp.str);
cTemp = GetValidStruct();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst7");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbst8");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferClass()
{
LPStrTestClass lpss = new LPStrTestClass();
lpss.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(lpss), "[Error] Location tlpsbc1");
+ Assert.True(LPStrBuffer_In_Class_String(lpss));
lpss.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(lpss), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(lpss));
LPStrTestClass cTemp = new LPStrTestClass();
cTemp.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetInvalidString();
LPStrTestClass cTempClone = new LPStrTestClass();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc5");
- Assert.AreNotEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.NotEqual(cTempClone.str, cTemp.str);
cTemp.str = GetValidString();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc7");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc8");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferArray()
{
String[] lpss = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(lpss), "[Error] Location tlpsba1");
+ Assert.True(LPStrBuffer_In_Array_String(lpss));
- Assert.IsTrue(LPStrBuffer_In_Array_String(GetValidArray()), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(GetValidArray()));
String[] cTemp = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetInvalidArray();
String[] cTempClone = new String[3];
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba5");
- Assert.AreNotEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.NotEqual(cTempClone[0], cTemp[0]);
cTemp = GetValidArray();
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba7");
- Assert.AreEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba8");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.Equal(cTempClone[0], cTemp[0]);
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
LPStrTestStruct[] lpssClone = new LPStrTestStruct[2];
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
- Assert.AreNotEqual(lpss[0].str, lpssClone[0].str, "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.NotEqual(lpss[0].str, lpssClone[0].str);
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpssClone = new LPStrTestStruct[2];
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos7");
- Assert.AreEqual(lpss[0].str, lpssClone[0].str, "[Error] Location tlpsbaos8");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.Equal(lpss[0].str, lpssClone[0].str);
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[StructLayout(LayoutKind.Sequential)]
[BestFitMapping(false, ThrowOnUnmappableChar = true)]
static void testLPStrBufferString()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs5");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs6");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs7");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb6");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb7");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
return inValidStruct;
}
-
+
static LPStrTestStruct GetValidStruct()
{
LPStrTestStruct validStruct = new LPStrTestStruct();
static void testLPStrBufferStruct()
{
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Struct_String(GetInvalidStruct()));
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct cTemp = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst3");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst4");
-
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref cTemp));
+
cTemp = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst5");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
cTemp = GetValidStruct();
LPStrTestStruct cTempClone = new LPStrTestStruct();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref cTemp), "[Error] Location tlpsbst6");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbst7");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferClass()
{
LPStrTestClass cTest = new LPStrTestClass();
cTest.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Class_String(cTest), "[Error] Location tlpsbc1");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Class_String(cTest));
cTest.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(cTest), "[Error] Location tlpsbc2");
+ Assert.True(LPStrBuffer_In_Class_String(cTest));
LPStrTestClass cTemp = new LPStrTestClass();
cTemp.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc3");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref cTemp), "[Error] Location tlpsbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref cTemp));
cTemp.str = GetInvalidString();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc5");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Class_String(ref cTemp));
cTemp.str = GetValidString();
LPStrTestClass cTempClone = new LPStrTestClass();
cTempClone.str = cTemp.str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref cTemp), "[Error] Location tlpsbc6");
- Assert.AreEqual(cTempClone.str, cTemp.str, "[Error] Location tlpsbc7");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref cTemp));
+ Assert.Equal(cTempClone.str, cTemp.str);
}
static void testLPStrBufferArray()
{
String[] cTest = null;
cTest = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Array_String(cTest), "[Error] Location tlpsba1");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Array_String(cTest));
cTest = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(cTest), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(cTest));
String[] cTemp = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba3");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref cTemp), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref cTemp));
cTemp = GetInvalidArray();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba5");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Array_String(ref cTemp));
cTemp = GetValidArray();
String[] cTempClone = new String[3];
cTempClone[0] = cTemp[0];
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref cTemp), "[Error] Location tlpsba6");
- Assert.AreEqual(cTempClone[0], cTemp[0], "[Error] Location tlpsba7");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref cTemp));
+ Assert.Equal(cTempClone[0], cTemp[0]);
}
static void testLPStrBufferArrayOfStructs()
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.Throws<ArgumentException>(() => LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
LPStrTestStruct[] lpssClone = new LPStrTestStruct[2];
lpssClone[0].str = lpss[0].str;
lpssClone[1].str = lpss[1].str;
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
- Assert.AreEqual(lpss[0].str, lpssClone[0].str, "[Error] Location tlpsbaos7");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+ Assert.Equal(lpss[0].str, lpssClone[0].str);
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[StructLayout(LayoutKind.Sequential)]
[BestFitMapping(true, ThrowOnUnmappableChar = false)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tlpsbs1");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tlpsbs2");
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs3");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs4");
-
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
+
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tlpsbs5");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs6");
-
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
+
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs7");
- Assert.AreNotEqual(cTempClone, cTemp, "[Error] Location tlpsbs8");
-
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.NotEqual(cTempClone, cTemp);
+
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tlpsbs9");
- Assert.AreEqual(cTempClone, cTemp, "[Error] Location tlpsbs10");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
+ Assert.Equal(cTempClone, cTemp);
}
static void testLPStrBufferStringBuilder()
{
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tlpsbsb1");
-
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tlpsbsb2");
-
+ Assert.True(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
+
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
+
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb3");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb4");
-
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
+
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb5");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb6");
-
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
+
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb7");
- Assert.AreNotEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb8");
-
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.NotEqual(cTempClone.ToString(), cTemp.ToString());
+
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tlpsbsb9");
- Assert.AreEqual(cTempClone.ToString(), cTemp.ToString(), "[Error] Location tlpsbsb10");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
+ Assert.Equal(cTempClone.ToString(), cTemp.ToString());
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
-
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
-
+ Assert.True(LPStrBuffer_In_Struct_String(GetInvalidStruct()));
+
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
+
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst3");
-
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
+
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst4");
-
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
+
lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst5");
-
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
+
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
}
static String[] GetValidArray()
static void testLPStrBufferArray()
{
String[] s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba1");
-
+ Assert.True(LPStrBuffer_In_Array_String(s));
+
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba2");
-
+ Assert.True(LPStrBuffer_In_Array_String(s));
+
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba3");
-
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
+
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba4");
-
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
+
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba5");
-
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
+
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
}
static void testLPStrBufferClass()
{
LPStrTestClass sClass = new LPStrTestClass();
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpsbc1");
-
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
+
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpsbc2");
-
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
+
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpsbc3");
-
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
+
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpsbc4");
-
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
+
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpsbc5");
-
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
+
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpsbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos11");
-
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
+
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
-
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
+
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
-
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
+
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
-
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
+
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
-
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
+
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
[StructLayout(LayoutKind.Sequential)]
[BestFitMapping(true, ThrowOnUnmappableChar = true)]
static void testLPStrBufferString()
{
- Assert.IsTrue(LPStrBuffer_In_String(GetInvalidString()), "[Error] Location tcbs1");
+ Assert.True(LPStrBuffer_In_String(GetInvalidString()));
- Assert.IsTrue(LPStrBuffer_In_String(GetValidString()), "[Error] Location tcbs2");
+ Assert.True(LPStrBuffer_In_String(GetValidString()));
String cTemp = GetInvalidString();
String cTempClone = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs3");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_String(ref cTemp), "[Error] Location tcbs4");
+ Assert.True(LPStrBuffer_InByRef_String(ref cTemp));
cTemp = GetInvalidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs5");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
cTemp = GetValidString();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_String(ref cTemp), "[Error] Location tcbs6");
+ Assert.True(LPStrBuffer_InOutByRef_String(ref cTemp));
}
static void testLPStrBufferStringBuilder()
{
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()), "[Error] Location tcbsb1");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetInvalidStringBuilder()));
- Assert.IsTrue(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()), "[Error] Location tcbsb2");
+ Assert.True(LPStrBuffer_In_StringBuilder(GetValidStringBuilder()));
StringBuilder cTemp = GetInvalidStringBuilder();
StringBuilder cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb3");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb4");
+ Assert.True(LPStrBuffer_InByRef_StringBuilder(ref cTemp));
cTemp = GetInvalidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb5");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
cTemp = GetValidStringBuilder();
cTempClone = cTemp;
- Assert.IsTrue(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp), "[Error] Location tcbsb6");
+ Assert.True(LPStrBuffer_InOutByRef_StringBuilder(ref cTemp));
}
static LPStrTestStruct GetInvalidStruct()
static void testLPStrBufferStruct()
{
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetInvalidStruct()), "[Error] Location tlpsbst1");
+ Assert.True(LPStrBuffer_In_Struct_String(GetInvalidStruct()));
- Assert.IsTrue(LPStrBuffer_In_Struct_String(GetValidStruct()), "[Error] Location tlpsbst2");
+ Assert.True(LPStrBuffer_In_Struct_String(GetValidStruct()));
LPStrTestStruct lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst3");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Struct_String(ref lpss), "[Error] Location tlpsbst4");
+ Assert.True(LPStrBuffer_InByRef_Struct_String(ref lpss));
lpss = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst5");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
lpss = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Struct_String(ref lpss), "[Error] Location tlpsbst6");
+ Assert.True(LPStrBuffer_InOutByRef_Struct_String(ref lpss));
}
static String[] GetValidArray()
static void testLPStrBufferArray()
{
String[] s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba1");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_In_Array_String(s), "[Error] Location tlpsba2");
+ Assert.True(LPStrBuffer_In_Array_String(s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba3");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_String(ref s), "[Error] Location tlpsba4");
+ Assert.True(LPStrBuffer_InByRef_Array_String(ref s));
s = GetInvalidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
s = GetValidArray();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_String(ref s), "[Error] Location tlpsba6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_String(ref s));
}
static void testLPStrBufferClass()
{
LPStrTestClass sClass = new LPStrTestClass();
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpbc1");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_In_Class_String(sClass), "[Error] Location tlpbc2");
+ Assert.True(LPStrBuffer_In_Class_String(sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpbc3");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InByRef_Class_String(ref sClass), "[Error] Location tlpbc4");
+ Assert.True(LPStrBuffer_InByRef_Class_String(ref sClass));
sClass.str = GetInvalidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpbc5");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
sClass.str = GetValidString();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Class_String(ref sClass), "[Error] Location tlpbc6");
+ Assert.True(LPStrBuffer_InOutByRef_Class_String(ref sClass));
}
static void testLPStrBufferArrayOfStructs()
LPStrTestStruct[] lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos1");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_In_Array_Struct(lpss), "[Error] Location tlpsbaos2");
+ Assert.True(LPStrBuffer_In_Array_Struct(lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos3");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos4");
+ Assert.True(LPStrBuffer_InByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetInvalidStruct();
lpss[1] = GetInvalidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos5");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
lpss = new LPStrTestStruct[2];
lpss[0] = GetValidStruct();
lpss[1] = GetValidStruct();
- Assert.IsTrue(LPStrBuffer_InOutByRef_Array_Struct(ref lpss), "[Error] Location tlpsbaos6");
+ Assert.True(LPStrBuffer_InOutByRef_Array_Struct(ref lpss));
}
static void runTest()
runTest();
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
}
// The .NET Foundation licenses this file to you under the MIT license.
using System;
-using TestLibrary;
+using Xunit;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
{
return handle;
}
- set
+ set
{
handle = value;
}
}
-
+
internal static IntPtr GetUniqueHandle()
{
return new IntPtr(s_uniqueHandleValue++);
}
-
+
internal static bool IsHandleClosed(IntPtr handle)
{
return s_closedHandles.Contains(handle.ToInt32());
[DllImport("CriticalHandlesNative", CallingConvention = CallingConvention.StdCall)]
internal static extern IntPtr RefModify(IntPtr handleValue, [MarshalAs(UnmanagedType.LPArray)]ref MyCriticalHandle[] handle);
-
+
[DllImport("CriticalHandlesNative", CallingConvention = CallingConvention.StdCall)]
internal static extern MyCriticalHandle[] Ret(IntPtr handleValue);
public class CriticalHandleArrayTest
{
- private static Native.IsHandleClosed s_isHandleClose = (handleValue) =>
+ private static Native.IsHandleClosed s_isHandleClose = (handleValue) =>
{
GC.Collect();
GC.WaitForPendingFinalizers();
// The .NET Foundation licenses this file to you under the MIT license.
using System;
-using TestLibrary;
+using Xunit;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
{
return handle;
}
- set
+ set
{
handle = value;
}
}
-
+
internal static IntPtr GetUniqueHandle()
{
return new IntPtr(s_uniqueHandleValue++);
}
-
+
internal static bool IsHandleClosed(IntPtr handle)
{
return s_closedHandles.Contains(handle.ToInt32());
{
IntPtr handleValue = new IntPtr(1);
Native.InCallback callback = (handle) => { };
- Assert.Throws<MarshalDirectiveException>(() => Native.InvokeInCallback(callback, handleValue), "Calling P/Invoke that invokes a delegate that has an CriticalHandle parameter");
+ Assert.Throws<MarshalDirectiveException>(() => Native.InvokeInCallback(callback, handleValue));
GC.KeepAlive(callback);
}
{
IntPtr handleValue = new IntPtr(2);
Native.RetCallback callback = () => new MyCriticalHandle();
- Assert.Throws<MarshalDirectiveException>(() => Native.InvokeRetCallback(callback), "Calling P/Invoke that invokes a delegate that returns a CriticalHandle parameter");
+ Assert.Throws<MarshalDirectiveException>(() => Native.InvokeRetCallback(callback));
GC.KeepAlive(callback);
}
{
IntPtr handleValue = new IntPtr(3);
Native.OutCallback callback = (out MyCriticalHandle handle) => handle = null;
- Assert.Throws<MarshalDirectiveException>(() => Native.InvokeOutCallback(callback, ref handleValue), "Calling P/Invoke that invokes a delegate that has an out CriticalHandle parameter");
+ Assert.Throws<MarshalDirectiveException>(() => Native.InvokeOutCallback(callback, ref handleValue));
GC.KeepAlive(callback);
}
{
IntPtr handleValue = new IntPtr(4);
Native.InRefCallback callback = (ref MyCriticalHandle handle) => { };
- Assert.Throws<MarshalDirectiveException>(() => Native.InvokeInRefCallback(callback, ref handleValue), "Calling P/Invoke that invokes a delegate that has an [In] ref CriticalHandle parameter");
+ Assert.Throws<MarshalDirectiveException>(() => Native.InvokeInRefCallback(callback, ref handleValue));
GC.KeepAlive(callback);
}
{
IntPtr handleValue = new IntPtr(5);
Native.RefCallback callback = (ref MyCriticalHandle handle) => { };
- Assert.Throws<MarshalDirectiveException>(() => Native.InvokeRefCallback(callback, ref handleValue), "Calling P/Invoke that invokes a delegate that has an ref CriticalHandle parameter");
+ Assert.Throws<MarshalDirectiveException>(() => Native.InvokeRefCallback(callback, ref handleValue));
GC.KeepAlive(callback);
}
// The .NET Foundation licenses this file to you under the MIT license.
using System;
-using TestLibrary;
+using Xunit;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
{
return handle;
}
- set
+ set
{
handle = value;
}
}
-
+
internal static IntPtr GetUniqueHandle()
{
return new IntPtr(s_uniqueHandleValue++);
}
-
+
internal static bool IsHandleClosed(IntPtr handle)
{
return s_closedHandles.Contains(handle.ToInt32());
public class CriticalHandleStructTest
{
- private static Native.HandleCallback s_handleCallback = (handleValue) =>
+ private static Native.HandleCallback s_handleCallback = (handleValue) =>
{
GC.Collect();
GC.WaitForPendingFinalizers();
InWorker(handleValue);
GC.Collect();
GC.WaitForPendingFinalizers();
- Assert.IsTrue(MyCriticalHandle.IsHandleClosed(handleValue), "Handle was not closed");
+ Assert.True(MyCriticalHandle.IsHandleClosed(handleValue));
}
[MethodImpl(MethodImplOptions.NoInlining)]
Native.MyCriticalHandleStruct handleStruct = new Native.MyCriticalHandleStruct() { Handle = new MyCriticalHandle() { Handle = handleValue } };
IntPtr value;
value = Native.In(handleStruct, s_handleCallback);
- Assert.AreEqual(handleValue.ToInt32(), value.ToInt32(), "Handle value");
+ Assert.Equal(handleValue.ToInt32(), value.ToInt32());
}
public static void Ret()
{
Native.MyCriticalHandleStruct handleStruct;
Native.Out(handleValue, out handleStruct);
- Assert.AreEqual(handleValue.ToInt32(), handleStruct.Handle.Handle.ToInt32(), "Handle value");
+ Assert.Equal(handleValue.ToInt32(), handleStruct.Handle.Handle.ToInt32());
}
public static void InRef()
InRefWorker(handleValue);
GC.Collect();
GC.WaitForPendingFinalizers();
- Assert.IsTrue(MyCriticalHandle.IsHandleClosed(handleValue), "Handle was not closed");
+ Assert.True(MyCriticalHandle.IsHandleClosed(handleValue));
}
[MethodImpl(MethodImplOptions.NoInlining)]
{
Native.MyCriticalHandleStruct handleStruct = new Native.MyCriticalHandleStruct() { Handle = new MyCriticalHandle() { Handle = handleValue } };
Native.InRef(ref handleStruct, s_handleCallback);
- Assert.AreEqual(handleValue.ToInt32(), handleStruct.Handle.Handle.ToInt32(), "Handle value");
+ Assert.Equal(handleValue.ToInt32(), handleStruct.Handle.Handle.ToInt32());
}
public static void Ref()
RefWorker(handleValue);
GC.Collect();
GC.WaitForPendingFinalizers();
- Assert.IsTrue(MyCriticalHandle.IsHandleClosed(handleValue), "Handle was not closed");
+ Assert.True(MyCriticalHandle.IsHandleClosed(handleValue));
}
[MethodImpl(MethodImplOptions.NoInlining)]
{
Native.MyCriticalHandleStruct handleStruct = new Native.MyCriticalHandleStruct() { Handle = new MyCriticalHandle() { Handle = handleValue } };
Native.Ref(ref handleStruct, s_handleCallback);
- Assert.AreEqual(handleValue.ToInt32(), handleStruct.Handle.Handle.ToInt32(), "Handle value");
+ Assert.Equal(handleValue.ToInt32(), handleStruct.Handle.Handle.ToInt32());
}
public static void RefModify()
// The .NET Foundation licenses this file to you under the MIT license.
using System;
-using TestLibrary;
+using Xunit;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
{
return handle;
}
- set
+ set
{
handle = value;
}
}
-
+
internal static IntPtr GetUniqueHandle()
{
return new IntPtr(s_uniqueHandleValue++);
}
-
+
internal static bool IsHandleClosed(IntPtr handle)
{
return s_closedHandles.Contains(handle.ToInt32());
public class CriticalHandleTest
{
- private static Native.HandleCallback s_handleCallback = (handleValue) =>
+ private static Native.HandleCallback s_handleCallback = (handleValue) =>
{
GC.Collect();
GC.WaitForPendingFinalizers();
InWorker(handleValue);
GC.Collect();
GC.WaitForPendingFinalizers();
- Assert.IsTrue(MyCriticalHandle.IsHandleClosed(handleValue), "Handle was not closed");
+ Assert.True(MyCriticalHandle.IsHandleClosed(handleValue));
}
[MethodImpl(MethodImplOptions.NoInlining)]
MyCriticalHandle hande = new MyCriticalHandle() { Handle = handleValue };
IntPtr value;
value = Native.In(hande, s_handleCallback);
- Assert.AreEqual(handleValue.ToInt32(), value.ToInt32(), "Handle value");
+ Assert.Equal(handleValue.ToInt32(), value.ToInt32());
}
public static void Ret()
RetWorker(handleValue);
GC.Collect();
GC.WaitForPendingFinalizers();
- Assert.IsTrue(MyCriticalHandle.IsHandleClosed(handleValue), "Handle was not closed");
+ Assert.True(MyCriticalHandle.IsHandleClosed(handleValue));
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void RetWorker(IntPtr handleValue)
{
MyCriticalHandle hande = Native.Ret(handleValue);
- Assert.AreEqual(handleValue.ToInt32(), hande.Handle.ToInt32(), "Handle value");
+ Assert.Equal(handleValue.ToInt32(), hande.Handle.ToInt32());
}
public static void Out()
OutWorker(handleValue);
GC.Collect();
GC.WaitForPendingFinalizers();
- Assert.IsTrue(MyCriticalHandle.IsHandleClosed(handleValue), "Handle was not closed");
+ Assert.True(MyCriticalHandle.IsHandleClosed(handleValue));
}
[MethodImpl(MethodImplOptions.NoInlining)]
{
MyCriticalHandle hande;
Native.Out(handleValue, out hande);
- Assert.AreEqual(handleValue.ToInt32(), hande.Handle.ToInt32(), "Handle value");
+ Assert.Equal(handleValue.ToInt32(), hande.Handle.ToInt32());
}
public static void InRef()
InRefWorker(handleValue);
GC.Collect();
GC.WaitForPendingFinalizers();
- Assert.IsTrue(MyCriticalHandle.IsHandleClosed(handleValue), "Handle was not closed");
+ Assert.True(MyCriticalHandle.IsHandleClosed(handleValue));
}
[MethodImpl(MethodImplOptions.NoInlining)]
{
MyCriticalHandle hande = new MyCriticalHandle() { Handle = handleValue };
Native.InRef(ref hande, s_handleCallback);
- Assert.AreEqual(handleValue.ToInt32(), hande.Handle.ToInt32(), "Handle value");
+ Assert.Equal(handleValue.ToInt32(), hande.Handle.ToInt32());
}
public static void Ref()
RefWorker(handleValue);
GC.Collect();
GC.WaitForPendingFinalizers();
- Assert.IsTrue(MyCriticalHandle.IsHandleClosed(handleValue), "Handle was not closed");
+ Assert.True(MyCriticalHandle.IsHandleClosed(handleValue));
}
[MethodImpl(MethodImplOptions.NoInlining)]
{
MyCriticalHandle hande = new MyCriticalHandle() { Handle = handleValue };
Native.Ref(ref hande, s_handleCallback);
- Assert.AreEqual(handleValue.ToInt32(), hande.Handle.ToInt32(), "Handle value");
+ Assert.Equal(handleValue.ToInt32(), hande.Handle.ToInt32());
}
public static void RefModify()
RefModifyWorker(handleValue1, handleValue2);
GC.Collect();
GC.WaitForPendingFinalizers();
- Assert.IsTrue(MyCriticalHandle.IsHandleClosed(handleValue1), "Handle 1 was not closed");
- Assert.IsTrue(MyCriticalHandle.IsHandleClosed(handleValue2), "Handle 2 was not closed");
+ Assert.True(MyCriticalHandle.IsHandleClosed(handleValue1));
+ Assert.True(MyCriticalHandle.IsHandleClosed(handleValue2));
}
[MethodImpl(MethodImplOptions.NoInlining)]
{
MyCriticalHandle hande = new MyCriticalHandle() { Handle = handleValue1 };
Native.RefModify(handleValue2, ref hande, s_handleCallback);
- Assert.AreEqual(handleValue2.ToInt32(), hande.Handle.ToInt32(), "Handle value");
+ Assert.Equal(handleValue2.ToInt32(), hande.Handle.ToInt32());
}
internal class Native
AbstractCriticalHandle handle = new CriticalHandleWithNoDefaultCtor(handleValue);
IntPtr value;
value = Native.In(handle, null);
- Assert.AreEqual(handleValue.ToInt32(), value.ToInt32(), "Handle value");
+ Assert.Equal(handleValue.ToInt32(), value.ToInt32());
}
public static void Ret()
{
IntPtr handleValue = new IntPtr(2);
- Assert.Throws<MarshalDirectiveException>(() => Native.Ret(handleValue), "Calling P/Invoke that returns an abstract critical handle");
+ Assert.Throws<MarshalDirectiveException>(() => Native.Ret(handleValue));
}
public static void Out()
{
IntPtr handleValue = new IntPtr(3);
AbstractCriticalHandle handle;
- Assert.Throws<MarshalDirectiveException>(() => Native.Out(handleValue, out handle), "Calling P/Invoke that has an out abstract critical handle parameter");
+ Assert.Throws<MarshalDirectiveException>(() => Native.Out(handleValue, out handle));
}
public static void InRef()
IntPtr handleValue = new IntPtr(4);
AbstractCriticalHandle handle = new CriticalHandleWithNoDefaultCtor(handleValue);
Native.InRef(ref handle, null);
- Assert.AreEqual(handleValue.ToInt32(), handle.Handle.ToInt32(), "Handle value");
+ Assert.Equal(handleValue.ToInt32(), handle.Handle.ToInt32());
}
public static void Ref()
{
IntPtr handleValue = new IntPtr(5);
AbstractCriticalHandle handle = new CriticalHandleWithNoDefaultCtor(handleValue);
- Assert.Throws<MarshalDirectiveException>(() => Native.Ref(ref handle, null), "Calling P/Invoke that has a ref abstract critical handle parameter");
+ Assert.Throws<MarshalDirectiveException>(() => Native.Ref(ref handle, null));
}
internal class Native
CriticalHandleWithNoDefaultCtor handle = new CriticalHandleWithNoDefaultCtor(handleValue);
IntPtr value;
value = Native.In(handle, null);
- Assert.AreEqual(handleValue.ToInt32(), value.ToInt32(), "Handle value");
+ Assert.Equal(handleValue.ToInt32(), value.ToInt32());
}
public static void Ret()
{
IntPtr handleValue = new IntPtr(2);
//TODO: Expected MissingMemberException but throws MissingMethodException
- Assert.Throws<MissingMethodException>(() => Native.Ret(handleValue), "Calling P/Invoke that returns an no default ctor critical handle");
+ Assert.Throws<MissingMethodException>(() => Native.Ret(handleValue));
}
public static void Out()
IntPtr handleValue = new IntPtr(3);
CriticalHandleWithNoDefaultCtor handle;
//TODO: Expected MissingMemberException but throws MissingMethodException
- Assert.Throws<MissingMethodException>(() => Native.Out(handleValue, out handle), "Calling P/Invoke that has an out no default ctor critical handle parameter");
+ Assert.Throws<MissingMethodException>(() => Native.Out(handleValue, out handle));
}
public static void InRef()
IntPtr handleValue = new IntPtr(4);
CriticalHandleWithNoDefaultCtor handle = new CriticalHandleWithNoDefaultCtor(handleValue);
//TODO: Expected MissingMemberException but throws MissingMethodException
- Assert.Throws<MissingMethodException>(() => Native.InRef(ref handle, null), "Calling P/Invoke that has a [In] ref no default ctor critical handle parameter");
+ Assert.Throws<MissingMethodException>(() => Native.InRef(ref handle, null));
}
public static void Ref()
IntPtr handleValue = new IntPtr(5);
CriticalHandleWithNoDefaultCtor handle = new CriticalHandleWithNoDefaultCtor(handleValue);
//TODO: Expected MissingMemberException but throws MissingMethodException
- Assert.Throws<MissingMethodException>(() => Native.Ref(ref handle, null), "Calling P/Invoke that has a ref no default ctor critical handle parameter");
+ Assert.Throws<MissingMethodException>(() => Native.Ref(ref handle, null));
}
internal class Native
using System.Globalization;
using System.Reflection;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
namespace PInvokeTests
{
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public struct DateWrapper
{
{
DateTime currentDate = new DateTime(2019, 5, 2);
- Assert.AreEqual(currentDate.AddDays(1), NativeDateTime.GetTomorrow(currentDate));
+ Assert.Equal(currentDate.AddDays(1), NativeDateTime.GetTomorrow(currentDate));
NativeDateTime.GetTomorrowByRef(currentDate, out DateTime nextDay);
-
- Assert.AreEqual(currentDate.AddDays(1), nextDay);
+
+ Assert.Equal(currentDate.AddDays(1), nextDay);
DateWrapper wrapper = new DateWrapper { date = currentDate };
- Assert.AreEqual(currentDate.AddDays(1), NativeDateTime.GetTomorrowWrapped(wrapper).date);
+ Assert.Equal(currentDate.AddDays(1), NativeDateTime.GetTomorrowWrapped(wrapper).date);
}
catch (Exception e)
{
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
return 100;
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public class DecimalTest
{
private static void RunDecimalTests()
{
- Assert.AreEqual((decimal)StartingIntValue, DecimalTestNative.CreateDecimalFromInt(StartingIntValue));
+ Assert.Equal((decimal)StartingIntValue, DecimalTestNative.CreateDecimalFromInt(StartingIntValue));
- Assert.IsTrue(DecimalTestNative.DecimalEqualToInt((decimal)StartingIntValue, StartingIntValue));
+ Assert.True(DecimalTestNative.DecimalEqualToInt((decimal)StartingIntValue, StartingIntValue));
decimal localDecimal = (decimal)StartingIntValue;
- Assert.IsTrue(DecimalTestNative.ValidateAndChangeDecimal(ref localDecimal, StartingIntValue, NewIntValue));
- Assert.AreEqual((decimal)NewIntValue, localDecimal);
+ Assert.True(DecimalTestNative.ValidateAndChangeDecimal(ref localDecimal, StartingIntValue, NewIntValue));
+ Assert.Equal((decimal)NewIntValue, localDecimal);
DecimalTestNative.GetDecimalForInt(NewIntValue, out var dec);
- Assert.AreEqual((decimal)NewIntValue, dec);
-
- Assert.AreEqual((decimal)StartingIntValue, DecimalTestNative.CreateWrappedDecimalFromInt(StartingIntValue).dec);
+ Assert.Equal((decimal)NewIntValue, dec);
- Assert.IsTrue(DecimalTestNative.WrappedDecimalEqualToInt(new DecimalTestNative.DecimalWrapper { dec = (decimal)StartingIntValue }, StartingIntValue));
+ Assert.Equal((decimal)StartingIntValue, DecimalTestNative.CreateWrappedDecimalFromInt(StartingIntValue).dec);
+
+ Assert.True(DecimalTestNative.WrappedDecimalEqualToInt(new DecimalTestNative.DecimalWrapper { dec = (decimal)StartingIntValue }, StartingIntValue));
var localDecimalWrapper = new DecimalTestNative.DecimalWrapper { dec = (decimal)StartingIntValue };
- Assert.IsTrue(DecimalTestNative.ValidateAndChangeWrappedDecimal(ref localDecimalWrapper, StartingIntValue, NewIntValue));
- Assert.AreEqual((decimal)NewIntValue, localDecimalWrapper.dec);
+ Assert.True(DecimalTestNative.ValidateAndChangeWrappedDecimal(ref localDecimalWrapper, StartingIntValue, NewIntValue));
+ Assert.Equal((decimal)NewIntValue, localDecimalWrapper.dec);
DecimalTestNative.GetWrappedDecimalForInt(NewIntValue, out var decWrapper);
- Assert.AreEqual((decimal)NewIntValue, decWrapper.dec);
+ Assert.Equal((decimal)NewIntValue, decWrapper.dec);
- DecimalTestNative.PassThroughDecimalToCallback((decimal)NewIntValue, d => Assert.AreEqual((decimal)NewIntValue, d));
+ DecimalTestNative.PassThroughDecimalToCallback((decimal)NewIntValue, d => Assert.Equal((decimal)NewIntValue, d));
}
private static void RunLPDecimalTests()
{
- Assert.AreEqual((decimal)StartingIntValue, DecimalTestNative.CreateLPDecimalFromInt(StartingIntValue));
+ Assert.Equal((decimal)StartingIntValue, DecimalTestNative.CreateLPDecimalFromInt(StartingIntValue));
- Assert.IsTrue(DecimalTestNative.LPDecimalEqualToInt((decimal)StartingIntValue, StartingIntValue));
+ Assert.True(DecimalTestNative.LPDecimalEqualToInt((decimal)StartingIntValue, StartingIntValue));
decimal localDecimal = (decimal)StartingIntValue;
- Assert.IsTrue(DecimalTestNative.ValidateAndChangeLPDecimal(ref localDecimal, StartingIntValue, NewIntValue));
- Assert.AreEqual((decimal)NewIntValue, localDecimal);
+ Assert.True(DecimalTestNative.ValidateAndChangeLPDecimal(ref localDecimal, StartingIntValue, NewIntValue));
+ Assert.Equal((decimal)NewIntValue, localDecimal);
DecimalTestNative.GetLPDecimalForInt(NewIntValue, out var dec);
- Assert.AreEqual((decimal)NewIntValue, dec);
+ Assert.Equal((decimal)NewIntValue, dec);
- DecimalTestNative.PassThroughLPDecimalToCallback((decimal)NewIntValue, d => Assert.AreEqual((decimal)NewIntValue, d));
+ DecimalTestNative.PassThroughLPDecimalToCallback((decimal)NewIntValue, d => Assert.Equal((decimal)NewIntValue, d));
}
private static void RunCurrencyTests()
- {
+ {
Assert.Throws<MarshalDirectiveException>(() => DecimalTestNative.CreateCurrencyFromInt(StartingIntValue));
- Assert.IsTrue(DecimalTestNative.CurrencyEqualToInt((decimal)StartingIntValue, StartingIntValue));
+ Assert.True(DecimalTestNative.CurrencyEqualToInt((decimal)StartingIntValue, StartingIntValue));
decimal localCurrency = (decimal)StartingIntValue;
- Assert.IsTrue(DecimalTestNative.ValidateAndChangeCurrency(ref localCurrency, StartingIntValue, NewIntValue));
- Assert.AreEqual((decimal)NewIntValue, localCurrency);
+ Assert.True(DecimalTestNative.ValidateAndChangeCurrency(ref localCurrency, StartingIntValue, NewIntValue));
+ Assert.Equal((decimal)NewIntValue, localCurrency);
DecimalTestNative.GetCurrencyForInt(NewIntValue, out var cy);
- Assert.AreEqual((decimal)NewIntValue, cy);
-
- Assert.AreEqual((decimal)StartingIntValue, DecimalTestNative.CreateWrappedCurrencyFromInt(StartingIntValue).currency);
+ Assert.Equal((decimal)NewIntValue, cy);
- Assert.IsTrue(DecimalTestNative.WrappedCurrencyEqualToInt(new DecimalTestNative.CurrencyWrapper { currency = (decimal)StartingIntValue }, StartingIntValue));
+ Assert.Equal((decimal)StartingIntValue, DecimalTestNative.CreateWrappedCurrencyFromInt(StartingIntValue).currency);
+
+ Assert.True(DecimalTestNative.WrappedCurrencyEqualToInt(new DecimalTestNative.CurrencyWrapper { currency = (decimal)StartingIntValue }, StartingIntValue));
var localCurrencyWrapper = new DecimalTestNative.CurrencyWrapper { currency = (decimal)StartingIntValue };
- Assert.IsTrue(DecimalTestNative.ValidateAndChangeWrappedCurrency(ref localCurrencyWrapper, StartingIntValue, NewIntValue));
- Assert.AreEqual((decimal)NewIntValue, localCurrencyWrapper.currency);
+ Assert.True(DecimalTestNative.ValidateAndChangeWrappedCurrency(ref localCurrencyWrapper, StartingIntValue, NewIntValue));
+ Assert.Equal((decimal)NewIntValue, localCurrencyWrapper.currency);
DecimalTestNative.GetWrappedCurrencyForInt(NewIntValue, out var currencyWrapper);
- Assert.AreEqual((decimal)NewIntValue, currencyWrapper.currency);
-
- DecimalTestNative.PassThroughCurrencyToCallback((decimal)NewIntValue, d => Assert.AreEqual((decimal)NewIntValue, d));
+ Assert.Equal((decimal)NewIntValue, currencyWrapper.currency);
+
+ DecimalTestNative.PassThroughCurrencyToCallback((decimal)NewIntValue, d => Assert.Equal((decimal)NewIntValue, d));
}
}
using System;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
using static DelegateTestNative;
int expectedValue = 987654;
int TestFunction() => expectedValue;
- Assert.IsTrue(ValidateDelegateReturnsExpected(expectedValue, TestFunction));
-
+ Assert.True(ValidateDelegateReturnsExpected(expectedValue, TestFunction));
+
{
TestDelegate localDelegate = TestFunction;
- Assert.IsTrue(ReplaceDelegate(expectedValue, ref localDelegate, out int newExpectedValue));
- Assert.AreEqual(newExpectedValue, localDelegate());
+ Assert.True(ReplaceDelegate(expectedValue, ref localDelegate, out int newExpectedValue));
+ Assert.Equal(newExpectedValue, localDelegate());
}
{
GetNativeTestFunction(out TestDelegate test, out int value);
- Assert.AreEqual(value, test());
+ Assert.Equal(value, test());
}
{
var returned = GetNativeTestFunctionReturned(out int value);
- Assert.AreEqual(value, returned());
+ Assert.Equal(value, returned());
}
{
del = TestFunction
};
- Assert.IsTrue(ValidateCallbackWithValue(cb));
+ Assert.True(ValidateCallbackWithValue(cb));
}
{
del = TestFunction
};
- Assert.IsTrue(ValidateAndUpdateCallbackWithValue(ref cb));
- Assert.AreEqual(cb.expectedValue, cb.del());
+ Assert.True(ValidateAndUpdateCallbackWithValue(ref cb));
+ Assert.Equal(cb.expectedValue, cb.del());
}
{
GetNativeCallbackAndValue(out CallbackWithExpectedValue cb);
- Assert.AreEqual(cb.expectedValue, cb.del());
+ Assert.Equal(cb.expectedValue, cb.del());
}
}
int expectedValue = 987654;
int TestFunction() => expectedValue;
- Assert.IsTrue(ValidateDelegateValueMatchesExpected(expectedValue, TestFunction));
-
+ Assert.True(ValidateDelegateValueMatchesExpected(expectedValue, TestFunction));
+
{
TestDelegate localDelegate = TestFunction;
- Assert.IsTrue(ValidateDelegateValueMatchesExpectedAndClear(expectedValue, ref localDelegate));
- Assert.AreEqual(null, localDelegate);
+ Assert.True(ValidateDelegateValueMatchesExpectedAndClear(expectedValue, ref localDelegate));
+ Assert.Equal(null, localDelegate);
}
{
TestDelegate localDelegate = TestFunction;
- Assert.IsTrue(DuplicateDelegate(expectedValue, localDelegate, out var outDelegate));
- Assert.AreEqual(localDelegate, outDelegate);
+ Assert.True(DuplicateDelegate(expectedValue, localDelegate, out var outDelegate));
+ Assert.Equal(localDelegate, outDelegate);
}
{
TestDelegate localDelegate = TestFunction;
- Assert.AreEqual(localDelegate, DuplicateDelegateReturned(localDelegate));
+ Assert.Equal(localDelegate, DuplicateDelegateReturned(localDelegate));
}
{
del = TestFunction
};
- Assert.IsTrue(ValidateStructDelegateValueMatchesExpected(cb));
+ Assert.True(ValidateStructDelegateValueMatchesExpected(cb));
}
{
del = TestFunction
};
- Assert.IsTrue(ValidateDelegateValueMatchesExpectedAndClearStruct(ref cb));
- Assert.AreEqual(null, cb.del);
+ Assert.True(ValidateDelegateValueMatchesExpectedAndClearStruct(ref cb));
+ Assert.Equal(null, cb.del);
}
{
del = TestFunction
};
- Assert.IsTrue(DuplicateStruct(cb, out var cbOut));
- Assert.AreEqual(cbOut.expectedValue, cbOut.del());
+ Assert.True(DuplicateStruct(cb, out var cbOut));
+ Assert.Equal(cbOut.expectedValue, cbOut.del());
}
Assert.Throws<MarshalDirectiveException>(() => MarshalDelegateAsInterface(TestFunction));
}
catch (Exception e)
{
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
return 100;
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
private static void TestPoint1D()
{
GenericsNative.Point1<double> value = GenericsNative.GetPoint1D(1.0);
- Assert.AreEqual(value.e00, 1.0);
+ Assert.Equal(value.e00, 1.0);
GenericsNative.Point1<double> value2;
GenericsNative.GetPoint1DOut(1.0, &value2);
- Assert.AreEqual(value2.e00, 1.0);
+ Assert.Equal(value2.e00, 1.0);
GenericsNative.GetPoint1DOut(1.0, out GenericsNative.Point1<double> value3);
- Assert.AreEqual(value3.e00, 1.0);
+ Assert.Equal(value3.e00, 1.0);
GenericsNative.Point1<double>* value4 = GenericsNative.GetPoint1DPtr(1.0);
- Assert.AreEqual(value4->e00, 1.0);
+ Assert.Equal(value4->e00, 1.0);
ref readonly GenericsNative.Point1<double> value5 = ref GenericsNative.GetPoint1DRef(1.0);
- Assert.AreEqual(value5.e00, 1.0);
+ Assert.Equal(value5.e00, 1.0);
GenericsNative.Point1<double> result = GenericsNative.AddPoint1D(value, value);
- Assert.AreEqual(result.e00, 2.0);
+ Assert.Equal(result.e00, 2.0);
GenericsNative.Point1<double>[] values = new GenericsNative.Point1<double>[] {
value,
fixed (GenericsNative.Point1<double>* pValues = &values[0])
{
GenericsNative.Point1<double> result2 = GenericsNative.AddPoint1Ds(pValues, values.Length);
- Assert.AreEqual(result2.e00, 5.0);
+ Assert.Equal(result2.e00, 5.0);
}
GenericsNative.Point1<double> result3 = GenericsNative.AddPoint1Ds(values, values.Length);
- Assert.AreEqual(result3.e00, 5.0);
+ Assert.Equal(result3.e00, 5.0);
GenericsNative.Point1<double> result4 = GenericsNative.AddPoint1Ds(in values[0], values.Length);
- Assert.AreEqual(result4.e00, 5.0);
+ Assert.Equal(result4.e00, 5.0);
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
private static void TestPoint1F()
{
GenericsNative.Point1<float> value = GenericsNative.GetPoint1F(1.0f);
- Assert.AreEqual(value.e00, 1.0f);
+ Assert.Equal(value.e00, 1.0f);
GenericsNative.Point1<float> value2;
GenericsNative.GetPoint1FOut(1.0f, &value2);
- Assert.AreEqual(value2.e00, 1.0f);
+ Assert.Equal(value2.e00, 1.0f);
GenericsNative.GetPoint1FOut(1.0f, out GenericsNative.Point1<float> value3);
- Assert.AreEqual(value3.e00, 1.0f);
+ Assert.Equal(value3.e00, 1.0f);
GenericsNative.Point1<float>* value4 = GenericsNative.GetPoint1FPtr(1.0f);
- Assert.AreEqual(value4->e00, 1.0f);
+ Assert.Equal(value4->e00, 1.0f);
ref readonly GenericsNative.Point1<float> value5 = ref GenericsNative.GetPoint1FRef(1.0f);
- Assert.AreEqual(value5.e00, 1.0f);
+ Assert.Equal(value5.e00, 1.0f);
GenericsNative.Point1<float> result = GenericsNative.AddPoint1F(value, value);
- Assert.AreEqual(result.e00, 2.0f);
+ Assert.Equal(result.e00, 2.0f);
GenericsNative.Point1<float>[] values = new GenericsNative.Point1<float>[] {
value,
fixed (GenericsNative.Point1<float>* pValues = &values[0])
{
GenericsNative.Point1<float> result2 = GenericsNative.AddPoint1Fs(pValues, values.Length);
- Assert.AreEqual(result2.e00, 5.0f);
+ Assert.Equal(result2.e00, 5.0f);
}
GenericsNative.Point1<float> result3 = GenericsNative.AddPoint1Fs(values, values.Length);
- Assert.AreEqual(result3.e00, 5.0f);
+ Assert.Equal(result3.e00, 5.0f);
GenericsNative.Point1<float> result4 = GenericsNative.AddPoint1Fs(in values[0], values.Length);
- Assert.AreEqual(result4.e00, 5.0f);
+ Assert.Equal(result4.e00, 5.0f);
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
private static void TestPoint1L()
{
GenericsNative.Point1<long> value = GenericsNative.GetPoint1L(1L);
- Assert.AreEqual(value.e00, 1L);
+ Assert.Equal(value.e00, 1L);
GenericsNative.Point1<long> value2;
GenericsNative.GetPoint1LOut(1L, &value2);
- Assert.AreEqual(value2.e00, 1L);
+ Assert.Equal(value2.e00, 1L);
GenericsNative.GetPoint1LOut(1L, out GenericsNative.Point1<long> value3);
- Assert.AreEqual(value3.e00, 1L);
+ Assert.Equal(value3.e00, 1L);
GenericsNative.Point1<long>* value4 = GenericsNative.GetPoint1LPtr(1L);
- Assert.AreEqual(value4->e00, 1L);
+ Assert.Equal(value4->e00, 1L);
ref readonly GenericsNative.Point1<long> value5 = ref GenericsNative.GetPoint1LRef(1L);
- Assert.AreEqual(value5.e00, 1L);
+ Assert.Equal(value5.e00, 1L);
GenericsNative.Point1<long> result = GenericsNative.AddPoint1L(value, value);
- Assert.AreEqual(result.e00, 2L);
+ Assert.Equal(result.e00, 2L);
GenericsNative.Point1<long>[] values = new GenericsNative.Point1<long>[] {
value,
fixed (GenericsNative.Point1<long>* pValues = &values[0])
{
GenericsNative.Point1<long> result2 = GenericsNative.AddPoint1Ls(pValues, values.Length);
- Assert.AreEqual(result2.e00, 5l);
+ Assert.Equal(result2.e00, 5l);
}
GenericsNative.Point1<long> result3 = GenericsNative.AddPoint1Ls(values, values.Length);
- Assert.AreEqual(result3.e00, 5l);
+ Assert.Equal(result3.e00, 5l);
GenericsNative.Point1<long> result4 = GenericsNative.AddPoint1Ls(in values[0], values.Length);
- Assert.AreEqual(result4.e00, 5l);
+ Assert.Equal(result4.e00, 5l);
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
private static void TestPoint1U()
{
GenericsNative.Point1<uint> value = GenericsNative.GetPoint1U(1u);
- Assert.AreEqual(value.e00, 1u);
+ Assert.Equal(value.e00, 1u);
GenericsNative.Point1<uint> value2;
GenericsNative.GetPoint1UOut(1u, &value2);
- Assert.AreEqual(value2.e00, 1u);
+ Assert.Equal(value2.e00, 1u);
GenericsNative.GetPoint1UOut(1u, out GenericsNative.Point1<uint> value3);
- Assert.AreEqual(value3.e00, 1u);
+ Assert.Equal(value3.e00, 1u);
GenericsNative.Point1<uint>* value4 = GenericsNative.GetPoint1UPtr(1u);
- Assert.AreEqual(value4->e00, 1u);
+ Assert.Equal(value4->e00, 1u);
ref readonly GenericsNative.Point1<uint> value5 = ref GenericsNative.GetPoint1URef(1u);
- Assert.AreEqual(value5.e00, 1u);
+ Assert.Equal(value5.e00, 1u);
GenericsNative.Point1<uint> result = GenericsNative.AddPoint1U(value, value);
- Assert.AreEqual(result.e00, 2u);
+ Assert.Equal(result.e00, 2u);
GenericsNative.Point1<uint>[] values = new GenericsNative.Point1<uint>[] {
value,
fixed (GenericsNative.Point1<uint>* pValues = &values[0])
{
GenericsNative.Point1<uint> result2 = GenericsNative.AddPoint1Us(pValues, values.Length);
- Assert.AreEqual(result2.e00, 5u);
+ Assert.Equal(result2.e00, 5u);
}
GenericsNative.Point1<uint> result3 = GenericsNative.AddPoint1Us(values, values.Length);
- Assert.AreEqual(result3.e00, 5u);
+ Assert.Equal(result3.e00, 5u);
GenericsNative.Point1<uint> result4 = GenericsNative.AddPoint1Us(in values[0], values.Length);
- Assert.AreEqual(result4.e00, 5u);
+ Assert.Equal(result4.e00, 5u);
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
private static void TestPoint2D()
{
GenericsNative.Point2<double> value = GenericsNative.GetPoint2D(1.0, 2.0);
- Assert.AreEqual(value.e00, 1.0);
- Assert.AreEqual(value.e01, 2.0);
+ Assert.Equal(value.e00, 1.0);
+ Assert.Equal(value.e01, 2.0);
GenericsNative.Point2<double> value2;
GenericsNative.GetPoint2DOut(1.0, 2.0, &value2);
- Assert.AreEqual(value2.e00, 1.0);
- Assert.AreEqual(value2.e01, 2.0);
+ Assert.Equal(value2.e00, 1.0);
+ Assert.Equal(value2.e01, 2.0);
GenericsNative.GetPoint2DOut(1.0, 2.0, out GenericsNative.Point2<double> value3);
- Assert.AreEqual(value3.e00, 1.0);
- Assert.AreEqual(value3.e01, 2.0);
+ Assert.Equal(value3.e00, 1.0);
+ Assert.Equal(value3.e01, 2.0);
GenericsNative.Point2<double>* value4 = GenericsNative.GetPoint2DPtr(1.0, 2.0);
- Assert.AreEqual(value4->e00, 1.0);
- Assert.AreEqual(value4->e01, 2.0);
+ Assert.Equal(value4->e00, 1.0);
+ Assert.Equal(value4->e01, 2.0);
ref readonly GenericsNative.Point2<double> value5 = ref GenericsNative.GetPoint2DRef(1.0, 2.0);
- Assert.AreEqual(value5.e00, 1.0);
- Assert.AreEqual(value5.e01, 2.0);
+ Assert.Equal(value5.e00, 1.0);
+ Assert.Equal(value5.e01, 2.0);
GenericsNative.Point2<double> result = GenericsNative.AddPoint2D(value, value);
- Assert.AreEqual(result.e00, 2.0);
- Assert.AreEqual(result.e01, 4.0);
+ Assert.Equal(result.e00, 2.0);
+ Assert.Equal(result.e01, 4.0);
GenericsNative.Point2<double>[] values = new GenericsNative.Point2<double>[] {
value,
fixed (GenericsNative.Point2<double>* pValues = &values[0])
{
GenericsNative.Point2<double> result2 = GenericsNative.AddPoint2Ds(pValues, values.Length);
- Assert.AreEqual(result2.e00, 5.0);
- Assert.AreEqual(result2.e01, 10.0);
+ Assert.Equal(result2.e00, 5.0);
+ Assert.Equal(result2.e01, 10.0);
}
GenericsNative.Point2<double> result3 = GenericsNative.AddPoint2Ds(values, values.Length);
- Assert.AreEqual(result3.e00, 5.0);
- Assert.AreEqual(result3.e01, 10.0);
+ Assert.Equal(result3.e00, 5.0);
+ Assert.Equal(result3.e01, 10.0);
GenericsNative.Point2<double> result4 = GenericsNative.AddPoint2Ds(in values[0], values.Length);
- Assert.AreEqual(result4.e00, 5.0);
- Assert.AreEqual(result4.e01, 10.0);
+ Assert.Equal(result4.e00, 5.0);
+ Assert.Equal(result4.e01, 10.0);
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
private static void TestPoint2F()
{
GenericsNative.Point2<float> value = GenericsNative.GetPoint2F(1.0f, 2.0f);
- Assert.AreEqual(value.e00, 1.0f);
- Assert.AreEqual(value.e01, 2.0f);
+ Assert.Equal(value.e00, 1.0f);
+ Assert.Equal(value.e01, 2.0f);
GenericsNative.Point2<float> value2;
GenericsNative.GetPoint2FOut(1.0f, 2.0f, &value2);
- Assert.AreEqual(value2.e00, 1.0f);
- Assert.AreEqual(value2.e01, 2.0f);
+ Assert.Equal(value2.e00, 1.0f);
+ Assert.Equal(value2.e01, 2.0f);
GenericsNative.GetPoint2FOut(1.0f, 2.0f, out GenericsNative.Point2<float> value3);
- Assert.AreEqual(value3.e00, 1.0f);
- Assert.AreEqual(value3.e01, 2.0f);
+ Assert.Equal(value3.e00, 1.0f);
+ Assert.Equal(value3.e01, 2.0f);
GenericsNative.Point2<float>* value4 = GenericsNative.GetPoint2FPtr(1.0f, 2.0f);
- Assert.AreEqual(value4->e00, 1.0f);
- Assert.AreEqual(value4->e01, 2.0f);
+ Assert.Equal(value4->e00, 1.0f);
+ Assert.Equal(value4->e01, 2.0f);
ref readonly GenericsNative.Point2<float> value5 = ref GenericsNative.GetPoint2FRef(1.0f, 2.0f);
- Assert.AreEqual(value5.e00, 1.0f);
- Assert.AreEqual(value5.e01, 2.0f);
+ Assert.Equal(value5.e00, 1.0f);
+ Assert.Equal(value5.e01, 2.0f);
GenericsNative.Point2<float> result = GenericsNative.AddPoint2F(value, value);
- Assert.AreEqual(result.e00, 2.0f);
- Assert.AreEqual(result.e01, 4.0f);
+ Assert.Equal(result.e00, 2.0f);
+ Assert.Equal(result.e01, 4.0f);
GenericsNative.Point2<float>[] values = new GenericsNative.Point2<float>[] {
value,
fixed (GenericsNative.Point2<float>* pValues = &values[0])
{
GenericsNative.Point2<float> result2 = GenericsNative.AddPoint2Fs(pValues, values.Length);
- Assert.AreEqual(result2.e00, 5.0f);
- Assert.AreEqual(result2.e01, 10.0f);
+ Assert.Equal(result2.e00, 5.0f);
+ Assert.Equal(result2.e01, 10.0f);
}
GenericsNative.Point2<float> result3 = GenericsNative.AddPoint2Fs(values, values.Length);
- Assert.AreEqual(result3.e00, 5.0f);
- Assert.AreEqual(result3.e01, 10.0f);
+ Assert.Equal(result3.e00, 5.0f);
+ Assert.Equal(result3.e01, 10.0f);
GenericsNative.Point2<float> result4 = GenericsNative.AddPoint2Fs(in values[0], values.Length);
- Assert.AreEqual(result4.e00, 5.0f);
- Assert.AreEqual(result4.e01, 10.0f);
+ Assert.Equal(result4.e00, 5.0f);
+ Assert.Equal(result4.e01, 10.0f);
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
private static void TestPoint2L()
{
GenericsNative.Point2<long> value = GenericsNative.GetPoint2L(1L, 2L);
- Assert.AreEqual(value.e00, 1L);
- Assert.AreEqual(value.e01, 2L);
+ Assert.Equal(value.e00, 1L);
+ Assert.Equal(value.e01, 2L);
GenericsNative.Point2<long> value2;
GenericsNative.GetPoint2LOut(1L, 2L, &value2);
- Assert.AreEqual(value2.e00, 1L);
- Assert.AreEqual(value2.e01, 2L);
+ Assert.Equal(value2.e00, 1L);
+ Assert.Equal(value2.e01, 2L);
GenericsNative.GetPoint2LOut(1L, 2L, out GenericsNative.Point2<long> value3);
- Assert.AreEqual(value3.e00, 1L);
- Assert.AreEqual(value3.e01, 2L);
+ Assert.Equal(value3.e00, 1L);
+ Assert.Equal(value3.e01, 2L);
GenericsNative.Point2<long>* value4 = GenericsNative.GetPoint2LPtr(1L, 2L);
- Assert.AreEqual(value4->e00, 1L);
- Assert.AreEqual(value4->e01, 2L);
+ Assert.Equal(value4->e00, 1L);
+ Assert.Equal(value4->e01, 2L);
ref readonly GenericsNative.Point2<long> value5 = ref GenericsNative.GetPoint2LRef(1L, 2L);
- Assert.AreEqual(value5.e00, 1L);
- Assert.AreEqual(value5.e01, 2L);
+ Assert.Equal(value5.e00, 1L);
+ Assert.Equal(value5.e01, 2L);
GenericsNative.Point2<long> result = GenericsNative.AddPoint2L(value, value);
- Assert.AreEqual(result.e00, 2L);
- Assert.AreEqual(result.e01, 4L);
+ Assert.Equal(result.e00, 2L);
+ Assert.Equal(result.e01, 4L);
GenericsNative.Point2<long>[] values = new GenericsNative.Point2<long>[] {
value,
fixed (GenericsNative.Point2<long>* pValues = &values[0])
{
GenericsNative.Point2<long> result2 = GenericsNative.AddPoint2Ls(pValues, values.Length);
- Assert.AreEqual(result2.e00, 5l);
- Assert.AreEqual(result2.e01, 10l);
+ Assert.Equal(result2.e00, 5l);
+ Assert.Equal(result2.e01, 10l);
}
GenericsNative.Point2<long> result3 = GenericsNative.AddPoint2Ls(values, values.Length);
- Assert.AreEqual(result3.e00, 5l);
- Assert.AreEqual(result3.e01, 10l);
+ Assert.Equal(result3.e00, 5l);
+ Assert.Equal(result3.e01, 10l);
GenericsNative.Point2<long> result4 = GenericsNative.AddPoint2Ls(in values[0], values.Length);
- Assert.AreEqual(result4.e00, 5l);
- Assert.AreEqual(result4.e01, 10l);
+ Assert.Equal(result4.e00, 5l);
+ Assert.Equal(result4.e01, 10l);
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
private static void TestPoint2U()
{
GenericsNative.Point2<uint> value = GenericsNative.GetPoint2U(1u, 2u);
- Assert.AreEqual(value.e00, 1u);
- Assert.AreEqual(value.e01, 2u);
+ Assert.Equal(value.e00, 1u);
+ Assert.Equal(value.e01, 2u);
GenericsNative.Point2<uint> value2;
GenericsNative.GetPoint2UOut(1u, 2u, &value2);
- Assert.AreEqual(value2.e00, 1u);
- Assert.AreEqual(value2.e01, 2u);
+ Assert.Equal(value2.e00, 1u);
+ Assert.Equal(value2.e01, 2u);
GenericsNative.GetPoint2UOut(1u, 2u, out GenericsNative.Point2<uint> value3);
- Assert.AreEqual(value3.e00, 1u);
- Assert.AreEqual(value3.e01, 2u);
+ Assert.Equal(value3.e00, 1u);
+ Assert.Equal(value3.e01, 2u);
GenericsNative.Point2<uint>* value4 = GenericsNative.GetPoint2UPtr(1u, 2u);
- Assert.AreEqual(value4->e00, 1u);
- Assert.AreEqual(value4->e01, 2u);
+ Assert.Equal(value4->e00, 1u);
+ Assert.Equal(value4->e01, 2u);
ref readonly GenericsNative.Point2<uint> value5 = ref GenericsNative.GetPoint2URef(1u, 2u);
- Assert.AreEqual(value5.e00, 1u);
- Assert.AreEqual(value5.e01, 2u);
+ Assert.Equal(value5.e00, 1u);
+ Assert.Equal(value5.e01, 2u);
GenericsNative.Point2<uint> result = GenericsNative.AddPoint2U(value, value);
- Assert.AreEqual(result.e00, 2u);
- Assert.AreEqual(result.e01, 4u);
+ Assert.Equal(result.e00, 2u);
+ Assert.Equal(result.e01, 4u);
GenericsNative.Point2<uint>[] values = new GenericsNative.Point2<uint>[] {
value,
fixed (GenericsNative.Point2<uint>* pValues = &values[0])
{
GenericsNative.Point2<uint> result2 = GenericsNative.AddPoint2Us(pValues, values.Length);
- Assert.AreEqual(result2.e00, 5u);
- Assert.AreEqual(result2.e01, 10u);
+ Assert.Equal(result2.e00, 5u);
+ Assert.Equal(result2.e01, 10u);
}
GenericsNative.Point2<uint> result3 = GenericsNative.AddPoint2Us(values, values.Length);
- Assert.AreEqual(result3.e00, 5u);
- Assert.AreEqual(result3.e01, 10u);
+ Assert.Equal(result3.e00, 5u);
+ Assert.Equal(result3.e01, 10u);
GenericsNative.Point2<uint> result4 = GenericsNative.AddPoint2Us(in values[0], values.Length);
- Assert.AreEqual(result4.e00, 5u);
- Assert.AreEqual(result4.e01, 10u);
+ Assert.Equal(result4.e00, 5u);
+ Assert.Equal(result4.e01, 10u);
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
private static void TestPoint3D()
{
GenericsNative.Point3<double> value = GenericsNative.GetPoint3D(1.0, 2.0, 3.0);
- Assert.AreEqual(value.e00, 1.0);
- Assert.AreEqual(value.e01, 2.0);
- Assert.AreEqual(value.e02, 3.0);
+ Assert.Equal(value.e00, 1.0);
+ Assert.Equal(value.e01, 2.0);
+ Assert.Equal(value.e02, 3.0);
GenericsNative.Point3<double> value2;
GenericsNative.GetPoint3DOut(1.0, 2.0, 3.0, &value2);
- Assert.AreEqual(value2.e00, 1.0);
- Assert.AreEqual(value2.e01, 2.0);
- Assert.AreEqual(value2.e02, 3.0);
+ Assert.Equal(value2.e00, 1.0);
+ Assert.Equal(value2.e01, 2.0);
+ Assert.Equal(value2.e02, 3.0);
GenericsNative.GetPoint3DOut(1.0, 2.0, 3.0, out GenericsNative.Point3<double> value3);
- Assert.AreEqual(value3.e00, 1.0);
- Assert.AreEqual(value3.e01, 2.0);
- Assert.AreEqual(value3.e02, 3.0);
+ Assert.Equal(value3.e00, 1.0);
+ Assert.Equal(value3.e01, 2.0);
+ Assert.Equal(value3.e02, 3.0);
GenericsNative.Point3<double>* value4 = GenericsNative.GetPoint3DPtr(1.0, 2.0, 3.0);
- Assert.AreEqual(value4->e00, 1.0);
- Assert.AreEqual(value4->e01, 2.0);
- Assert.AreEqual(value4->e02, 3.0);
+ Assert.Equal(value4->e00, 1.0);
+ Assert.Equal(value4->e01, 2.0);
+ Assert.Equal(value4->e02, 3.0);
ref readonly GenericsNative.Point3<double> value5 = ref GenericsNative.GetPoint3DRef(1.0, 2.0, 3.0);
- Assert.AreEqual(value5.e00, 1.0);
- Assert.AreEqual(value5.e01, 2.0);
- Assert.AreEqual(value5.e02, 3.0);
+ Assert.Equal(value5.e00, 1.0);
+ Assert.Equal(value5.e01, 2.0);
+ Assert.Equal(value5.e02, 3.0);
GenericsNative.Point3<double> result = GenericsNative.AddPoint3D(value, value);
- Assert.AreEqual(result.e00, 2.0);
- Assert.AreEqual(result.e01, 4.0);
- Assert.AreEqual(result.e02, 6.0);
+ Assert.Equal(result.e00, 2.0);
+ Assert.Equal(result.e01, 4.0);
+ Assert.Equal(result.e02, 6.0);
GenericsNative.Point3<double>[] values = new GenericsNative.Point3<double>[] {
value,
fixed (GenericsNative.Point3<double>* pValues = &values[0])
{
GenericsNative.Point3<double> result2 = GenericsNative.AddPoint3Ds(pValues, values.Length);
- Assert.AreEqual(result2.e00, 5.0);
- Assert.AreEqual(result2.e01, 10.0);
- Assert.AreEqual(result2.e02, 15.0);
+ Assert.Equal(result2.e00, 5.0);
+ Assert.Equal(result2.e01, 10.0);
+ Assert.Equal(result2.e02, 15.0);
}
GenericsNative.Point3<double> result3 = GenericsNative.AddPoint3Ds(values, values.Length);
- Assert.AreEqual(result3.e00, 5.0);
- Assert.AreEqual(result3.e01, 10.0);
- Assert.AreEqual(result3.e02, 15.0);
+ Assert.Equal(result3.e00, 5.0);
+ Assert.Equal(result3.e01, 10.0);
+ Assert.Equal(result3.e02, 15.0);
GenericsNative.Point3<double> result4 = GenericsNative.AddPoint3Ds(in values[0], values.Length);
- Assert.AreEqual(result4.e00, 5.0);
- Assert.AreEqual(result4.e01, 10.0);
- Assert.AreEqual(result4.e02, 15.0);
+ Assert.Equal(result4.e00, 5.0);
+ Assert.Equal(result4.e01, 10.0);
+ Assert.Equal(result4.e02, 15.0);
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
private static void TestPoint3F()
{
GenericsNative.Point3<float> value = GenericsNative.GetPoint3F(1.0f, 2.0f, 3.0f);
- Assert.AreEqual(value.e00, 1.0f);
- Assert.AreEqual(value.e01, 2.0f);
- Assert.AreEqual(value.e02, 3.0f);
+ Assert.Equal(value.e00, 1.0f);
+ Assert.Equal(value.e01, 2.0f);
+ Assert.Equal(value.e02, 3.0f);
GenericsNative.Point3<float> value2;
GenericsNative.GetPoint3FOut(1.0f, 2.0f, 3.0f, &value2);
- Assert.AreEqual(value2.e00, 1.0f);
- Assert.AreEqual(value2.e01, 2.0f);
- Assert.AreEqual(value2.e02, 3.0f);
+ Assert.Equal(value2.e00, 1.0f);
+ Assert.Equal(value2.e01, 2.0f);
+ Assert.Equal(value2.e02, 3.0f);
GenericsNative.GetPoint3FOut(1.0f, 2.0f, 3.0f, out GenericsNative.Point3<float> value3);
- Assert.AreEqual(value3.e00, 1.0f);
- Assert.AreEqual(value3.e01, 2.0f);
- Assert.AreEqual(value3.e02, 3.0f);
+ Assert.Equal(value3.e00, 1.0f);
+ Assert.Equal(value3.e01, 2.0f);
+ Assert.Equal(value3.e02, 3.0f);
GenericsNative.Point3<float>* value4 = GenericsNative.GetPoint3FPtr(1.0f, 2.0f, 3.0f);
- Assert.AreEqual(value4->e00, 1.0f);
- Assert.AreEqual(value4->e01, 2.0f);
- Assert.AreEqual(value4->e02, 3.0f);
+ Assert.Equal(value4->e00, 1.0f);
+ Assert.Equal(value4->e01, 2.0f);
+ Assert.Equal(value4->e02, 3.0f);
ref readonly GenericsNative.Point3<float> value5 = ref GenericsNative.GetPoint3FRef(1.0f, 2.0f, 3.0f);
- Assert.AreEqual(value5.e00, 1.0f);
- Assert.AreEqual(value5.e01, 2.0f);
- Assert.AreEqual(value5.e02, 3.0f);
+ Assert.Equal(value5.e00, 1.0f);
+ Assert.Equal(value5.e01, 2.0f);
+ Assert.Equal(value5.e02, 3.0f);
GenericsNative.Point3<float> result = GenericsNative.AddPoint3F(value, value);
- Assert.AreEqual(result.e00, 2.0f);
- Assert.AreEqual(result.e01, 4.0f);
- Assert.AreEqual(result.e02, 6.0f);
+ Assert.Equal(result.e00, 2.0f);
+ Assert.Equal(result.e01, 4.0f);
+ Assert.Equal(result.e02, 6.0f);
GenericsNative.Point3<float>[] values = new GenericsNative.Point3<float>[] {
value,
fixed (GenericsNative.Point3<float>* pValues = &values[0])
{
GenericsNative.Point3<float> result2 = GenericsNative.AddPoint3Fs(pValues, values.Length);
- Assert.AreEqual(result2.e00, 5.0f);
- Assert.AreEqual(result2.e01, 10.0f);
- Assert.AreEqual(result2.e02, 15.0f);
+ Assert.Equal(result2.e00, 5.0f);
+ Assert.Equal(result2.e01, 10.0f);
+ Assert.Equal(result2.e02, 15.0f);
}
GenericsNative.Point3<float> result3 = GenericsNative.AddPoint3Fs(values, values.Length);
- Assert.AreEqual(result3.e00, 5.0f);
- Assert.AreEqual(result3.e01, 10.0f);
- Assert.AreEqual(result3.e02, 15.0f);
+ Assert.Equal(result3.e00, 5.0f);
+ Assert.Equal(result3.e01, 10.0f);
+ Assert.Equal(result3.e02, 15.0f);
GenericsNative.Point3<float> result4 = GenericsNative.AddPoint3Fs(in values[0], values.Length);
- Assert.AreEqual(result4.e00, 5.0f);
- Assert.AreEqual(result4.e01, 10.0f);
- Assert.AreEqual(result4.e02, 15.0f);
+ Assert.Equal(result4.e00, 5.0f);
+ Assert.Equal(result4.e01, 10.0f);
+ Assert.Equal(result4.e02, 15.0f);
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
private static void TestPoint3L()
{
GenericsNative.Point3<long> value = GenericsNative.GetPoint3L(1L, 2L, 3L);
- Assert.AreEqual(value.e00, 1L);
- Assert.AreEqual(value.e01, 2L);
- Assert.AreEqual(value.e02, 3L);
+ Assert.Equal(value.e00, 1L);
+ Assert.Equal(value.e01, 2L);
+ Assert.Equal(value.e02, 3L);
GenericsNative.Point3<long> value2;
GenericsNative.GetPoint3LOut(1L, 2L, 3L, &value2);
- Assert.AreEqual(value2.e00, 1L);
- Assert.AreEqual(value2.e01, 2L);
- Assert.AreEqual(value2.e02, 3L);
+ Assert.Equal(value2.e00, 1L);
+ Assert.Equal(value2.e01, 2L);
+ Assert.Equal(value2.e02, 3L);
GenericsNative.GetPoint3LOut(1L, 2L, 3L, out GenericsNative.Point3<long> value3);
- Assert.AreEqual(value3.e00, 1L);
- Assert.AreEqual(value3.e01, 2L);
- Assert.AreEqual(value3.e02, 3L);
+ Assert.Equal(value3.e00, 1L);
+ Assert.Equal(value3.e01, 2L);
+ Assert.Equal(value3.e02, 3L);
GenericsNative.Point3<long>* value4 = GenericsNative.GetPoint3LPtr(1L, 2L, 3L);
- Assert.AreEqual(value4->e00, 1L);
- Assert.AreEqual(value4->e01, 2L);
- Assert.AreEqual(value4->e02, 3L);
+ Assert.Equal(value4->e00, 1L);
+ Assert.Equal(value4->e01, 2L);
+ Assert.Equal(value4->e02, 3L);
ref readonly GenericsNative.Point3<long> value5 = ref GenericsNative.GetPoint3LRef(1L, 2L, 3L);
- Assert.AreEqual(value5.e00, 1L);
- Assert.AreEqual(value5.e01, 2L);
- Assert.AreEqual(value5.e02, 3L);
+ Assert.Equal(value5.e00, 1L);
+ Assert.Equal(value5.e01, 2L);
+ Assert.Equal(value5.e02, 3L);
GenericsNative.Point3<long> result = GenericsNative.AddPoint3L(value, value);
- Assert.AreEqual(result.e00, 2L);
- Assert.AreEqual(result.e01, 4L);
- Assert.AreEqual(result.e02, 6l);
+ Assert.Equal(result.e00, 2L);
+ Assert.Equal(result.e01, 4L);
+ Assert.Equal(result.e02, 6l);
GenericsNative.Point3<long>[] values = new GenericsNative.Point3<long>[] {
value,
fixed (GenericsNative.Point3<long>* pValues = &values[0])
{
GenericsNative.Point3<long> result2 = GenericsNative.AddPoint3Ls(pValues, values.Length);
- Assert.AreEqual(result2.e00, 5l);
- Assert.AreEqual(result2.e01, 10l);
- Assert.AreEqual(result2.e02, 15l);
+ Assert.Equal(result2.e00, 5l);
+ Assert.Equal(result2.e01, 10l);
+ Assert.Equal(result2.e02, 15l);
}
GenericsNative.Point3<long> result3 = GenericsNative.AddPoint3Ls(values, values.Length);
- Assert.AreEqual(result3.e00, 5l);
- Assert.AreEqual(result3.e01, 10l);
- Assert.AreEqual(result3.e02, 15l);
+ Assert.Equal(result3.e00, 5l);
+ Assert.Equal(result3.e01, 10l);
+ Assert.Equal(result3.e02, 15l);
GenericsNative.Point3<long> result4 = GenericsNative.AddPoint3Ls(in values[0], values.Length);
- Assert.AreEqual(result4.e00, 5l);
- Assert.AreEqual(result4.e01, 10l);
- Assert.AreEqual(result4.e02, 15l);
+ Assert.Equal(result4.e00, 5l);
+ Assert.Equal(result4.e01, 10l);
+ Assert.Equal(result4.e02, 15l);
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
private static void TestPoint3U()
{
GenericsNative.Point3<uint> value = GenericsNative.GetPoint3U(1u, 2u, 3u);
- Assert.AreEqual(value.e00, 1u);
- Assert.AreEqual(value.e01, 2u);
- Assert.AreEqual(value.e02, 3u);
+ Assert.Equal(value.e00, 1u);
+ Assert.Equal(value.e01, 2u);
+ Assert.Equal(value.e02, 3u);
GenericsNative.Point3<uint> value2;
GenericsNative.GetPoint3UOut(1u, 2u, 3u, &value2);
- Assert.AreEqual(value2.e00, 1u);
- Assert.AreEqual(value2.e01, 2u);
- Assert.AreEqual(value2.e02, 3u);
+ Assert.Equal(value2.e00, 1u);
+ Assert.Equal(value2.e01, 2u);
+ Assert.Equal(value2.e02, 3u);
GenericsNative.GetPoint3UOut(1u, 2u, 3u, out GenericsNative.Point3<uint> value3);
- Assert.AreEqual(value3.e00, 1u);
- Assert.AreEqual(value3.e01, 2u);
- Assert.AreEqual(value3.e02, 3u);
+ Assert.Equal(value3.e00, 1u);
+ Assert.Equal(value3.e01, 2u);
+ Assert.Equal(value3.e02, 3u);
GenericsNative.Point3<uint>* value4 = GenericsNative.GetPoint3UPtr(1u, 2u, 3u);
- Assert.AreEqual(value4->e00, 1u);
- Assert.AreEqual(value4->e01, 2u);
- Assert.AreEqual(value4->e02, 3u);
+ Assert.Equal(value4->e00, 1u);
+ Assert.Equal(value4->e01, 2u);
+ Assert.Equal(value4->e02, 3u);
ref readonly GenericsNative.Point3<uint> value5 = ref GenericsNative.GetPoint3URef(1u, 2u, 3u);
- Assert.AreEqual(value5.e00, 1u);
- Assert.AreEqual(value5.e01, 2u);
- Assert.AreEqual(value5.e02, 3u);
+ Assert.Equal(value5.e00, 1u);
+ Assert.Equal(value5.e01, 2u);
+ Assert.Equal(value5.e02, 3u);
GenericsNative.Point3<uint> result = GenericsNative.AddPoint3U(value, value);
- Assert.AreEqual(result.e00, 2u);
- Assert.AreEqual(result.e01, 4u);
- Assert.AreEqual(result.e02, 6u);
+ Assert.Equal(result.e00, 2u);
+ Assert.Equal(result.e01, 4u);
+ Assert.Equal(result.e02, 6u);
GenericsNative.Point3<uint>[] values = new GenericsNative.Point3<uint>[] {
value,
fixed (GenericsNative.Point3<uint>* pValues = &values[0])
{
GenericsNative.Point3<uint> result2 = GenericsNative.AddPoint3Us(pValues, values.Length);
- Assert.AreEqual(result2.e00, 5u);
- Assert.AreEqual(result2.e01, 10u);
- Assert.AreEqual(result2.e02, 15u);
+ Assert.Equal(result2.e00, 5u);
+ Assert.Equal(result2.e01, 10u);
+ Assert.Equal(result2.e02, 15u);
}
GenericsNative.Point3<uint> result3 = GenericsNative.AddPoint3Us(values, values.Length);
- Assert.AreEqual(result3.e00, 5u);
- Assert.AreEqual(result3.e01, 10u);
- Assert.AreEqual(result3.e02, 15u);
+ Assert.Equal(result3.e00, 5u);
+ Assert.Equal(result3.e01, 10u);
+ Assert.Equal(result3.e02, 15u);
GenericsNative.Point3<uint> result4 = GenericsNative.AddPoint3Us(in values[0], values.Length);
- Assert.AreEqual(result4.e00, 5u);
- Assert.AreEqual(result4.e01, 10u);
- Assert.AreEqual(result4.e02, 15u);
+ Assert.Equal(result4.e00, 5u);
+ Assert.Equal(result4.e01, 10u);
+ Assert.Equal(result4.e02, 15u);
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
private static void TestPoint4D()
{
GenericsNative.Point4<double> value = GenericsNative.GetPoint4D(1.0, 2.0, 3.0, 4.0);
- Assert.AreEqual(value.e00, 1.0);
- Assert.AreEqual(value.e01, 2.0);
- Assert.AreEqual(value.e02, 3.0);
- Assert.AreEqual(value.e03, 4.0);
+ Assert.Equal(value.e00, 1.0);
+ Assert.Equal(value.e01, 2.0);
+ Assert.Equal(value.e02, 3.0);
+ Assert.Equal(value.e03, 4.0);
GenericsNative.Point4<double> value2;
GenericsNative.GetPoint4DOut(1.0, 2.0, 3.0, 4.0, &value2);
- Assert.AreEqual(value2.e00, 1.0);
- Assert.AreEqual(value2.e01, 2.0);
- Assert.AreEqual(value2.e02, 3.0);
- Assert.AreEqual(value2.e03, 4.0);
+ Assert.Equal(value2.e00, 1.0);
+ Assert.Equal(value2.e01, 2.0);
+ Assert.Equal(value2.e02, 3.0);
+ Assert.Equal(value2.e03, 4.0);
GenericsNative.GetPoint4DOut(1.0, 2.0, 3.0, 4.0, out GenericsNative.Point4<double> value3);
- Assert.AreEqual(value3.e00, 1.0);
- Assert.AreEqual(value3.e01, 2.0);
- Assert.AreEqual(value3.e02, 3.0);
- Assert.AreEqual(value3.e03, 4.0);
+ Assert.Equal(value3.e00, 1.0);
+ Assert.Equal(value3.e01, 2.0);
+ Assert.Equal(value3.e02, 3.0);
+ Assert.Equal(value3.e03, 4.0);
GenericsNative.Point4<double>* value4 = GenericsNative.GetPoint4DPtr(1.0, 2.0, 3.0, 4.0);
- Assert.AreEqual(value4->e00, 1.0);
- Assert.AreEqual(value4->e01, 2.0);
- Assert.AreEqual(value4->e02, 3.0);
- Assert.AreEqual(value4->e03, 4.0);
+ Assert.Equal(value4->e00, 1.0);
+ Assert.Equal(value4->e01, 2.0);
+ Assert.Equal(value4->e02, 3.0);
+ Assert.Equal(value4->e03, 4.0);
ref readonly GenericsNative.Point4<double> value5 = ref GenericsNative.GetPoint4DRef(1.0, 2.0, 3.0, 4.0);
- Assert.AreEqual(value5.e00, 1.0);
- Assert.AreEqual(value5.e01, 2.0);
- Assert.AreEqual(value5.e02, 3.0);
- Assert.AreEqual(value5.e03, 4.0);
+ Assert.Equal(value5.e00, 1.0);
+ Assert.Equal(value5.e01, 2.0);
+ Assert.Equal(value5.e02, 3.0);
+ Assert.Equal(value5.e03, 4.0);
GenericsNative.Point4<double> result = GenericsNative.AddPoint4D(value, value);
- Assert.AreEqual(result.e00, 2.0);
- Assert.AreEqual(result.e01, 4.0);
- Assert.AreEqual(result.e02, 6.0);
- Assert.AreEqual(result.e03, 8.0);
+ Assert.Equal(result.e00, 2.0);
+ Assert.Equal(result.e01, 4.0);
+ Assert.Equal(result.e02, 6.0);
+ Assert.Equal(result.e03, 8.0);
GenericsNative.Point4<double>[] values = new GenericsNative.Point4<double>[] {
value,
fixed (GenericsNative.Point4<double>* pValues = &values[0])
{
GenericsNative.Point4<double> result2 = GenericsNative.AddPoint4Ds(pValues, values.Length);
- Assert.AreEqual(result2.e00, 5.0);
- Assert.AreEqual(result2.e01, 10.0);
- Assert.AreEqual(result2.e02, 15.0);
- Assert.AreEqual(result2.e03, 20.0);
+ Assert.Equal(result2.e00, 5.0);
+ Assert.Equal(result2.e01, 10.0);
+ Assert.Equal(result2.e02, 15.0);
+ Assert.Equal(result2.e03, 20.0);
}
GenericsNative.Point4<double> result3 = GenericsNative.AddPoint4Ds(values, values.Length);
- Assert.AreEqual(result3.e00, 5.0);
- Assert.AreEqual(result3.e01, 10.0);
- Assert.AreEqual(result3.e02, 15.0);
- Assert.AreEqual(result3.e03, 20.0);
+ Assert.Equal(result3.e00, 5.0);
+ Assert.Equal(result3.e01, 10.0);
+ Assert.Equal(result3.e02, 15.0);
+ Assert.Equal(result3.e03, 20.0);
GenericsNative.Point4<double> result4 = GenericsNative.AddPoint4Ds(in values[0], values.Length);
- Assert.AreEqual(result4.e00, 5.0);
- Assert.AreEqual(result4.e01, 10.0);
- Assert.AreEqual(result4.e02, 15.0);
- Assert.AreEqual(result4.e03, 20.0);
+ Assert.Equal(result4.e00, 5.0);
+ Assert.Equal(result4.e01, 10.0);
+ Assert.Equal(result4.e02, 15.0);
+ Assert.Equal(result4.e03, 20.0);
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
private static void TestPoint4F()
{
GenericsNative.Point4<float> value = GenericsNative.GetPoint4F(1.0f, 2.0f, 3.0f, 4.0f);
- Assert.AreEqual(value.e00, 1.0f);
- Assert.AreEqual(value.e01, 2.0f);
- Assert.AreEqual(value.e02, 3.0f);
- Assert.AreEqual(value.e03, 4.0f);
+ Assert.Equal(value.e00, 1.0f);
+ Assert.Equal(value.e01, 2.0f);
+ Assert.Equal(value.e02, 3.0f);
+ Assert.Equal(value.e03, 4.0f);
GenericsNative.Point4<float> value2;
GenericsNative.GetPoint4FOut(1.0f, 2.0f, 3.0f, 4.0f, &value2);
- Assert.AreEqual(value2.e00, 1.0f);
- Assert.AreEqual(value2.e01, 2.0f);
- Assert.AreEqual(value2.e02, 3.0f);
- Assert.AreEqual(value2.e03, 4.0f);
+ Assert.Equal(value2.e00, 1.0f);
+ Assert.Equal(value2.e01, 2.0f);
+ Assert.Equal(value2.e02, 3.0f);
+ Assert.Equal(value2.e03, 4.0f);
GenericsNative.GetPoint4FOut(1.0f, 2.0f, 3.0f, 4.0f, out GenericsNative.Point4<float> value3);
- Assert.AreEqual(value3.e00, 1.0f);
- Assert.AreEqual(value3.e01, 2.0f);
- Assert.AreEqual(value3.e02, 3.0f);
- Assert.AreEqual(value3.e03, 4.0f);
+ Assert.Equal(value3.e00, 1.0f);
+ Assert.Equal(value3.e01, 2.0f);
+ Assert.Equal(value3.e02, 3.0f);
+ Assert.Equal(value3.e03, 4.0f);
GenericsNative.Point4<float>* value4 = GenericsNative.GetPoint4FPtr(1.0f, 2.0f, 3.0f, 4.0f);
- Assert.AreEqual(value4->e00, 1.0f);
- Assert.AreEqual(value4->e01, 2.0f);
- Assert.AreEqual(value4->e02, 3.0f);
- Assert.AreEqual(value4->e03, 4.0f);
+ Assert.Equal(value4->e00, 1.0f);
+ Assert.Equal(value4->e01, 2.0f);
+ Assert.Equal(value4->e02, 3.0f);
+ Assert.Equal(value4->e03, 4.0f);
ref readonly GenericsNative.Point4<float> value5 = ref GenericsNative.GetPoint4FRef(1.0f, 2.0f, 3.0f, 4.0f);
- Assert.AreEqual(value5.e00, 1.0f);
- Assert.AreEqual(value5.e01, 2.0f);
- Assert.AreEqual(value5.e02, 3.0f);
- Assert.AreEqual(value5.e03, 4.0f);
+ Assert.Equal(value5.e00, 1.0f);
+ Assert.Equal(value5.e01, 2.0f);
+ Assert.Equal(value5.e02, 3.0f);
+ Assert.Equal(value5.e03, 4.0f);
GenericsNative.Point4<float> result = GenericsNative.AddPoint4F(value, value);
- Assert.AreEqual(result.e00, 2.0f);
- Assert.AreEqual(result.e01, 4.0f);
- Assert.AreEqual(result.e02, 6.0f);
- Assert.AreEqual(result.e03, 8.0f);
+ Assert.Equal(result.e00, 2.0f);
+ Assert.Equal(result.e01, 4.0f);
+ Assert.Equal(result.e02, 6.0f);
+ Assert.Equal(result.e03, 8.0f);
GenericsNative.Point4<float>[] values = new GenericsNative.Point4<float>[] {
value,
fixed (GenericsNative.Point4<float>* pValues = &values[0])
{
GenericsNative.Point4<float> result2 = GenericsNative.AddPoint4Fs(pValues, values.Length);
- Assert.AreEqual(result2.e00, 5.0f);
- Assert.AreEqual(result2.e01, 10.0f);
- Assert.AreEqual(result2.e02, 15.0f);
- Assert.AreEqual(result2.e03, 20.0f);
+ Assert.Equal(result2.e00, 5.0f);
+ Assert.Equal(result2.e01, 10.0f);
+ Assert.Equal(result2.e02, 15.0f);
+ Assert.Equal(result2.e03, 20.0f);
}
GenericsNative.Point4<float> result3 = GenericsNative.AddPoint4Fs(values, values.Length);
- Assert.AreEqual(result3.e00, 5.0f);
- Assert.AreEqual(result3.e01, 10.0f);
- Assert.AreEqual(result3.e02, 15.0f);
- Assert.AreEqual(result3.e03, 20.0f);
+ Assert.Equal(result3.e00, 5.0f);
+ Assert.Equal(result3.e01, 10.0f);
+ Assert.Equal(result3.e02, 15.0f);
+ Assert.Equal(result3.e03, 20.0f);
GenericsNative.Point4<float> result4 = GenericsNative.AddPoint4Fs(in values[0], values.Length);
- Assert.AreEqual(result4.e00, 5.0f);
- Assert.AreEqual(result4.e01, 10.0f);
- Assert.AreEqual(result4.e02, 15.0f);
- Assert.AreEqual(result4.e03, 20.0f);
+ Assert.Equal(result4.e00, 5.0f);
+ Assert.Equal(result4.e01, 10.0f);
+ Assert.Equal(result4.e02, 15.0f);
+ Assert.Equal(result4.e03, 20.0f);
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
private static void TestPoint4L()
{
GenericsNative.Point4<long> value = GenericsNative.GetPoint4L(1L, 2L, 3L, 4L);
- Assert.AreEqual(value.e00, 1L);
- Assert.AreEqual(value.e01, 2L);
- Assert.AreEqual(value.e02, 3L);
- Assert.AreEqual(value.e03, 4L);
+ Assert.Equal(value.e00, 1L);
+ Assert.Equal(value.e01, 2L);
+ Assert.Equal(value.e02, 3L);
+ Assert.Equal(value.e03, 4L);
GenericsNative.Point4<long> value2;
GenericsNative.GetPoint4LOut(1L, 2L, 3L, 4L, &value2);
- Assert.AreEqual(value2.e00, 1L);
- Assert.AreEqual(value2.e01, 2L);
- Assert.AreEqual(value2.e02, 3L);
- Assert.AreEqual(value2.e03, 4L);
+ Assert.Equal(value2.e00, 1L);
+ Assert.Equal(value2.e01, 2L);
+ Assert.Equal(value2.e02, 3L);
+ Assert.Equal(value2.e03, 4L);
GenericsNative.GetPoint4LOut(1L, 2L, 3L, 4L, out GenericsNative.Point4<long> value3);
- Assert.AreEqual(value3.e00, 1L);
- Assert.AreEqual(value3.e01, 2L);
- Assert.AreEqual(value3.e02, 3L);
- Assert.AreEqual(value3.e03, 4L);
+ Assert.Equal(value3.e00, 1L);
+ Assert.Equal(value3.e01, 2L);
+ Assert.Equal(value3.e02, 3L);
+ Assert.Equal(value3.e03, 4L);
GenericsNative.Point4<long>* value4 = GenericsNative.GetPoint4LPtr(1L, 2L, 3L, 4L);
- Assert.AreEqual(value4->e00, 1L);
- Assert.AreEqual(value4->e01, 2L);
- Assert.AreEqual(value4->e02, 3L);
- Assert.AreEqual(value4->e03, 4L);
+ Assert.Equal(value4->e00, 1L);
+ Assert.Equal(value4->e01, 2L);
+ Assert.Equal(value4->e02, 3L);
+ Assert.Equal(value4->e03, 4L);
ref readonly GenericsNative.Point4<long> value5 = ref GenericsNative.GetPoint4LRef(1L, 2L, 3L, 4L);
- Assert.AreEqual(value5.e00, 1L);
- Assert.AreEqual(value5.e01, 2L);
- Assert.AreEqual(value5.e02, 3L);
- Assert.AreEqual(value5.e03, 4L);
+ Assert.Equal(value5.e00, 1L);
+ Assert.Equal(value5.e01, 2L);
+ Assert.Equal(value5.e02, 3L);
+ Assert.Equal(value5.e03, 4L);
GenericsNative.Point4<long> result = GenericsNative.AddPoint4L(value, value);
- Assert.AreEqual(result.e00, 2L);
- Assert.AreEqual(result.e01, 4L);
- Assert.AreEqual(result.e02, 6l);
- Assert.AreEqual(result.e03, 8l);
+ Assert.Equal(result.e00, 2L);
+ Assert.Equal(result.e01, 4L);
+ Assert.Equal(result.e02, 6l);
+ Assert.Equal(result.e03, 8l);
GenericsNative.Point4<long>[] values = new GenericsNative.Point4<long>[] {
value,
fixed (GenericsNative.Point4<long>* pValues = &values[0])
{
GenericsNative.Point4<long> result2 = GenericsNative.AddPoint4Ls(pValues, values.Length);
- Assert.AreEqual(result2.e00, 5l);
- Assert.AreEqual(result2.e01, 10l);
- Assert.AreEqual(result2.e02, 15l);
- Assert.AreEqual(result2.e03, 20l);
+ Assert.Equal(result2.e00, 5l);
+ Assert.Equal(result2.e01, 10l);
+ Assert.Equal(result2.e02, 15l);
+ Assert.Equal(result2.e03, 20l);
}
GenericsNative.Point4<long> result3 = GenericsNative.AddPoint4Ls(values, values.Length);
- Assert.AreEqual(result3.e00, 5l);
- Assert.AreEqual(result3.e01, 10l);
- Assert.AreEqual(result3.e02, 15l);
- Assert.AreEqual(result3.e03, 20l);
+ Assert.Equal(result3.e00, 5l);
+ Assert.Equal(result3.e01, 10l);
+ Assert.Equal(result3.e02, 15l);
+ Assert.Equal(result3.e03, 20l);
GenericsNative.Point4<long> result4 = GenericsNative.AddPoint4Ls(in values[0], values.Length);
- Assert.AreEqual(result4.e00, 5l);
- Assert.AreEqual(result4.e01, 10l);
- Assert.AreEqual(result4.e02, 15l);
- Assert.AreEqual(result4.e03, 20l);
+ Assert.Equal(result4.e00, 5l);
+ Assert.Equal(result4.e01, 10l);
+ Assert.Equal(result4.e02, 15l);
+ Assert.Equal(result4.e03, 20l);
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
private static void TestPoint4U()
{
GenericsNative.Point4<uint> value = GenericsNative.GetPoint4U(1u, 2u, 3u, 4u);
- Assert.AreEqual(value.e00, 1u);
- Assert.AreEqual(value.e01, 2u);
- Assert.AreEqual(value.e02, 3u);
- Assert.AreEqual(value.e03, 4u);
+ Assert.Equal(value.e00, 1u);
+ Assert.Equal(value.e01, 2u);
+ Assert.Equal(value.e02, 3u);
+ Assert.Equal(value.e03, 4u);
GenericsNative.Point4<uint> value2;
GenericsNative.GetPoint4UOut(1u, 2u, 3u, 4u, &value2);
- Assert.AreEqual(value2.e00, 1u);
- Assert.AreEqual(value2.e01, 2u);
- Assert.AreEqual(value2.e02, 3u);
- Assert.AreEqual(value2.e03, 4u);
+ Assert.Equal(value2.e00, 1u);
+ Assert.Equal(value2.e01, 2u);
+ Assert.Equal(value2.e02, 3u);
+ Assert.Equal(value2.e03, 4u);
GenericsNative.GetPoint4UOut(1u, 2u, 3u, 4u, out GenericsNative.Point4<uint> value3);
- Assert.AreEqual(value3.e00, 1u);
- Assert.AreEqual(value3.e01, 2u);
- Assert.AreEqual(value3.e02, 3u);
- Assert.AreEqual(value3.e03, 4u);
+ Assert.Equal(value3.e00, 1u);
+ Assert.Equal(value3.e01, 2u);
+ Assert.Equal(value3.e02, 3u);
+ Assert.Equal(value3.e03, 4u);
GenericsNative.Point4<uint>* value4 = GenericsNative.GetPoint4UPtr(1u, 2u, 3u, 4u);
- Assert.AreEqual(value4->e00, 1u);
- Assert.AreEqual(value4->e01, 2u);
- Assert.AreEqual(value4->e02, 3u);
- Assert.AreEqual(value4->e03, 4u);
+ Assert.Equal(value4->e00, 1u);
+ Assert.Equal(value4->e01, 2u);
+ Assert.Equal(value4->e02, 3u);
+ Assert.Equal(value4->e03, 4u);
ref readonly GenericsNative.Point4<uint> value5 = ref GenericsNative.GetPoint4URef(1u, 2u, 3u, 4u);
- Assert.AreEqual(value5.e00, 1u);
- Assert.AreEqual(value5.e01, 2u);
- Assert.AreEqual(value5.e02, 3u);
- Assert.AreEqual(value5.e03, 4u);
+ Assert.Equal(value5.e00, 1u);
+ Assert.Equal(value5.e01, 2u);
+ Assert.Equal(value5.e02, 3u);
+ Assert.Equal(value5.e03, 4u);
GenericsNative.Point4<uint> result = GenericsNative.AddPoint4U(value, value);
- Assert.AreEqual(result.e00, 2u);
- Assert.AreEqual(result.e01, 4u);
- Assert.AreEqual(result.e02, 6u);
- Assert.AreEqual(result.e03, 8u);
+ Assert.Equal(result.e00, 2u);
+ Assert.Equal(result.e01, 4u);
+ Assert.Equal(result.e02, 6u);
+ Assert.Equal(result.e03, 8u);
GenericsNative.Point4<uint>[] values = new GenericsNative.Point4<uint>[] {
value,
fixed (GenericsNative.Point4<uint>* pValues = &values[0])
{
GenericsNative.Point4<uint> result2 = GenericsNative.AddPoint4Us(pValues, values.Length);
- Assert.AreEqual(result2.e00, 5u);
- Assert.AreEqual(result2.e01, 10u);
- Assert.AreEqual(result2.e02, 15u);
- Assert.AreEqual(result2.e03, 20u);
+ Assert.Equal(result2.e00, 5u);
+ Assert.Equal(result2.e01, 10u);
+ Assert.Equal(result2.e02, 15u);
+ Assert.Equal(result2.e03, 20u);
}
GenericsNative.Point4<uint> result3 = GenericsNative.AddPoint4Us(values, values.Length);
- Assert.AreEqual(result3.e00, 5u);
- Assert.AreEqual(result3.e01, 10u);
- Assert.AreEqual(result3.e02, 15u);
- Assert.AreEqual(result3.e03, 20u);
+ Assert.Equal(result3.e00, 5u);
+ Assert.Equal(result3.e01, 10u);
+ Assert.Equal(result3.e02, 15u);
+ Assert.Equal(result3.e03, 20u);
GenericsNative.Point4<uint> result4 = GenericsNative.AddPoint4Us(in values[0], values.Length);
- Assert.AreEqual(result4.e00, 5u);
- Assert.AreEqual(result4.e01, 10u);
- Assert.AreEqual(result4.e02, 15u);
- Assert.AreEqual(result4.e03, 20u);
+ Assert.Equal(result4.e00, 5u);
+ Assert.Equal(result4.e01, 10u);
+ Assert.Equal(result4.e02, 15u);
+ Assert.Equal(result4.e03, 20u);
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector128<bool> value2;
GenericsNative.GetVector128BOut(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, &value2);
Vector128<byte> tValue2 = *(Vector128<byte>*)&value2;
- Assert.AreEqual(tValue2.GetElement(0), 1);
- Assert.AreEqual(tValue2.GetElement(1), 0);
- Assert.AreEqual(tValue2.GetElement(2), 1);
- Assert.AreEqual(tValue2.GetElement(3), 0);
- Assert.AreEqual(tValue2.GetElement(4), 1);
- Assert.AreEqual(tValue2.GetElement(5), 0);
- Assert.AreEqual(tValue2.GetElement(6), 1);
- Assert.AreEqual(tValue2.GetElement(7), 0);
- Assert.AreEqual(tValue2.GetElement(8), 1);
- Assert.AreEqual(tValue2.GetElement(9), 0);
- Assert.AreEqual(tValue2.GetElement(10), 1);
- Assert.AreEqual(tValue2.GetElement(11), 0);
- Assert.AreEqual(tValue2.GetElement(12), 1);
- Assert.AreEqual(tValue2.GetElement(13), 0);
- Assert.AreEqual(tValue2.GetElement(14), 1);
- Assert.AreEqual(tValue2.GetElement(15), 0);
+ Assert.Equal(tValue2.GetElement(0), 1);
+ Assert.Equal(tValue2.GetElement(1), 0);
+ Assert.Equal(tValue2.GetElement(2), 1);
+ Assert.Equal(tValue2.GetElement(3), 0);
+ Assert.Equal(tValue2.GetElement(4), 1);
+ Assert.Equal(tValue2.GetElement(5), 0);
+ Assert.Equal(tValue2.GetElement(6), 1);
+ Assert.Equal(tValue2.GetElement(7), 0);
+ Assert.Equal(tValue2.GetElement(8), 1);
+ Assert.Equal(tValue2.GetElement(9), 0);
+ Assert.Equal(tValue2.GetElement(10), 1);
+ Assert.Equal(tValue2.GetElement(11), 0);
+ Assert.Equal(tValue2.GetElement(12), 1);
+ Assert.Equal(tValue2.GetElement(13), 0);
+ Assert.Equal(tValue2.GetElement(14), 1);
+ Assert.Equal(tValue2.GetElement(15), 0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector128BOut(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, out Vector128<bool> value3));
Vector128<bool>* value4 = GenericsNative.GetVector128BPtr(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false);
Vector128<byte>* tValue4 = (Vector128<byte>*)value4;
- Assert.AreEqual(tValue4->GetElement(0), 1);
- Assert.AreEqual(tValue4->GetElement(1), 0);
- Assert.AreEqual(tValue4->GetElement(2), 1);
- Assert.AreEqual(tValue4->GetElement(3), 0);
- Assert.AreEqual(tValue4->GetElement(4), 1);
- Assert.AreEqual(tValue4->GetElement(5), 0);
- Assert.AreEqual(tValue4->GetElement(6), 1);
- Assert.AreEqual(tValue4->GetElement(7), 0);
- Assert.AreEqual(tValue4->GetElement(8), 1);
- Assert.AreEqual(tValue4->GetElement(9), 0);
- Assert.AreEqual(tValue4->GetElement(10), 1);
- Assert.AreEqual(tValue4->GetElement(11), 0);
- Assert.AreEqual(tValue4->GetElement(12), 1);
- Assert.AreEqual(tValue4->GetElement(13), 0);
- Assert.AreEqual(tValue4->GetElement(14), 1);
- Assert.AreEqual(tValue4->GetElement(15), 0);
+ Assert.Equal(tValue4->GetElement(0), 1);
+ Assert.Equal(tValue4->GetElement(1), 0);
+ Assert.Equal(tValue4->GetElement(2), 1);
+ Assert.Equal(tValue4->GetElement(3), 0);
+ Assert.Equal(tValue4->GetElement(4), 1);
+ Assert.Equal(tValue4->GetElement(5), 0);
+ Assert.Equal(tValue4->GetElement(6), 1);
+ Assert.Equal(tValue4->GetElement(7), 0);
+ Assert.Equal(tValue4->GetElement(8), 1);
+ Assert.Equal(tValue4->GetElement(9), 0);
+ Assert.Equal(tValue4->GetElement(10), 1);
+ Assert.Equal(tValue4->GetElement(11), 0);
+ Assert.Equal(tValue4->GetElement(12), 1);
+ Assert.Equal(tValue4->GetElement(13), 0);
+ Assert.Equal(tValue4->GetElement(14), 1);
+ Assert.Equal(tValue4->GetElement(15), 0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector128BRef(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector128<char> value2;
GenericsNative.GetVector128COut('0', '1', '2', '3', '4', '5', '6', '7', &value2);
Vector128<short> tValue2 = *(Vector128<short>*)&value2;
- Assert.AreEqual(tValue2.GetElement(0), (short)'0');
- Assert.AreEqual(tValue2.GetElement(1), (short)'1');
- Assert.AreEqual(tValue2.GetElement(2), (short)'2');
- Assert.AreEqual(tValue2.GetElement(3), (short)'3');
- Assert.AreEqual(tValue2.GetElement(4), (short)'4');
- Assert.AreEqual(tValue2.GetElement(5), (short)'5');
- Assert.AreEqual(tValue2.GetElement(6), (short)'6');
- Assert.AreEqual(tValue2.GetElement(7), (short)'7');
+ Assert.Equal(tValue2.GetElement(0), (short)'0');
+ Assert.Equal(tValue2.GetElement(1), (short)'1');
+ Assert.Equal(tValue2.GetElement(2), (short)'2');
+ Assert.Equal(tValue2.GetElement(3), (short)'3');
+ Assert.Equal(tValue2.GetElement(4), (short)'4');
+ Assert.Equal(tValue2.GetElement(5), (short)'5');
+ Assert.Equal(tValue2.GetElement(6), (short)'6');
+ Assert.Equal(tValue2.GetElement(7), (short)'7');
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector128COut('0', '1', '2', '3', '4', '5', '6', '7', out Vector128<char> value3));
Vector128<char>* value4 = GenericsNative.GetVector128CPtr('0', '1', '2', '3', '4', '5', '6', '7');
Vector128<short>* tValue4 = (Vector128<short>*)value4;
- Assert.AreEqual(tValue4->GetElement(0), (short)'0');
- Assert.AreEqual(tValue4->GetElement(1), (short)'1');
- Assert.AreEqual(tValue4->GetElement(2), (short)'2');
- Assert.AreEqual(tValue4->GetElement(3), (short)'3');
- Assert.AreEqual(tValue4->GetElement(4), (short)'4');
- Assert.AreEqual(tValue4->GetElement(5), (short)'5');
- Assert.AreEqual(tValue4->GetElement(6), (short)'6');
- Assert.AreEqual(tValue4->GetElement(7), (short)'7');
+ Assert.Equal(tValue4->GetElement(0), (short)'0');
+ Assert.Equal(tValue4->GetElement(1), (short)'1');
+ Assert.Equal(tValue4->GetElement(2), (short)'2');
+ Assert.Equal(tValue4->GetElement(3), (short)'3');
+ Assert.Equal(tValue4->GetElement(4), (short)'4');
+ Assert.Equal(tValue4->GetElement(5), (short)'5');
+ Assert.Equal(tValue4->GetElement(6), (short)'6');
+ Assert.Equal(tValue4->GetElement(7), (short)'7');
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector128CRef('0', '1', '2', '3', '4', '5', '6', '7'));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector128<double> value2;
GenericsNative.GetVector128DOut(1.0, 2.0, &value2);
- Assert.AreEqual(value2.GetElement(0), 1.0);
- Assert.AreEqual(value2.GetElement(1), 2.0);
+ Assert.Equal(value2.GetElement(0), 1.0);
+ Assert.Equal(value2.GetElement(1), 2.0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector128DOut(1.0, 2.0, out Vector128<double> value3));
Vector128<double>* value4 = GenericsNative.GetVector128DPtr(1.0, 2.0);
- Assert.AreEqual(value4->GetElement(0), 1.0);
- Assert.AreEqual(value4->GetElement(1), 2.0);
+ Assert.Equal(value4->GetElement(0), 1.0);
+ Assert.Equal(value4->GetElement(1), 2.0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector128DRef(1.0, 2.0));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector128<float> value2;
GenericsNative.GetVector128FOut(1.0f, 2.0f, 3.0f, 4.0f, &value2);
- Assert.AreEqual(value2.GetElement(0), 1.0f);
- Assert.AreEqual(value2.GetElement(1), 2.0f);
- Assert.AreEqual(value2.GetElement(2), 3.0f);
- Assert.AreEqual(value2.GetElement(3), 4.0f);
+ Assert.Equal(value2.GetElement(0), 1.0f);
+ Assert.Equal(value2.GetElement(1), 2.0f);
+ Assert.Equal(value2.GetElement(2), 3.0f);
+ Assert.Equal(value2.GetElement(3), 4.0f);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector128FOut(1.0f, 2.0f, 3.0f, 4.0f, out Vector128<float> value3));
Vector128<float>* value4 = GenericsNative.GetVector128FPtr(1.0f, 2.0f, 3.0f, 4.0f);
- Assert.AreEqual(value4->GetElement(0), 1.0f);
- Assert.AreEqual(value4->GetElement(1), 2.0f);
- Assert.AreEqual(value4->GetElement(2), 3.0f);
- Assert.AreEqual(value4->GetElement(3), 4.0f);
+ Assert.Equal(value4->GetElement(0), 1.0f);
+ Assert.Equal(value4->GetElement(1), 2.0f);
+ Assert.Equal(value4->GetElement(2), 3.0f);
+ Assert.Equal(value4->GetElement(3), 4.0f);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector128FRef(1.0f, 2.0f, 3.0f, 4.0f));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector128<long> value2;
GenericsNative.GetVector128LOut(1L, 2L, &value2);
- Assert.AreEqual(value2.GetElement(0), 1L);
- Assert.AreEqual(value2.GetElement(1), 2L);
+ Assert.Equal(value2.GetElement(0), 1L);
+ Assert.Equal(value2.GetElement(1), 2L);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector128LOut(1L, 2L, out Vector128<long> value3));
Vector128<long>* value4 = GenericsNative.GetVector128LPtr(1L, 2L);
- Assert.AreEqual(value4->GetElement(0), 1L);
- Assert.AreEqual(value4->GetElement(1), 2L);
+ Assert.Equal(value4->GetElement(0), 1L);
+ Assert.Equal(value4->GetElement(1), 2L);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector128LRef(1L, 2L));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector128<uint> value2;
GenericsNative.GetVector128UOut(1u, 2u, 3u, 4u, &value2);
- Assert.AreEqual(value2.GetElement(0), 1u);
- Assert.AreEqual(value2.GetElement(1), 2u);
- Assert.AreEqual(value2.GetElement(2), 3u);
- Assert.AreEqual(value2.GetElement(3), 4u);
+ Assert.Equal(value2.GetElement(0), 1u);
+ Assert.Equal(value2.GetElement(1), 2u);
+ Assert.Equal(value2.GetElement(2), 3u);
+ Assert.Equal(value2.GetElement(3), 4u);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector128UOut(1u, 2u, 3u, 4u, out Vector128<uint> value3));
Vector128<uint>* value4 = GenericsNative.GetVector128UPtr(1u, 2u, 3u, 4u);
- Assert.AreEqual(value4->GetElement(0), 1u);
- Assert.AreEqual(value4->GetElement(1), 2u);
- Assert.AreEqual(value4->GetElement(2), 3u);
- Assert.AreEqual(value4->GetElement(3), 4u);
+ Assert.Equal(value4->GetElement(0), 1u);
+ Assert.Equal(value4->GetElement(1), 2u);
+ Assert.Equal(value4->GetElement(2), 3u);
+ Assert.Equal(value4->GetElement(3), 4u);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector128URef(1u, 2u, 3u, 4u));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector256<bool> value2;
GenericsNative.GetVector256BOut(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, &value2);
Vector256<byte> tValue2 = *(Vector256<byte>*)&value2;
- Assert.AreEqual(tValue2.GetElement(0), 1);
- Assert.AreEqual(tValue2.GetElement(1), 0);
- Assert.AreEqual(tValue2.GetElement(2), 1);
- Assert.AreEqual(tValue2.GetElement(3), 0);
- Assert.AreEqual(tValue2.GetElement(4), 1);
- Assert.AreEqual(tValue2.GetElement(5), 0);
- Assert.AreEqual(tValue2.GetElement(6), 1);
- Assert.AreEqual(tValue2.GetElement(7), 0);
- Assert.AreEqual(tValue2.GetElement(8), 1);
- Assert.AreEqual(tValue2.GetElement(9), 0);
- Assert.AreEqual(tValue2.GetElement(10), 1);
- Assert.AreEqual(tValue2.GetElement(11), 0);
- Assert.AreEqual(tValue2.GetElement(12), 1);
- Assert.AreEqual(tValue2.GetElement(13), 0);
- Assert.AreEqual(tValue2.GetElement(14), 1);
- Assert.AreEqual(tValue2.GetElement(15), 0);
- Assert.AreEqual(tValue2.GetElement(16), 1);
- Assert.AreEqual(tValue2.GetElement(17), 0);
- Assert.AreEqual(tValue2.GetElement(18), 1);
- Assert.AreEqual(tValue2.GetElement(19), 0);
- Assert.AreEqual(tValue2.GetElement(20), 1);
- Assert.AreEqual(tValue2.GetElement(21), 0);
- Assert.AreEqual(tValue2.GetElement(22), 1);
- Assert.AreEqual(tValue2.GetElement(23), 0);
- Assert.AreEqual(tValue2.GetElement(24), 1);
- Assert.AreEqual(tValue2.GetElement(25), 0);
- Assert.AreEqual(tValue2.GetElement(26), 1);
- Assert.AreEqual(tValue2.GetElement(27), 0);
- Assert.AreEqual(tValue2.GetElement(28), 1);
- Assert.AreEqual(tValue2.GetElement(29), 0);
- Assert.AreEqual(tValue2.GetElement(30), 1);
- Assert.AreEqual(tValue2.GetElement(31), 0);
+ Assert.Equal(tValue2.GetElement(0), 1);
+ Assert.Equal(tValue2.GetElement(1), 0);
+ Assert.Equal(tValue2.GetElement(2), 1);
+ Assert.Equal(tValue2.GetElement(3), 0);
+ Assert.Equal(tValue2.GetElement(4), 1);
+ Assert.Equal(tValue2.GetElement(5), 0);
+ Assert.Equal(tValue2.GetElement(6), 1);
+ Assert.Equal(tValue2.GetElement(7), 0);
+ Assert.Equal(tValue2.GetElement(8), 1);
+ Assert.Equal(tValue2.GetElement(9), 0);
+ Assert.Equal(tValue2.GetElement(10), 1);
+ Assert.Equal(tValue2.GetElement(11), 0);
+ Assert.Equal(tValue2.GetElement(12), 1);
+ Assert.Equal(tValue2.GetElement(13), 0);
+ Assert.Equal(tValue2.GetElement(14), 1);
+ Assert.Equal(tValue2.GetElement(15), 0);
+ Assert.Equal(tValue2.GetElement(16), 1);
+ Assert.Equal(tValue2.GetElement(17), 0);
+ Assert.Equal(tValue2.GetElement(18), 1);
+ Assert.Equal(tValue2.GetElement(19), 0);
+ Assert.Equal(tValue2.GetElement(20), 1);
+ Assert.Equal(tValue2.GetElement(21), 0);
+ Assert.Equal(tValue2.GetElement(22), 1);
+ Assert.Equal(tValue2.GetElement(23), 0);
+ Assert.Equal(tValue2.GetElement(24), 1);
+ Assert.Equal(tValue2.GetElement(25), 0);
+ Assert.Equal(tValue2.GetElement(26), 1);
+ Assert.Equal(tValue2.GetElement(27), 0);
+ Assert.Equal(tValue2.GetElement(28), 1);
+ Assert.Equal(tValue2.GetElement(29), 0);
+ Assert.Equal(tValue2.GetElement(30), 1);
+ Assert.Equal(tValue2.GetElement(31), 0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector256BOut(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, out Vector256<bool> value3));
Vector256<bool>* value4 = GenericsNative.GetVector256BPtr(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false);
Vector256<byte>* tValue4 = (Vector256<byte>*)value4;
- Assert.AreEqual(tValue4->GetElement(0), 1);
- Assert.AreEqual(tValue4->GetElement(1), 0);
- Assert.AreEqual(tValue4->GetElement(2), 1);
- Assert.AreEqual(tValue4->GetElement(3), 0);
- Assert.AreEqual(tValue4->GetElement(4), 1);
- Assert.AreEqual(tValue4->GetElement(5), 0);
- Assert.AreEqual(tValue4->GetElement(6), 1);
- Assert.AreEqual(tValue4->GetElement(7), 0);
- Assert.AreEqual(tValue4->GetElement(8), 1);
- Assert.AreEqual(tValue4->GetElement(9), 0);
- Assert.AreEqual(tValue4->GetElement(10), 1);
- Assert.AreEqual(tValue4->GetElement(11), 0);
- Assert.AreEqual(tValue4->GetElement(12), 1);
- Assert.AreEqual(tValue4->GetElement(13), 0);
- Assert.AreEqual(tValue4->GetElement(14), 1);
- Assert.AreEqual(tValue4->GetElement(15), 0);
- Assert.AreEqual(tValue4->GetElement(16), 1);
- Assert.AreEqual(tValue4->GetElement(17), 0);
- Assert.AreEqual(tValue4->GetElement(18), 1);
- Assert.AreEqual(tValue4->GetElement(19), 0);
- Assert.AreEqual(tValue4->GetElement(20), 1);
- Assert.AreEqual(tValue4->GetElement(21), 0);
- Assert.AreEqual(tValue4->GetElement(22), 1);
- Assert.AreEqual(tValue4->GetElement(23), 0);
- Assert.AreEqual(tValue4->GetElement(24), 1);
- Assert.AreEqual(tValue4->GetElement(25), 0);
- Assert.AreEqual(tValue4->GetElement(26), 1);
- Assert.AreEqual(tValue4->GetElement(27), 0);
- Assert.AreEqual(tValue4->GetElement(28), 1);
- Assert.AreEqual(tValue4->GetElement(29), 0);
- Assert.AreEqual(tValue4->GetElement(30), 1);
- Assert.AreEqual(tValue4->GetElement(31), 0);
+ Assert.Equal(tValue4->GetElement(0), 1);
+ Assert.Equal(tValue4->GetElement(1), 0);
+ Assert.Equal(tValue4->GetElement(2), 1);
+ Assert.Equal(tValue4->GetElement(3), 0);
+ Assert.Equal(tValue4->GetElement(4), 1);
+ Assert.Equal(tValue4->GetElement(5), 0);
+ Assert.Equal(tValue4->GetElement(6), 1);
+ Assert.Equal(tValue4->GetElement(7), 0);
+ Assert.Equal(tValue4->GetElement(8), 1);
+ Assert.Equal(tValue4->GetElement(9), 0);
+ Assert.Equal(tValue4->GetElement(10), 1);
+ Assert.Equal(tValue4->GetElement(11), 0);
+ Assert.Equal(tValue4->GetElement(12), 1);
+ Assert.Equal(tValue4->GetElement(13), 0);
+ Assert.Equal(tValue4->GetElement(14), 1);
+ Assert.Equal(tValue4->GetElement(15), 0);
+ Assert.Equal(tValue4->GetElement(16), 1);
+ Assert.Equal(tValue4->GetElement(17), 0);
+ Assert.Equal(tValue4->GetElement(18), 1);
+ Assert.Equal(tValue4->GetElement(19), 0);
+ Assert.Equal(tValue4->GetElement(20), 1);
+ Assert.Equal(tValue4->GetElement(21), 0);
+ Assert.Equal(tValue4->GetElement(22), 1);
+ Assert.Equal(tValue4->GetElement(23), 0);
+ Assert.Equal(tValue4->GetElement(24), 1);
+ Assert.Equal(tValue4->GetElement(25), 0);
+ Assert.Equal(tValue4->GetElement(26), 1);
+ Assert.Equal(tValue4->GetElement(27), 0);
+ Assert.Equal(tValue4->GetElement(28), 1);
+ Assert.Equal(tValue4->GetElement(29), 0);
+ Assert.Equal(tValue4->GetElement(30), 1);
+ Assert.Equal(tValue4->GetElement(31), 0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector256BRef(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector256<char> value2;
GenericsNative.GetVector256COut('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', &value2);
Vector256<short> tValue2 = *(Vector256<short>*)&value2;
- Assert.AreEqual(tValue2.GetElement(0), (short)'0');
- Assert.AreEqual(tValue2.GetElement(1), (short)'1');
- Assert.AreEqual(tValue2.GetElement(2), (short)'2');
- Assert.AreEqual(tValue2.GetElement(3), (short)'3');
- Assert.AreEqual(tValue2.GetElement(4), (short)'4');
- Assert.AreEqual(tValue2.GetElement(5), (short)'5');
- Assert.AreEqual(tValue2.GetElement(6), (short)'6');
- Assert.AreEqual(tValue2.GetElement(7), (short)'7');
- Assert.AreEqual(tValue2.GetElement(8), (short)'8');
- Assert.AreEqual(tValue2.GetElement(9), (short)'9');
- Assert.AreEqual(tValue2.GetElement(10), (short)'A');
- Assert.AreEqual(tValue2.GetElement(11), (short)'B');
- Assert.AreEqual(tValue2.GetElement(12), (short)'C');
- Assert.AreEqual(tValue2.GetElement(13), (short)'D');
- Assert.AreEqual(tValue2.GetElement(14), (short)'E');
- Assert.AreEqual(tValue2.GetElement(15), (short)'F');
+ Assert.Equal(tValue2.GetElement(0), (short)'0');
+ Assert.Equal(tValue2.GetElement(1), (short)'1');
+ Assert.Equal(tValue2.GetElement(2), (short)'2');
+ Assert.Equal(tValue2.GetElement(3), (short)'3');
+ Assert.Equal(tValue2.GetElement(4), (short)'4');
+ Assert.Equal(tValue2.GetElement(5), (short)'5');
+ Assert.Equal(tValue2.GetElement(6), (short)'6');
+ Assert.Equal(tValue2.GetElement(7), (short)'7');
+ Assert.Equal(tValue2.GetElement(8), (short)'8');
+ Assert.Equal(tValue2.GetElement(9), (short)'9');
+ Assert.Equal(tValue2.GetElement(10), (short)'A');
+ Assert.Equal(tValue2.GetElement(11), (short)'B');
+ Assert.Equal(tValue2.GetElement(12), (short)'C');
+ Assert.Equal(tValue2.GetElement(13), (short)'D');
+ Assert.Equal(tValue2.GetElement(14), (short)'E');
+ Assert.Equal(tValue2.GetElement(15), (short)'F');
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector256COut('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', out Vector256<char> value3));
Vector256<char>* value4 = GenericsNative.GetVector256CPtr('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
Vector256<short>* tValue4 = (Vector256<short>*)value4;
- Assert.AreEqual(tValue4->GetElement(0), (short)'0');
- Assert.AreEqual(tValue4->GetElement(1), (short)'1');
- Assert.AreEqual(tValue4->GetElement(2), (short)'2');
- Assert.AreEqual(tValue4->GetElement(3), (short)'3');
- Assert.AreEqual(tValue4->GetElement(4), (short)'4');
- Assert.AreEqual(tValue4->GetElement(5), (short)'5');
- Assert.AreEqual(tValue4->GetElement(6), (short)'6');
- Assert.AreEqual(tValue4->GetElement(7), (short)'7');
- Assert.AreEqual(tValue4->GetElement(8), (short)'8');
- Assert.AreEqual(tValue4->GetElement(9), (short)'9');
- Assert.AreEqual(tValue4->GetElement(10), (short)'A');
- Assert.AreEqual(tValue4->GetElement(11), (short)'B');
- Assert.AreEqual(tValue4->GetElement(12), (short)'C');
- Assert.AreEqual(tValue4->GetElement(13), (short)'D');
- Assert.AreEqual(tValue4->GetElement(14), (short)'E');
- Assert.AreEqual(tValue4->GetElement(15), (short)'F');
+ Assert.Equal(tValue4->GetElement(0), (short)'0');
+ Assert.Equal(tValue4->GetElement(1), (short)'1');
+ Assert.Equal(tValue4->GetElement(2), (short)'2');
+ Assert.Equal(tValue4->GetElement(3), (short)'3');
+ Assert.Equal(tValue4->GetElement(4), (short)'4');
+ Assert.Equal(tValue4->GetElement(5), (short)'5');
+ Assert.Equal(tValue4->GetElement(6), (short)'6');
+ Assert.Equal(tValue4->GetElement(7), (short)'7');
+ Assert.Equal(tValue4->GetElement(8), (short)'8');
+ Assert.Equal(tValue4->GetElement(9), (short)'9');
+ Assert.Equal(tValue4->GetElement(10), (short)'A');
+ Assert.Equal(tValue4->GetElement(11), (short)'B');
+ Assert.Equal(tValue4->GetElement(12), (short)'C');
+ Assert.Equal(tValue4->GetElement(13), (short)'D');
+ Assert.Equal(tValue4->GetElement(14), (short)'E');
+ Assert.Equal(tValue4->GetElement(15), (short)'F');
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector256CRef('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector256<double> value2;
GenericsNative.GetVector256DOut(1.0, 2.0, 3.0, 4.0, &value2);
- Assert.AreEqual(value2.GetElement(0), 1.0);
- Assert.AreEqual(value2.GetElement(1), 2.0);
- Assert.AreEqual(value2.GetElement(2), 3.0);
- Assert.AreEqual(value2.GetElement(3), 4.0);
+ Assert.Equal(value2.GetElement(0), 1.0);
+ Assert.Equal(value2.GetElement(1), 2.0);
+ Assert.Equal(value2.GetElement(2), 3.0);
+ Assert.Equal(value2.GetElement(3), 4.0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector256DOut(1.0, 2.0, 3.0, 4.0, out Vector256<double> value3));
Vector256<double>* value4 = GenericsNative.GetVector256DPtr(1.0, 2.0, 3.0, 4.0);
- Assert.AreEqual(value4->GetElement(0), 1.0);
- Assert.AreEqual(value4->GetElement(1), 2.0);
- Assert.AreEqual(value4->GetElement(2), 3.0);
- Assert.AreEqual(value4->GetElement(3), 4.0);
+ Assert.Equal(value4->GetElement(0), 1.0);
+ Assert.Equal(value4->GetElement(1), 2.0);
+ Assert.Equal(value4->GetElement(2), 3.0);
+ Assert.Equal(value4->GetElement(3), 4.0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector256DRef(1.0, 2.0, 3.0, 4.0));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector256<float> value2;
GenericsNative.GetVector256FOut(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, &value2);
- Assert.AreEqual(value2.GetElement(0), 1.0f);
- Assert.AreEqual(value2.GetElement(1), 2.0f);
- Assert.AreEqual(value2.GetElement(2), 3.0f);
- Assert.AreEqual(value2.GetElement(3), 4.0f);
- Assert.AreEqual(value2.GetElement(4), 5.0f);
- Assert.AreEqual(value2.GetElement(5), 6.0f);
- Assert.AreEqual(value2.GetElement(6), 7.0f);
- Assert.AreEqual(value2.GetElement(7), 8.0f);
+ Assert.Equal(value2.GetElement(0), 1.0f);
+ Assert.Equal(value2.GetElement(1), 2.0f);
+ Assert.Equal(value2.GetElement(2), 3.0f);
+ Assert.Equal(value2.GetElement(3), 4.0f);
+ Assert.Equal(value2.GetElement(4), 5.0f);
+ Assert.Equal(value2.GetElement(5), 6.0f);
+ Assert.Equal(value2.GetElement(6), 7.0f);
+ Assert.Equal(value2.GetElement(7), 8.0f);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector256FOut(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, out Vector256<float> value3));
Vector256<float>* value4 = GenericsNative.GetVector256FPtr(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
- Assert.AreEqual(value4->GetElement(0), 1.0f);
- Assert.AreEqual(value4->GetElement(1), 2.0f);
- Assert.AreEqual(value4->GetElement(2), 3.0f);
- Assert.AreEqual(value4->GetElement(3), 4.0f);
- Assert.AreEqual(value4->GetElement(4), 5.0f);
- Assert.AreEqual(value4->GetElement(5), 6.0f);
- Assert.AreEqual(value4->GetElement(6), 7.0f);
- Assert.AreEqual(value4->GetElement(7), 8.0f);
+ Assert.Equal(value4->GetElement(0), 1.0f);
+ Assert.Equal(value4->GetElement(1), 2.0f);
+ Assert.Equal(value4->GetElement(2), 3.0f);
+ Assert.Equal(value4->GetElement(3), 4.0f);
+ Assert.Equal(value4->GetElement(4), 5.0f);
+ Assert.Equal(value4->GetElement(5), 6.0f);
+ Assert.Equal(value4->GetElement(6), 7.0f);
+ Assert.Equal(value4->GetElement(7), 8.0f);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector256FRef(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector256<long> value2;
GenericsNative.GetVector256LOut(1L, 2L, 3L, 4L, &value2);
- Assert.AreEqual(value2.GetElement(0), 1L);
- Assert.AreEqual(value2.GetElement(1), 2L);
- Assert.AreEqual(value2.GetElement(2), 3L);
- Assert.AreEqual(value2.GetElement(3), 4L);
+ Assert.Equal(value2.GetElement(0), 1L);
+ Assert.Equal(value2.GetElement(1), 2L);
+ Assert.Equal(value2.GetElement(2), 3L);
+ Assert.Equal(value2.GetElement(3), 4L);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector256LOut(1L, 2L, 3L, 4L, out Vector256<long> value3));
Vector256<long>* value4 = GenericsNative.GetVector256LPtr(1L, 2L, 3L, 4L);
- Assert.AreEqual(value4->GetElement(0), 1L);
- Assert.AreEqual(value4->GetElement(1), 2L);
- Assert.AreEqual(value4->GetElement(2), 3L);
- Assert.AreEqual(value4->GetElement(3), 4L);
+ Assert.Equal(value4->GetElement(0), 1L);
+ Assert.Equal(value4->GetElement(1), 2L);
+ Assert.Equal(value4->GetElement(2), 3L);
+ Assert.Equal(value4->GetElement(3), 4L);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector256LRef(1L, 2L, 3L, 4L));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector256<uint> value2;
GenericsNative.GetVector256UOut(1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, &value2);
- Assert.AreEqual(value2.GetElement(0), 1u);
- Assert.AreEqual(value2.GetElement(1), 2u);
- Assert.AreEqual(value2.GetElement(2), 3u);
- Assert.AreEqual(value2.GetElement(3), 4u);
- Assert.AreEqual(value2.GetElement(4), 5u);
- Assert.AreEqual(value2.GetElement(5), 6u);
- Assert.AreEqual(value2.GetElement(6), 7u);
- Assert.AreEqual(value2.GetElement(7), 8u);
+ Assert.Equal(value2.GetElement(0), 1u);
+ Assert.Equal(value2.GetElement(1), 2u);
+ Assert.Equal(value2.GetElement(2), 3u);
+ Assert.Equal(value2.GetElement(3), 4u);
+ Assert.Equal(value2.GetElement(4), 5u);
+ Assert.Equal(value2.GetElement(5), 6u);
+ Assert.Equal(value2.GetElement(6), 7u);
+ Assert.Equal(value2.GetElement(7), 8u);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector256UOut(1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, out Vector256<uint> value3));
Vector256<uint>* value4 = GenericsNative.GetVector256UPtr(1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u);
- Assert.AreEqual(value4->GetElement(0), 1u);
- Assert.AreEqual(value4->GetElement(1), 2u);
- Assert.AreEqual(value4->GetElement(2), 3u);
- Assert.AreEqual(value4->GetElement(3), 4u);
- Assert.AreEqual(value4->GetElement(4), 5u);
- Assert.AreEqual(value4->GetElement(5), 6u);
- Assert.AreEqual(value4->GetElement(6), 7u);
- Assert.AreEqual(value4->GetElement(7), 8u);
+ Assert.Equal(value4->GetElement(0), 1u);
+ Assert.Equal(value4->GetElement(1), 2u);
+ Assert.Equal(value4->GetElement(2), 3u);
+ Assert.Equal(value4->GetElement(3), 4u);
+ Assert.Equal(value4->GetElement(4), 5u);
+ Assert.Equal(value4->GetElement(5), 6u);
+ Assert.Equal(value4->GetElement(6), 7u);
+ Assert.Equal(value4->GetElement(7), 8u);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector256URef(1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector64<bool> value2;
GenericsNative.GetVector64BOut(true, false, true, false, true, false, true, false, &value2);
Vector64<byte> tValue2 = *(Vector64<byte>*)&value2;
- Assert.AreEqual(tValue2.GetElement(0), 1);
- Assert.AreEqual(tValue2.GetElement(1), 0);
- Assert.AreEqual(tValue2.GetElement(2), 1);
- Assert.AreEqual(tValue2.GetElement(3), 0);
- Assert.AreEqual(tValue2.GetElement(4), 1);
- Assert.AreEqual(tValue2.GetElement(5), 0);
- Assert.AreEqual(tValue2.GetElement(6), 1);
- Assert.AreEqual(tValue2.GetElement(7), 0);
+ Assert.Equal(tValue2.GetElement(0), 1);
+ Assert.Equal(tValue2.GetElement(1), 0);
+ Assert.Equal(tValue2.GetElement(2), 1);
+ Assert.Equal(tValue2.GetElement(3), 0);
+ Assert.Equal(tValue2.GetElement(4), 1);
+ Assert.Equal(tValue2.GetElement(5), 0);
+ Assert.Equal(tValue2.GetElement(6), 1);
+ Assert.Equal(tValue2.GetElement(7), 0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector64BOut(true, false, true, false, true, false, true, false, out Vector64<bool> value3));
Vector64<bool>* value4 = GenericsNative.GetVector64BPtr(true, false, true, false, true, false, true, false);
Vector64<byte>* tValue4 = (Vector64<byte>*)value4;
- Assert.AreEqual(tValue4->GetElement(0), 1);
- Assert.AreEqual(tValue4->GetElement(1), 0);
- Assert.AreEqual(tValue4->GetElement(2), 1);
- Assert.AreEqual(tValue4->GetElement(3), 0);
- Assert.AreEqual(tValue4->GetElement(4), 1);
- Assert.AreEqual(tValue4->GetElement(5), 0);
- Assert.AreEqual(tValue4->GetElement(6), 1);
- Assert.AreEqual(tValue4->GetElement(7), 0);
+ Assert.Equal(tValue4->GetElement(0), 1);
+ Assert.Equal(tValue4->GetElement(1), 0);
+ Assert.Equal(tValue4->GetElement(2), 1);
+ Assert.Equal(tValue4->GetElement(3), 0);
+ Assert.Equal(tValue4->GetElement(4), 1);
+ Assert.Equal(tValue4->GetElement(5), 0);
+ Assert.Equal(tValue4->GetElement(6), 1);
+ Assert.Equal(tValue4->GetElement(7), 0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector64BRef(true, false, true, false, true, false, true, false));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector64<char> value2;
GenericsNative.GetVector64COut('0', '1', '2', '3', &value2);
Vector64<short> tValue2 = *(Vector64<short>*)&value2;
- Assert.AreEqual(tValue2.GetElement(0), (short)'0');
- Assert.AreEqual(tValue2.GetElement(1), (short)'1');
- Assert.AreEqual(tValue2.GetElement(2), (short)'2');
- Assert.AreEqual(tValue2.GetElement(3), (short)'3');
+ Assert.Equal(tValue2.GetElement(0), (short)'0');
+ Assert.Equal(tValue2.GetElement(1), (short)'1');
+ Assert.Equal(tValue2.GetElement(2), (short)'2');
+ Assert.Equal(tValue2.GetElement(3), (short)'3');
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector64COut('0', '1', '2', '3', out Vector64<char> value3));
Vector64<char>* value4 = GenericsNative.GetVector64CPtr('0', '1', '2', '3');
Vector64<short>* tValue4 = (Vector64<short>*)value4;
- Assert.AreEqual(tValue4->GetElement(0), (short)'0');
- Assert.AreEqual(tValue4->GetElement(1), (short)'1');
- Assert.AreEqual(tValue4->GetElement(2), (short)'2');
- Assert.AreEqual(tValue4->GetElement(3), (short)'3');
+ Assert.Equal(tValue4->GetElement(0), (short)'0');
+ Assert.Equal(tValue4->GetElement(1), (short)'1');
+ Assert.Equal(tValue4->GetElement(2), (short)'2');
+ Assert.Equal(tValue4->GetElement(3), (short)'3');
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector64CRef('0', '1', '2', '3'));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector64<double> value2;
GenericsNative.GetVector64DOut(1.0, &value2);
- Assert.AreEqual(value2.GetElement(0), 1.0);
+ Assert.Equal(value2.GetElement(0), 1.0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector64DOut(1.0, out Vector64<double> value3));
Vector64<double>* value4 = GenericsNative.GetVector64DPtr(1.0);
- Assert.AreEqual(value4->GetElement(0), 1.0);
+ Assert.Equal(value4->GetElement(0), 1.0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector64DRef(1.0));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector64<float> value2;
GenericsNative.GetVector64FOut(1.0f, 2.0f, &value2);
- Assert.AreEqual(value2.GetElement(0), 1.0f);
- Assert.AreEqual(value2.GetElement(1), 2.0f);
+ Assert.Equal(value2.GetElement(0), 1.0f);
+ Assert.Equal(value2.GetElement(1), 2.0f);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector64FOut(1.0f, 2.0f, out Vector64<float> value3));
Vector64<float>* value4 = GenericsNative.GetVector64FPtr(1.0f, 2.0f);
- Assert.AreEqual(value4->GetElement(0), 1.0f);
- Assert.AreEqual(value4->GetElement(1), 2.0f);
+ Assert.Equal(value4->GetElement(0), 1.0f);
+ Assert.Equal(value4->GetElement(1), 2.0f);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector64FRef(1.0f, 2.0f));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector64<long> value2;
GenericsNative.GetVector64LOut(1L, &value2);
- Assert.AreEqual(value2.GetElement(0), 1L);
+ Assert.Equal(value2.GetElement(0), 1L);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector64LOut(1L, out Vector64<long> value3));
Vector64<long>* value4 = GenericsNative.GetVector64LPtr(1L);
- Assert.AreEqual(value4->GetElement(0), 1L);
+ Assert.Equal(value4->GetElement(0), 1L);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector64LRef(1L));
using System;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
Vector64<uint> value2;
GenericsNative.GetVector64UOut(1u, 2u, &value2);
- Assert.AreEqual(value2.GetElement(0), 1u);
- Assert.AreEqual(value2.GetElement(1), 2u);
+ Assert.Equal(value2.GetElement(0), 1u);
+ Assert.Equal(value2.GetElement(1), 2u);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector64UOut(1u, 2u, out Vector64<uint> value3));
Vector64<uint>* value4 = GenericsNative.GetVector64UPtr(1u, 2u);
- Assert.AreEqual(value4->GetElement(0), 1u);
- Assert.AreEqual(value4->GetElement(1), 2u);
+ Assert.Equal(value4->GetElement(0), 1u);
+ Assert.Equal(value4->GetElement(1), 2u);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVector64URef(1u, 2u));
using System;
using System.Numerics;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
}
else
{
- Assert.AreEqual(Vector<byte>.Count, 16);
+ Assert.Equal(Vector<byte>.Count, 16);
TestVectorB128();
}
}
Vector<bool> value2;
GenericsNative.GetVectorB128Out(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, &value2);
Vector<byte> tValue2 = *(Vector<byte>*)&value2;
- Assert.AreEqual(tValue2[0], 1);
- Assert.AreEqual(tValue2[1], 0);
- Assert.AreEqual(tValue2[2], 1);
- Assert.AreEqual(tValue2[3], 0);
- Assert.AreEqual(tValue2[4], 1);
- Assert.AreEqual(tValue2[5], 0);
- Assert.AreEqual(tValue2[6], 1);
- Assert.AreEqual(tValue2[7], 0);
- Assert.AreEqual(tValue2[8], 1);
- Assert.AreEqual(tValue2[9], 0);
- Assert.AreEqual(tValue2[10], 1);
- Assert.AreEqual(tValue2[11], 0);
- Assert.AreEqual(tValue2[12], 1);
- Assert.AreEqual(tValue2[13], 0);
- Assert.AreEqual(tValue2[14], 1);
- Assert.AreEqual(tValue2[15], 0);
+ Assert.Equal(tValue2[0], 1);
+ Assert.Equal(tValue2[1], 0);
+ Assert.Equal(tValue2[2], 1);
+ Assert.Equal(tValue2[3], 0);
+ Assert.Equal(tValue2[4], 1);
+ Assert.Equal(tValue2[5], 0);
+ Assert.Equal(tValue2[6], 1);
+ Assert.Equal(tValue2[7], 0);
+ Assert.Equal(tValue2[8], 1);
+ Assert.Equal(tValue2[9], 0);
+ Assert.Equal(tValue2[10], 1);
+ Assert.Equal(tValue2[11], 0);
+ Assert.Equal(tValue2[12], 1);
+ Assert.Equal(tValue2[13], 0);
+ Assert.Equal(tValue2[14], 1);
+ Assert.Equal(tValue2[15], 0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorB128Out(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, out Vector<bool> value3));
Vector<bool>* value4 = GenericsNative.GetVectorB128Ptr(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false);
Vector<byte>* tValue4 = (Vector<byte>*)value4;
- Assert.AreEqual((*tValue4)[0], 1);
- Assert.AreEqual((*tValue4)[1], 0);
- Assert.AreEqual((*tValue4)[2], 1);
- Assert.AreEqual((*tValue4)[3], 0);
- Assert.AreEqual((*tValue4)[4], 1);
- Assert.AreEqual((*tValue4)[5], 0);
- Assert.AreEqual((*tValue4)[6], 1);
- Assert.AreEqual((*tValue4)[7], 0);
- Assert.AreEqual((*tValue4)[8], 1);
- Assert.AreEqual((*tValue4)[9], 0);
- Assert.AreEqual((*tValue4)[10], 1);
- Assert.AreEqual((*tValue4)[11], 0);
- Assert.AreEqual((*tValue4)[12], 1);
- Assert.AreEqual((*tValue4)[13], 0);
- Assert.AreEqual((*tValue4)[14], 1);
- Assert.AreEqual((*tValue4)[15], 0);
+ Assert.Equal((*tValue4)[0], 1);
+ Assert.Equal((*tValue4)[1], 0);
+ Assert.Equal((*tValue4)[2], 1);
+ Assert.Equal((*tValue4)[3], 0);
+ Assert.Equal((*tValue4)[4], 1);
+ Assert.Equal((*tValue4)[5], 0);
+ Assert.Equal((*tValue4)[6], 1);
+ Assert.Equal((*tValue4)[7], 0);
+ Assert.Equal((*tValue4)[8], 1);
+ Assert.Equal((*tValue4)[9], 0);
+ Assert.Equal((*tValue4)[10], 1);
+ Assert.Equal((*tValue4)[11], 0);
+ Assert.Equal((*tValue4)[12], 1);
+ Assert.Equal((*tValue4)[13], 0);
+ Assert.Equal((*tValue4)[14], 1);
+ Assert.Equal((*tValue4)[15], 0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorB128Ref(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false));
Vector<bool> value2;
GenericsNative.GetVectorB256Out(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, &value2);
Vector<byte> tValue2 = *(Vector<byte>*)&value2;
- Assert.AreEqual(tValue2[0], 1);
- Assert.AreEqual(tValue2[1], 0);
- Assert.AreEqual(tValue2[2], 1);
- Assert.AreEqual(tValue2[3], 0);
- Assert.AreEqual(tValue2[4], 1);
- Assert.AreEqual(tValue2[5], 0);
- Assert.AreEqual(tValue2[6], 1);
- Assert.AreEqual(tValue2[7], 0);
- Assert.AreEqual(tValue2[8], 1);
- Assert.AreEqual(tValue2[9], 0);
- Assert.AreEqual(tValue2[10], 1);
- Assert.AreEqual(tValue2[11], 0);
- Assert.AreEqual(tValue2[12], 1);
- Assert.AreEqual(tValue2[13], 0);
- Assert.AreEqual(tValue2[14], 1);
- Assert.AreEqual(tValue2[15], 0);
- Assert.AreEqual(tValue2[16], 1);
- Assert.AreEqual(tValue2[17], 0);
- Assert.AreEqual(tValue2[18], 1);
- Assert.AreEqual(tValue2[19], 0);
- Assert.AreEqual(tValue2[20], 1);
- Assert.AreEqual(tValue2[21], 0);
- Assert.AreEqual(tValue2[22], 1);
- Assert.AreEqual(tValue2[23], 0);
- Assert.AreEqual(tValue2[24], 1);
- Assert.AreEqual(tValue2[25], 0);
- Assert.AreEqual(tValue2[26], 1);
- Assert.AreEqual(tValue2[27], 0);
- Assert.AreEqual(tValue2[28], 1);
- Assert.AreEqual(tValue2[29], 0);
- Assert.AreEqual(tValue2[30], 1);
- Assert.AreEqual(tValue2[31], 0);
+ Assert.Equal(tValue2[0], 1);
+ Assert.Equal(tValue2[1], 0);
+ Assert.Equal(tValue2[2], 1);
+ Assert.Equal(tValue2[3], 0);
+ Assert.Equal(tValue2[4], 1);
+ Assert.Equal(tValue2[5], 0);
+ Assert.Equal(tValue2[6], 1);
+ Assert.Equal(tValue2[7], 0);
+ Assert.Equal(tValue2[8], 1);
+ Assert.Equal(tValue2[9], 0);
+ Assert.Equal(tValue2[10], 1);
+ Assert.Equal(tValue2[11], 0);
+ Assert.Equal(tValue2[12], 1);
+ Assert.Equal(tValue2[13], 0);
+ Assert.Equal(tValue2[14], 1);
+ Assert.Equal(tValue2[15], 0);
+ Assert.Equal(tValue2[16], 1);
+ Assert.Equal(tValue2[17], 0);
+ Assert.Equal(tValue2[18], 1);
+ Assert.Equal(tValue2[19], 0);
+ Assert.Equal(tValue2[20], 1);
+ Assert.Equal(tValue2[21], 0);
+ Assert.Equal(tValue2[22], 1);
+ Assert.Equal(tValue2[23], 0);
+ Assert.Equal(tValue2[24], 1);
+ Assert.Equal(tValue2[25], 0);
+ Assert.Equal(tValue2[26], 1);
+ Assert.Equal(tValue2[27], 0);
+ Assert.Equal(tValue2[28], 1);
+ Assert.Equal(tValue2[29], 0);
+ Assert.Equal(tValue2[30], 1);
+ Assert.Equal(tValue2[31], 0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorB256Out(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, out Vector<bool> value3));
Vector<bool>* value4 = GenericsNative.GetVectorB256Ptr(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false);
Vector<byte>* tValue4 = (Vector<byte>*)value4;
- Assert.AreEqual((*tValue4)[0], 1);
- Assert.AreEqual((*tValue4)[1], 0);
- Assert.AreEqual((*tValue4)[2], 1);
- Assert.AreEqual((*tValue4)[3], 0);
- Assert.AreEqual((*tValue4)[4], 1);
- Assert.AreEqual((*tValue4)[5], 0);
- Assert.AreEqual((*tValue4)[6], 1);
- Assert.AreEqual((*tValue4)[7], 0);
- Assert.AreEqual((*tValue4)[8], 1);
- Assert.AreEqual((*tValue4)[9], 0);
- Assert.AreEqual((*tValue4)[10], 1);
- Assert.AreEqual((*tValue4)[11], 0);
- Assert.AreEqual((*tValue4)[12], 1);
- Assert.AreEqual((*tValue4)[13], 0);
- Assert.AreEqual((*tValue4)[14], 1);
- Assert.AreEqual((*tValue4)[15], 0);
- Assert.AreEqual((*tValue4)[16], 1);
- Assert.AreEqual((*tValue4)[17], 0);
- Assert.AreEqual((*tValue4)[18], 1);
- Assert.AreEqual((*tValue4)[19], 0);
- Assert.AreEqual((*tValue4)[20], 1);
- Assert.AreEqual((*tValue4)[21], 0);
- Assert.AreEqual((*tValue4)[22], 1);
- Assert.AreEqual((*tValue4)[23], 0);
- Assert.AreEqual((*tValue4)[24], 1);
- Assert.AreEqual((*tValue4)[25], 0);
- Assert.AreEqual((*tValue4)[26], 1);
- Assert.AreEqual((*tValue4)[27], 0);
- Assert.AreEqual((*tValue4)[28], 1);
- Assert.AreEqual((*tValue4)[29], 0);
- Assert.AreEqual((*tValue4)[30], 1);
- Assert.AreEqual((*tValue4)[31], 0);
+ Assert.Equal((*tValue4)[0], 1);
+ Assert.Equal((*tValue4)[1], 0);
+ Assert.Equal((*tValue4)[2], 1);
+ Assert.Equal((*tValue4)[3], 0);
+ Assert.Equal((*tValue4)[4], 1);
+ Assert.Equal((*tValue4)[5], 0);
+ Assert.Equal((*tValue4)[6], 1);
+ Assert.Equal((*tValue4)[7], 0);
+ Assert.Equal((*tValue4)[8], 1);
+ Assert.Equal((*tValue4)[9], 0);
+ Assert.Equal((*tValue4)[10], 1);
+ Assert.Equal((*tValue4)[11], 0);
+ Assert.Equal((*tValue4)[12], 1);
+ Assert.Equal((*tValue4)[13], 0);
+ Assert.Equal((*tValue4)[14], 1);
+ Assert.Equal((*tValue4)[15], 0);
+ Assert.Equal((*tValue4)[16], 1);
+ Assert.Equal((*tValue4)[17], 0);
+ Assert.Equal((*tValue4)[18], 1);
+ Assert.Equal((*tValue4)[19], 0);
+ Assert.Equal((*tValue4)[20], 1);
+ Assert.Equal((*tValue4)[21], 0);
+ Assert.Equal((*tValue4)[22], 1);
+ Assert.Equal((*tValue4)[23], 0);
+ Assert.Equal((*tValue4)[24], 1);
+ Assert.Equal((*tValue4)[25], 0);
+ Assert.Equal((*tValue4)[26], 1);
+ Assert.Equal((*tValue4)[27], 0);
+ Assert.Equal((*tValue4)[28], 1);
+ Assert.Equal((*tValue4)[29], 0);
+ Assert.Equal((*tValue4)[30], 1);
+ Assert.Equal((*tValue4)[31], 0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorB256Ref(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false));
using System;
using System.Numerics;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
}
else
{
- Assert.AreEqual(Vector<short>.Count, 8);
+ Assert.Equal(Vector<short>.Count, 8);
TestVectorC128();
}
}
Vector<char> value2;
GenericsNative.GetVectorC128Out('0', '1', '2', '3', '4', '5', '6', '7', &value2);
Vector<short> tValue2 = *(Vector<short>*)&value2;
- Assert.AreEqual(tValue2[0], (short)'0');
- Assert.AreEqual(tValue2[1], (short)'1');
- Assert.AreEqual(tValue2[2], (short)'2');
- Assert.AreEqual(tValue2[3], (short)'3');
- Assert.AreEqual(tValue2[4], (short)'4');
- Assert.AreEqual(tValue2[5], (short)'5');
- Assert.AreEqual(tValue2[6], (short)'6');
- Assert.AreEqual(tValue2[7], (short)'7');
+ Assert.Equal(tValue2[0], (short)'0');
+ Assert.Equal(tValue2[1], (short)'1');
+ Assert.Equal(tValue2[2], (short)'2');
+ Assert.Equal(tValue2[3], (short)'3');
+ Assert.Equal(tValue2[4], (short)'4');
+ Assert.Equal(tValue2[5], (short)'5');
+ Assert.Equal(tValue2[6], (short)'6');
+ Assert.Equal(tValue2[7], (short)'7');
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorC128Out('0', '1', '2', '3', '4', '5', '6', '7', out Vector<char> value3));
Vector<char>* value4 = GenericsNative.GetVectorC128Ptr('0', '1', '2', '3', '4', '5', '6', '7');
Vector<short>* tValue4 = (Vector<short>*)value4;
- Assert.AreEqual((*tValue4)[0], (short)'0');
- Assert.AreEqual((*tValue4)[1], (short)'1');
- Assert.AreEqual((*tValue4)[2], (short)'2');
- Assert.AreEqual((*tValue4)[3], (short)'3');
- Assert.AreEqual((*tValue4)[4], (short)'4');
- Assert.AreEqual((*tValue4)[5], (short)'5');
- Assert.AreEqual((*tValue4)[6], (short)'6');
- Assert.AreEqual((*tValue4)[7], (short)'7');
+ Assert.Equal((*tValue4)[0], (short)'0');
+ Assert.Equal((*tValue4)[1], (short)'1');
+ Assert.Equal((*tValue4)[2], (short)'2');
+ Assert.Equal((*tValue4)[3], (short)'3');
+ Assert.Equal((*tValue4)[4], (short)'4');
+ Assert.Equal((*tValue4)[5], (short)'5');
+ Assert.Equal((*tValue4)[6], (short)'6');
+ Assert.Equal((*tValue4)[7], (short)'7');
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorC128Ref('0', '1', '2', '3', '4', '5', '6', '7'));
Vector<char> value2;
GenericsNative.GetVectorC256Out('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', &value2);
Vector<short> tValue2 = *(Vector<short>*)&value2;
- Assert.AreEqual(tValue2[0], (short)'0');
- Assert.AreEqual(tValue2[1], (short)'1');
- Assert.AreEqual(tValue2[2], (short)'2');
- Assert.AreEqual(tValue2[3], (short)'3');
- Assert.AreEqual(tValue2[4], (short)'4');
- Assert.AreEqual(tValue2[5], (short)'5');
- Assert.AreEqual(tValue2[6], (short)'6');
- Assert.AreEqual(tValue2[7], (short)'7');
- Assert.AreEqual(tValue2[8], (short)'8');
- Assert.AreEqual(tValue2[9], (short)'9');
- Assert.AreEqual(tValue2[10], (short)'A');
- Assert.AreEqual(tValue2[11], (short)'B');
- Assert.AreEqual(tValue2[12], (short)'C');
- Assert.AreEqual(tValue2[13], (short)'D');
- Assert.AreEqual(tValue2[14], (short)'E');
- Assert.AreEqual(tValue2[15], (short)'F');
+ Assert.Equal(tValue2[0], (short)'0');
+ Assert.Equal(tValue2[1], (short)'1');
+ Assert.Equal(tValue2[2], (short)'2');
+ Assert.Equal(tValue2[3], (short)'3');
+ Assert.Equal(tValue2[4], (short)'4');
+ Assert.Equal(tValue2[5], (short)'5');
+ Assert.Equal(tValue2[6], (short)'6');
+ Assert.Equal(tValue2[7], (short)'7');
+ Assert.Equal(tValue2[8], (short)'8');
+ Assert.Equal(tValue2[9], (short)'9');
+ Assert.Equal(tValue2[10], (short)'A');
+ Assert.Equal(tValue2[11], (short)'B');
+ Assert.Equal(tValue2[12], (short)'C');
+ Assert.Equal(tValue2[13], (short)'D');
+ Assert.Equal(tValue2[14], (short)'E');
+ Assert.Equal(tValue2[15], (short)'F');
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorC256Out('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', out Vector<char> value3));
Vector<char>* value4 = GenericsNative.GetVectorC256Ptr('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
Vector<short>* tValue4 = (Vector<short>*)value4;
- Assert.AreEqual((*tValue4)[0], (short)'0');
- Assert.AreEqual((*tValue4)[1], (short)'1');
- Assert.AreEqual((*tValue4)[2], (short)'2');
- Assert.AreEqual((*tValue4)[3], (short)'3');
- Assert.AreEqual((*tValue4)[4], (short)'4');
- Assert.AreEqual((*tValue4)[5], (short)'5');
- Assert.AreEqual((*tValue4)[6], (short)'6');
- Assert.AreEqual((*tValue4)[7], (short)'7');
- Assert.AreEqual((*tValue4)[8], (short)'8');
- Assert.AreEqual((*tValue4)[9], (short)'9');
- Assert.AreEqual((*tValue4)[10], (short)'A');
- Assert.AreEqual((*tValue4)[11], (short)'B');
- Assert.AreEqual((*tValue4)[12], (short)'C');
- Assert.AreEqual((*tValue4)[13], (short)'D');
- Assert.AreEqual((*tValue4)[14], (short)'E');
- Assert.AreEqual((*tValue4)[15], (short)'F');
+ Assert.Equal((*tValue4)[0], (short)'0');
+ Assert.Equal((*tValue4)[1], (short)'1');
+ Assert.Equal((*tValue4)[2], (short)'2');
+ Assert.Equal((*tValue4)[3], (short)'3');
+ Assert.Equal((*tValue4)[4], (short)'4');
+ Assert.Equal((*tValue4)[5], (short)'5');
+ Assert.Equal((*tValue4)[6], (short)'6');
+ Assert.Equal((*tValue4)[7], (short)'7');
+ Assert.Equal((*tValue4)[8], (short)'8');
+ Assert.Equal((*tValue4)[9], (short)'9');
+ Assert.Equal((*tValue4)[10], (short)'A');
+ Assert.Equal((*tValue4)[11], (short)'B');
+ Assert.Equal((*tValue4)[12], (short)'C');
+ Assert.Equal((*tValue4)[13], (short)'D');
+ Assert.Equal((*tValue4)[14], (short)'E');
+ Assert.Equal((*tValue4)[15], (short)'F');
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorC256Ref('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'));
using System;
using System.Numerics;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
}
else
{
- Assert.AreEqual(Vector<double>.Count, 2);
+ Assert.Equal(Vector<double>.Count, 2);
TestVectorD128();
}
}
Vector<double> value2;
GenericsNative.GetVectorD128Out(1.0, 2.0, &value2);
- Assert.AreEqual(value2[0], 1.0);
- Assert.AreEqual(value2[1], 2.0);
+ Assert.Equal(value2[0], 1.0);
+ Assert.Equal(value2[1], 2.0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorD128Out(1.0, 2.0, out Vector<double> value3));
Vector<double>* value4 = GenericsNative.GetVectorD128Ptr(1.0, 2.0);
- Assert.AreEqual((*value4)[0], 1.0);
- Assert.AreEqual((*value4)[1], 2.0);
+ Assert.Equal((*value4)[0], 1.0);
+ Assert.Equal((*value4)[1], 2.0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorD128Ref(1.0, 2.0));
Vector<double> value2;
GenericsNative.GetVectorD256Out(1.0, 2.0, 3.0, 4.0, &value2);
- Assert.AreEqual(value2[0], 1.0);
- Assert.AreEqual(value2[1], 2.0);
- Assert.AreEqual(value2[2], 3.0);
- Assert.AreEqual(value2[3], 4.0);
+ Assert.Equal(value2[0], 1.0);
+ Assert.Equal(value2[1], 2.0);
+ Assert.Equal(value2[2], 3.0);
+ Assert.Equal(value2[3], 4.0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorD256Out(1.0, 2.0, 3.0, 4.0, out Vector<double> value3));
Vector<double>* value4 = GenericsNative.GetVectorD256Ptr(1.0, 2.0, 3.0, 4.0);
- Assert.AreEqual((*value4)[0], 1.0);
- Assert.AreEqual((*value4)[1], 2.0);
- Assert.AreEqual((*value4)[2], 3.0);
- Assert.AreEqual((*value4)[3], 4.0);
+ Assert.Equal((*value4)[0], 1.0);
+ Assert.Equal((*value4)[1], 2.0);
+ Assert.Equal((*value4)[2], 3.0);
+ Assert.Equal((*value4)[3], 4.0);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorD256Ref(1.0, 2.0, 3.0, 4.0));
using System;
using System.Numerics;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
}
else
{
- Assert.AreEqual(Vector<float>.Count, 4);
+ Assert.Equal(Vector<float>.Count, 4);
TestVectorF128();
}
}
Vector<float> value2;
GenericsNative.GetVectorF128Out(1.0f, 2.0f, 3.0f, 4.0f, &value2);
- Assert.AreEqual(value2[0], 1.0f);
- Assert.AreEqual(value2[1], 2.0f);
- Assert.AreEqual(value2[2], 3.0f);
- Assert.AreEqual(value2[3], 4.0f);
+ Assert.Equal(value2[0], 1.0f);
+ Assert.Equal(value2[1], 2.0f);
+ Assert.Equal(value2[2], 3.0f);
+ Assert.Equal(value2[3], 4.0f);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorF128Out(1.0f, 2.0f, 3.0f, 4.0f, out Vector<float> value3));
Vector<float>* value4 = GenericsNative.GetVectorF128Ptr(1.0f, 2.0f, 3.0f, 4.0f);
- Assert.AreEqual((*value4)[0], 1.0f);
- Assert.AreEqual((*value4)[1], 2.0f);
- Assert.AreEqual((*value4)[2], 3.0f);
- Assert.AreEqual((*value4)[3], 4.0f);
+ Assert.Equal((*value4)[0], 1.0f);
+ Assert.Equal((*value4)[1], 2.0f);
+ Assert.Equal((*value4)[2], 3.0f);
+ Assert.Equal((*value4)[3], 4.0f);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorF128Ref(1.0f, 2.0f, 3.0f, 4.0f));
Vector<float> value2;
GenericsNative.GetVectorF256Out(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, &value2);
- Assert.AreEqual(value2[0], 1.0f);
- Assert.AreEqual(value2[1], 2.0f);
- Assert.AreEqual(value2[2], 3.0f);
- Assert.AreEqual(value2[3], 4.0f);
- Assert.AreEqual(value2[4], 5.0f);
- Assert.AreEqual(value2[5], 6.0f);
- Assert.AreEqual(value2[6], 7.0f);
- Assert.AreEqual(value2[7], 8.0f);
+ Assert.Equal(value2[0], 1.0f);
+ Assert.Equal(value2[1], 2.0f);
+ Assert.Equal(value2[2], 3.0f);
+ Assert.Equal(value2[3], 4.0f);
+ Assert.Equal(value2[4], 5.0f);
+ Assert.Equal(value2[5], 6.0f);
+ Assert.Equal(value2[6], 7.0f);
+ Assert.Equal(value2[7], 8.0f);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorF256Out(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, out Vector<float> value3));
Vector<float>* value4 = GenericsNative.GetVectorF256Ptr(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
- Assert.AreEqual((*value4)[0], 1.0f);
- Assert.AreEqual((*value4)[1], 2.0f);
- Assert.AreEqual((*value4)[2], 3.0f);
- Assert.AreEqual((*value4)[3], 4.0f);
- Assert.AreEqual((*value4)[4], 5.0f);
- Assert.AreEqual((*value4)[5], 6.0f);
- Assert.AreEqual((*value4)[6], 7.0f);
- Assert.AreEqual((*value4)[7], 8.0f);
+ Assert.Equal((*value4)[0], 1.0f);
+ Assert.Equal((*value4)[1], 2.0f);
+ Assert.Equal((*value4)[2], 3.0f);
+ Assert.Equal((*value4)[3], 4.0f);
+ Assert.Equal((*value4)[4], 5.0f);
+ Assert.Equal((*value4)[5], 6.0f);
+ Assert.Equal((*value4)[6], 7.0f);
+ Assert.Equal((*value4)[7], 8.0f);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorF256Ref(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f));
using System;
using System.Numerics;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
}
else
{
- Assert.AreEqual(Vector<long>.Count, 2);
+ Assert.Equal(Vector<long>.Count, 2);
TestVectorL128();
}
}
Vector<long> value2;
GenericsNative.GetVectorL128Out(1L, 2L, &value2);
- Assert.AreEqual(value2[0], 1L);
- Assert.AreEqual(value2[1], 2L);
+ Assert.Equal(value2[0], 1L);
+ Assert.Equal(value2[1], 2L);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorL128Out(1L, 2L, out Vector<long> value3));
Vector<long>* value4 = GenericsNative.GetVectorL128Ptr(1L, 2L);
- Assert.AreEqual((*value4)[0], 1L);
- Assert.AreEqual((*value4)[1], 2L);
+ Assert.Equal((*value4)[0], 1L);
+ Assert.Equal((*value4)[1], 2L);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorL128Ref(1L, 2L));
Vector<long> value2;
GenericsNative.GetVectorL256Out(1L, 2L, 3L, 4L, &value2);
- Assert.AreEqual(value2[0], 1L);
- Assert.AreEqual(value2[1], 2L);
- Assert.AreEqual(value2[2], 3L);
- Assert.AreEqual(value2[3], 4L);
+ Assert.Equal(value2[0], 1L);
+ Assert.Equal(value2[1], 2L);
+ Assert.Equal(value2[2], 3L);
+ Assert.Equal(value2[3], 4L);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorL256Out(1L, 2L, 3L, 4L, out Vector<long> value3));
Vector<long>* value4 = GenericsNative.GetVectorL256Ptr(1L, 2L, 3L, 4L);
- Assert.AreEqual((*value4)[0], 1L);
- Assert.AreEqual((*value4)[1], 2L);
- Assert.AreEqual((*value4)[2], 3L);
- Assert.AreEqual((*value4)[3], 4L);
+ Assert.Equal((*value4)[0], 1L);
+ Assert.Equal((*value4)[1], 2L);
+ Assert.Equal((*value4)[2], 3L);
+ Assert.Equal((*value4)[3], 4L);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorL256Ref(1L, 2L, 3L, 4L));
using System;
using System.Numerics;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe partial class GenericsNative
{
}
else
{
- Assert.AreEqual(Vector<uint>.Count, 4);
+ Assert.Equal(Vector<uint>.Count, 4);
TestVectorU128();
}
}
Vector<uint> value2;
GenericsNative.GetVectorU128Out(1u, 2u, 3u, 4u, &value2);
- Assert.AreEqual(value2[0], 1u);
- Assert.AreEqual(value2[1], 2u);
- Assert.AreEqual(value2[2], 3u);
- Assert.AreEqual(value2[3], 4u);
+ Assert.Equal(value2[0], 1u);
+ Assert.Equal(value2[1], 2u);
+ Assert.Equal(value2[2], 3u);
+ Assert.Equal(value2[3], 4u);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorU128Out(1u, 2u, 3u, 4u, out Vector<uint> value3));
Vector<uint>* value4 = GenericsNative.GetVectorU128Ptr(1u, 2u, 3u, 4u);
- Assert.AreEqual((*value4)[0], 1u);
- Assert.AreEqual((*value4)[1], 2u);
- Assert.AreEqual((*value4)[2], 3u);
- Assert.AreEqual((*value4)[3], 4u);
+ Assert.Equal((*value4)[0], 1u);
+ Assert.Equal((*value4)[1], 2u);
+ Assert.Equal((*value4)[2], 3u);
+ Assert.Equal((*value4)[3], 4u);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorU128Ref(1u, 2u, 3u, 4u));
Vector<uint> value2;
GenericsNative.GetVectorU256Out(1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, &value2);
- Assert.AreEqual(value2[0], 1u);
- Assert.AreEqual(value2[1], 2u);
- Assert.AreEqual(value2[2], 3u);
- Assert.AreEqual(value2[3], 4u);
- Assert.AreEqual(value2[4], 5u);
- Assert.AreEqual(value2[5], 6u);
- Assert.AreEqual(value2[6], 7u);
- Assert.AreEqual(value2[7], 8u);
+ Assert.Equal(value2[0], 1u);
+ Assert.Equal(value2[1], 2u);
+ Assert.Equal(value2[2], 3u);
+ Assert.Equal(value2[3], 4u);
+ Assert.Equal(value2[4], 5u);
+ Assert.Equal(value2[5], 6u);
+ Assert.Equal(value2[6], 7u);
+ Assert.Equal(value2[7], 8u);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorU256Out(1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, out Vector<uint> value3));
Vector<uint>* value4 = GenericsNative.GetVectorU256Ptr(1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u);
- Assert.AreEqual((*value4)[0], 1u);
- Assert.AreEqual((*value4)[1], 2u);
- Assert.AreEqual((*value4)[2], 3u);
- Assert.AreEqual((*value4)[3], 4u);
- Assert.AreEqual((*value4)[4], 5u);
- Assert.AreEqual((*value4)[5], 6u);
- Assert.AreEqual((*value4)[6], 7u);
- Assert.AreEqual((*value4)[7], 8u);
+ Assert.Equal((*value4)[0], 1u);
+ Assert.Equal((*value4)[1], 2u);
+ Assert.Equal((*value4)[2], 3u);
+ Assert.Equal((*value4)[3], 4u);
+ Assert.Equal((*value4)[4], 5u);
+ Assert.Equal((*value4)[5], 6u);
+ Assert.Equal((*value4)[6], 7u);
+ Assert.Equal((*value4)[7], 8u);
Assert.Throws<MarshalDirectiveException>(() => GenericsNative.GetVectorU256Ref(1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u));
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
namespace PInvokeTests
{
{
private static void TestNativeToManaged()
{
- Assert.AreAllEqual(Enumerable.Range(1, 10), EnumeratorAsEnumerable(IEnumeratorNative.GetIntegerEnumerator(1, 10)));
- Assert.AreAllEqual(Enumerable.Range(1, 10), IEnumeratorNative.GetIntegerEnumeration(1, 10).OfType<int>());
+ AssertExtensions.CollectionEqual(Enumerable.Range(1, 10), EnumeratorAsEnumerable(IEnumeratorNative.GetIntegerEnumerator(1, 10)));
+ AssertExtensions.CollectionEqual(Enumerable.Range(1, 10), IEnumeratorNative.GetIntegerEnumeration(1, 10).OfType<int>());
}
private static void TestManagedToNative()
private static void TestNativeRoundTrip()
{
IEnumerator nativeEnumerator = IEnumeratorNative.GetIntegerEnumerator(1, 10);
- Assert.AreEqual(nativeEnumerator, IEnumeratorNative.PassThroughEnumerator(nativeEnumerator));
+ Assert.Equal(nativeEnumerator, IEnumeratorNative.PassThroughEnumerator(nativeEnumerator));
}
private static void TestManagedRoundTrip()
{
IEnumerator managedEnumerator = Enumerable.Range(1, 10).GetEnumerator();
- Assert.AreEqual(managedEnumerator, IEnumeratorNative.PassThroughEnumerator(managedEnumerator));
+ Assert.Equal(managedEnumerator, IEnumeratorNative.PassThroughEnumerator(managedEnumerator));
}
public static int Main()
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
static unsafe class CopyCtor
{
using System;
using System.Reflection;
using System.Text;
-using TestLibrary;
+using Xunit;
class HandleRefTest
{
int int1 = intManaged;
int* int1Ptr = &int1;
HandleRef hr1 = new HandleRef(new Object(), (IntPtr)int1Ptr);
- Assert.AreEqual(intReturn, MarshalPointer_In(hr1, stackGuard), "The return value is wrong");
- Assert.AreEqual(intManaged, int1, "The parameter value is changed");
-
+ Assert.Equal(intReturn, MarshalPointer_In(hr1, stackGuard));
+ Assert.Equal(intManaged, int1);
+
Console.WriteLine("MarshalPointer_InOut");
int int2 = intManaged;
int* int2Ptr = &int2;
HandleRef hr2 = new HandleRef(new Object(), (IntPtr)int2Ptr);
- Assert.AreEqual(intReturn, MarshalPointer_InOut(hr2, stackGuard), "The return value is wrong");
- Assert.AreEqual(intNative, int2, "The passed value is wrong");
-
+ Assert.Equal(intReturn, MarshalPointer_InOut(hr2, stackGuard));
+ Assert.Equal(intNative, int2);
+
Console.WriteLine("MarshalPointer_Out");
int int3 = intManaged;
int* int3Ptr = &int3;
HandleRef hr3 = new HandleRef(new Object(), (IntPtr)int3Ptr);
- Assert.AreEqual(intReturn, MarshalPointer_Out(hr3, stackGuard), "The return value is wrong");
- Assert.AreEqual(intNative, int3, "The passed value is wrong");
+ Assert.Equal(intReturn, MarshalPointer_Out(hr3, stackGuard));
+ Assert.Equal(intNative, int3);
- // Note that this scenario will always pass in a debug build because all values
- // stay rooted until the end of the method.
+ // Note that this scenario will always pass in a debug build because all values
+ // stay rooted until the end of the method.
Console.WriteLine("TestNoGC");
int* int4Ptr = (int*)Marshal.AllocHGlobal(sizeof(int)); // We don't free this memory so we don't have to worry about a GC run between freeing and return (possible in a GCStress mode).
CollectableClass collectableClass = new CollectableClass(int4Ptr);
HandleRef hr4 = new HandleRef(collectableClass, (IntPtr)int4Ptr);
Action gcCallback = () => { Console.WriteLine("GC callback now"); GC.Collect(2, GCCollectionMode.Forced); GC.WaitForPendingFinalizers(); GC.Collect(2, GCCollectionMode.Forced); };
- Assert.AreEqual(intReturn, TestNoGC(hr4, gcCallback), "The return value is wrong");
+ Assert.Equal(intReturn, TestNoGC(hr4, gcCallback));
Console.WriteLine("Native code finished");
Console.WriteLine("InvalidMarshalPointer_Return");
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
class MultipleAssembliesWithSamePInvokeTest
{
public static int Main(string[] args)
{
try{
- Assert.AreEqual(24, GetInt(), "MultipleAssembliesWithSamePInvoke.GetInt() failed.");
- Assert.AreEqual(24, ManagedDll1.Class1.GetInt(), "ManagedDll.Class1.GetInt() failed.");
- Assert.AreEqual(24, ManagedDll2.Class2.GetInt(), "ManagedDll.Class2.GetInt() failed.");
-
+ Assert.Equal(24, GetInt());
+ Assert.Equal(24, ManagedDll1.Class1.GetInt());
+ Assert.Equal(24, ManagedDll2.Class2.GetInt());
+
return 100;
} catch (Exception e){
- Console.WriteLine($"Test Failure: {e}");
- return 101;
- }
+ Console.WriteLine($"Test Failure: {e}");
+ return 101;
+ }
}
}
using System.Runtime.InteropServices;
using System.Collections.Generic;
using NativeCallManagedComVisible;
-using TestLibrary;
+using Xunit;
-// Setting ComVisible to true makes the types in this assembly visible
-// to COM components by default. If you don't need to access a type in
+// Setting ComVisible to true makes the types in this assembly visible
+// to COM components by default. If you don't need to access a type in
// this assembly from COM, set the ComVisible attribute to false on that type.
[assembly: ComVisible(true)]
/// <summary>
/// Interface visible with ComVisible(true) and without Custom Attribute Guid.
-/// Note that in this test, change the method sequence in the interface will
+/// Note that in this test, change the method sequence in the interface will
/// change the GUID and could reduce the test efficiency.
/// </summary>
[ComVisible(true)]
int IDerivedInterfaceVisibleTrueNoGuid.Foo1(UInt16 int16Val, bool boolVal) { return 13; }
int IDerivedInterfaceVisibleTrueNoGuid.Foo5(Int32 int32Val) { return 14; }
int IDerivedInterfaceWithoutVisibleNoGuid.Foo7(Int32 int32Val) { return 15; }
- int IInterfaceNotVisibleNoGuid.Foo() { return 16; }
+ int IInterfaceNotVisibleNoGuid.Foo() { return 16; }
int IInterfaceComImport_ComImport.Foo() { return 101; }
int IInterfaceVisibleTrue_ComImport.Foo() { return 102; }
/// </summary>
[ComVisible(true)]
[Guid("CF681980-CE6D-421E-8B21-AEAE3F1B7DAC")]
- public sealed class NestedClassVisibleTrueServer :
+ public sealed class NestedClassVisibleTrueServer :
INestedInterfaceComImport, INestedInterfaceVisibleTrue, INestedInterfaceVisibleFalse, INestedInterfaceWithoutVisible, INestedInterfaceNotPublic,
NestedClass.INestedInterfaceNestedInClass, INestedInterfaceComImport_ComImport, INestedInterfaceVisibleTrue_ComImport, INestedInterfaceVisibleFalse_ComImport,
INestedInterfaceVisibleTrue_VisibleTrue, INestedInterfaceVisibleFalse_VisibleTrue, INestedInterfaceVisibleTrue_VisibleFalse, INestedInterfaceNotPublic_VisibleTrue
/// </summary>
[ComVisible(false)]
[Guid("6DF17EC1-A8F4-4693-B195-EDB27DF00170")]
- public sealed class NestedClassVisibleFalseServer :
+ public sealed class NestedClassVisibleFalseServer :
INestedInterfaceComImport, INestedInterfaceVisibleTrue, INestedInterfaceVisibleFalse, INestedInterfaceWithoutVisible, INestedInterfaceNotPublic
{
int INestedInterfaceComImport.Foo() { return 20; }
/// Nested class not visible without ComVisible().
/// </summary>
[Guid("A57430B8-E0C1-486E-AE57-A15D6A729F99")]
- public sealed class NestedClassWithoutVisibleServer :
+ public sealed class NestedClassWithoutVisibleServer :
INestedInterfaceComImport, INestedInterfaceVisibleTrue, INestedInterfaceVisibleFalse, INestedInterfaceWithoutVisible, INestedInterfaceNotPublic
{
int INestedInterfaceComImport.Foo() { return 30; }
[DllImport("ComVisibleNative")]
public static extern int CCWTest_InterfaceVisibleTrue([MarshalAs(UnmanagedType.IUnknown)] object unk, out int fooSuccessVal);
-
+
[DllImport("ComVisibleNative")]
public static extern int CCWTest_InterfaceVisibleFalse([MarshalAs(UnmanagedType.IUnknown)] object unk, out int fooSuccessVal);
-
+
[DllImport("ComVisibleNative")]
public static extern int CCWTest_InterfaceWithoutVisible([MarshalAs(UnmanagedType.IUnknown)] object unk, out int fooSuccessVal);
[DllImport("ComVisibleNative")]
public static extern int CCWTest_NestedInterfaceNotPublic([MarshalAs(UnmanagedType.IUnknown)] object unk, out int fooSuccessVal);
-
+
[DllImport("ComVisibleNative")]
public static extern int CCWTest_NestedInterfaceNestedInClass([MarshalAs(UnmanagedType.IUnknown)] object unk, out int fooSuccessVal);
ClassVisibleTrueServer visibleBaseClass = new ClassVisibleTrueServer();
Console.WriteLine("CCWTest_InterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceComImport((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(1, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceComImport((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(1, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(2, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(2, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)visibleBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_InterfaceWithoutVisible");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceWithoutVisible((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(4, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceWithoutVisible((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(4, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)visibleBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_InterfaceVisibleTrueNoGuid");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrueNoGuid((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(6, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrueNoGuid((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(6, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceNotVisibleNoGuid");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceNotVisibleNoGuid((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(16, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceNotVisibleNoGuid((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(16, fooSuccessVal);
//
// Tests for nested Interface in a class with ComVisible(true)
//
Console.WriteLine("Nested Interface in a class with ComVisible(true)");
-
+
Console.WriteLine("CCWTest_InterfaceComImport_ComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceComImport_ComImport((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(101, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceComImport_ComImport((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(101, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleTrue_ComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_ComImport((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(102, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_ComImport((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(102, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleFalse_ComImport");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse_ComImport((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse_ComImport((object)visibleBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_InterfaceVisibleTrue_VisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_VisibleTrue((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(104, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_VisibleTrue((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(104, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleFalse_VisibleTrue");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse_VisibleTrue((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse_VisibleTrue((object)visibleBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_InterfaceVisibleTrue_VisibleFalse");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_VisibleFalse((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(106, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_VisibleFalse((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(106, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceNotPublic_VisibleTrue");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic_VisibleTrue((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic_VisibleTrue((object)visibleBaseClass, out fooSuccessVal));
//
// Tests for class with ComVisible(false)
ClassVisibleFalseServer visibleFalseBaseClass = new ClassVisibleFalseServer();
Console.WriteLine("CCWTest_InterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceComImport((object)visibleFalseBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(120, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceComImport((object)visibleFalseBaseClass, out fooSuccessVal));
+ Assert.Equal(120, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)visibleFalseBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(121, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)visibleFalseBaseClass, out fooSuccessVal));
+ Assert.Equal(121, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)visibleFalseBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)visibleFalseBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_InterfaceWithoutVisible");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceWithoutVisible((object)visibleFalseBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(123, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceWithoutVisible((object)visibleFalseBaseClass, out fooSuccessVal));
+ Assert.Equal(123, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)visibleFalseBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)visibleFalseBaseClass, out fooSuccessVal));
//
// Tests for class without ComVisible()
ClassWithoutVisibleServer withoutVisibleBaseClass = new ClassWithoutVisibleServer();
Console.WriteLine("CCWTest_InterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceComImport((object)withoutVisibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(130, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceComImport((object)withoutVisibleBaseClass, out fooSuccessVal));
+ Assert.Equal(130, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)withoutVisibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(131, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)withoutVisibleBaseClass, out fooSuccessVal));
+ Assert.Equal(131, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)withoutVisibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)withoutVisibleBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_InterfaceWithoutVisible");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceWithoutVisible((object)withoutVisibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(133, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceWithoutVisible((object)withoutVisibleBaseClass, out fooSuccessVal));
+ Assert.Equal(133, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)withoutVisibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)withoutVisibleBaseClass, out fooSuccessVal));
//
ClassGenericServer<int> genericServer = new ClassGenericServer<int>();
Console.WriteLine("CCWTest_InterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceComImport((object)genericServer, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(140, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceComImport((object)genericServer, out fooSuccessVal));
+ Assert.Equal(140, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)genericServer, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(141, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)genericServer, out fooSuccessVal));
+ Assert.Equal(141, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceGenericVisibleTrue");
- Assert.AreEqual(Helpers.COR_E_INVALIDOPERATION, CCWTest_InterfaceGenericVisibleTrue((object)genericServer, out fooSuccessVal), "Returned diferent exception than the expected COR_E_INVALIDOPERATION.");
+ Assert.Equal(Helpers.COR_E_INVALIDOPERATION, CCWTest_InterfaceGenericVisibleTrue((object)genericServer, out fooSuccessVal));
//
// Tests for nested class with ComVisible(true)
//
Console.WriteLine("Nested class with ComVisible(true)");
NestedClassVisibleTrueServer visibleNestedBaseClass = new NestedClassVisibleTrueServer();
-
+
Console.WriteLine("CCWTest_NestedInterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(10, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(10, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(11, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(11, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)visibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)visibleNestedBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_NestedInterfaceWithoutVisible");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceWithoutVisible((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(13, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceWithoutVisible((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(13, fooSuccessVal);
+
Console.WriteLine("CCWTest_NestedInterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)visibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)visibleNestedBaseClass, out fooSuccessVal));
//
// Tests for nested Interface in a nested class with ComVisible(true)
Console.WriteLine("Nested Interface in a nested class with ComVisible(true)");
Console.WriteLine("CCWTest_NestedInterfaceNestedInClass");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceNestedInClass((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(110, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceNestedInClass((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(110, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceComImport_ComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceComImport_ComImport((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(111, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceComImport_ComImport((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(111, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue_ComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_ComImport((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(112, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_ComImport((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(112, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleFalse_ComImport");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse_ComImport((object)visibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse_ComImport((object)visibleNestedBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue_VisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(114, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(114, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleFalse_VisibleTrue");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue_VisibleFalse");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_VisibleFalse((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(116, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_VisibleFalse((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(116, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceNotPublic_VisibleTrue");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal));
//
// Tests for nested class with ComVisible(false)
//
Console.WriteLine("Nested class with ComVisible(false)");
NestedClassVisibleFalseServer visibleFalseNestedBaseClass = new NestedClassVisibleFalseServer();
-
+
Console.WriteLine("CCWTest_NestedInterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)visibleFalseNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(20, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)visibleFalseNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(20, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)visibleFalseNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(21, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)visibleFalseNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(21, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)visibleFalseNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)visibleFalseNestedBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_NestedInterfaceWithoutVisible");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceWithoutVisible((object)visibleFalseNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(23, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceWithoutVisible((object)visibleFalseNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(23, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)visibleFalseNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)visibleFalseNestedBaseClass, out fooSuccessVal));
//
// Tests for nested class without ComVisible()
//
Console.WriteLine("Nested class without ComVisible()");
NestedClassWithoutVisibleServer withoutVisibleNestedBaseClass = new NestedClassWithoutVisibleServer();
-
+
Console.WriteLine("CCWTest_NestedInterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)withoutVisibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(30, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)withoutVisibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(30, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)withoutVisibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(31, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)withoutVisibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(31, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)withoutVisibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)withoutVisibleNestedBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_NestedInterfaceWithoutVisible");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceWithoutVisible((object)withoutVisibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(33, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceWithoutVisible((object)withoutVisibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(33, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)withoutVisibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)withoutVisibleNestedBaseClass, out fooSuccessVal));
//
// Tests for generic nested class with ComVisible(true)
//
Console.WriteLine("Nested generic class with ComVisible(true)");
NestedClassGenericServer<int> nestedGenericServer = new NestedClassGenericServer<int>();
-
+
Console.WriteLine("CCWTest_NestedInterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)nestedGenericServer, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(40, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)nestedGenericServer, out fooSuccessVal));
+ Assert.Equal(40, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)nestedGenericServer, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(41, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)nestedGenericServer, out fooSuccessVal));
+ Assert.Equal(41, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceGenericVisibleTrue");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceGenericVisibleTrue((object)nestedGenericServer, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceGenericVisibleTrue((object)nestedGenericServer, out fooSuccessVal));
}
-
+
public static int Main()
{
try
using System.Runtime.InteropServices;
using System.Collections.Generic;
using NativeCallManagedComVisible;
-using TestLibrary;
+using Xunit;
// Don't set ComVisible.
// [assembly: ComVisible(true)]
/// <summary>
/// Interface visible with ComVisible(true) and without Custom Attribute Guid.
-/// Note that in this test, change the method sequence in the interface will
+/// Note that in this test, change the method sequence in the interface will
/// change the GUID and could reduce the test efficiency.
/// </summary>
[ComVisible(true)]
ClassVisibleTrueServer visibleBaseClass = new ClassVisibleTrueServer();
Console.WriteLine("CCWTest_InterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceComImport((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(1, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceComImport((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(1, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(2, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(2, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)visibleBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_InterfaceWithoutVisible");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceWithoutVisible((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(4, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceWithoutVisible((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(4, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)visibleBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_InterfaceVisibleTrueNoGuid");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrueNoGuid((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(6, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrueNoGuid((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(6, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceNotVisibleNoGuid");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceNotVisibleNoGuid((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(16, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceNotVisibleNoGuid((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(16, fooSuccessVal);
//
// Tests for nested Interface in a class with ComVisible(true)
Console.WriteLine("Nested Interface in a class with ComVisible(true)");
Console.WriteLine("CCWTest_InterfaceComImport_ComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceComImport_ComImport((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(101, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceComImport_ComImport((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(101, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceVisibleTrue_ComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_ComImport((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(102, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_ComImport((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(102, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceVisibleFalse_ComImport");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse_ComImport((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse_ComImport((object)visibleBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_InterfaceVisibleTrue_VisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_VisibleTrue((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(104, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_VisibleTrue((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(104, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceVisibleFalse_VisibleTrue");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse_VisibleTrue((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse_VisibleTrue((object)visibleBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_InterfaceVisibleTrue_VisibleFalse");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_VisibleFalse((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(106, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_VisibleFalse((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(106, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceNotPublic_VisibleTrue");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic_VisibleTrue((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic_VisibleTrue((object)visibleBaseClass, out fooSuccessVal));
//
// Tests for class with ComVisible(false)
ClassVisibleFalseServer visibleFalseBaseClass = new ClassVisibleFalseServer();
Console.WriteLine("CCWTest_InterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceComImport((object)visibleFalseBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(120, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceComImport((object)visibleFalseBaseClass, out fooSuccessVal));
+ Assert.Equal(120, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)visibleFalseBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(121, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)visibleFalseBaseClass, out fooSuccessVal));
+ Assert.Equal(121, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)visibleFalseBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)visibleFalseBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_InterfaceWithoutVisible");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceWithoutVisible((object)visibleFalseBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(123, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceWithoutVisible((object)visibleFalseBaseClass, out fooSuccessVal));
+ Assert.Equal(123, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)visibleFalseBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)visibleFalseBaseClass, out fooSuccessVal));
//
// Tests for class without ComVisible()
ClassWithoutVisibleServer withoutVisibleBaseClass = new ClassWithoutVisibleServer();
Console.WriteLine("CCWTest_InterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceComImport((object)withoutVisibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(130, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceComImport((object)withoutVisibleBaseClass, out fooSuccessVal));
+ Assert.Equal(130, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)withoutVisibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(131, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)withoutVisibleBaseClass, out fooSuccessVal));
+ Assert.Equal(131, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)withoutVisibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)withoutVisibleBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_InterfaceWithoutVisible");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceWithoutVisible((object)withoutVisibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(133, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceWithoutVisible((object)withoutVisibleBaseClass, out fooSuccessVal));
+ Assert.Equal(133, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)withoutVisibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)withoutVisibleBaseClass, out fooSuccessVal));
//
ClassGenericServer<int> genericServer = new ClassGenericServer<int>();
Console.WriteLine("CCWTest_InterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceComImport((object)genericServer, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(140, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceComImport((object)genericServer, out fooSuccessVal));
+ Assert.Equal(140, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)genericServer, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(141, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)genericServer, out fooSuccessVal));
+ Assert.Equal(141, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceGenericVisibleTrue");
- Assert.AreEqual(Helpers.COR_E_INVALIDOPERATION, CCWTest_InterfaceGenericVisibleTrue((object)genericServer, out fooSuccessVal), "Returned diferent exception than the expected COR_E_INVALIDOPERATION.");
+ Assert.Equal(Helpers.COR_E_INVALIDOPERATION, CCWTest_InterfaceGenericVisibleTrue((object)genericServer, out fooSuccessVal));
//
// Tests for nested class with ComVisible(true)
NestedClassVisibleTrueServer visibleNestedBaseClass = new NestedClassVisibleTrueServer();
Console.WriteLine("CCWTest_NestedInterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(10, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(10, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(11, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(11, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)visibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)visibleNestedBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_NestedInterfaceWithoutVisible");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceWithoutVisible((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(13, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceWithoutVisible((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(13, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)visibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)visibleNestedBaseClass, out fooSuccessVal));
//
// Tests for nested Interface in a nested class with ComVisible(true)
Console.WriteLine("Nested Interface in a nested class with ComVisible(true)");
Console.WriteLine("CCWTest_NestedInterfaceNestedInClass");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceNestedInClass((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(110, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceNestedInClass((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(110, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceComImport_ComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceComImport_ComImport((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(111, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceComImport_ComImport((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(111, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue_ComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_ComImport((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(112, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_ComImport((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(112, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleFalse_ComImport");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse_ComImport((object)visibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse_ComImport((object)visibleNestedBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue_VisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(114, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(114, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleFalse_VisibleTrue");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue_VisibleFalse");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_VisibleFalse((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(116, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_VisibleFalse((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(116, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceNotPublic_VisibleTrue");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal));
//
// Tests for nested class with ComVisible(false)
NestedClassVisibleFalseServer visibleFalseNestedBaseClass = new NestedClassVisibleFalseServer();
Console.WriteLine("CCWTest_NestedInterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)visibleFalseNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(20, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)visibleFalseNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(20, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)visibleFalseNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(21, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)visibleFalseNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(21, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)visibleFalseNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)visibleFalseNestedBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_NestedInterfaceWithoutVisible");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceWithoutVisible((object)visibleFalseNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(23, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceWithoutVisible((object)visibleFalseNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(23, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)visibleFalseNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)visibleFalseNestedBaseClass, out fooSuccessVal));
//
// Tests for nested class without ComVisible()
NestedClassWithoutVisibleServer withoutVisibleNestedBaseClass = new NestedClassWithoutVisibleServer();
Console.WriteLine("CCWTest_NestedInterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)withoutVisibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(30, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)withoutVisibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(30, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)withoutVisibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(31, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)withoutVisibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(31, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)withoutVisibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)withoutVisibleNestedBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_NestedInterfaceWithoutVisible");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceWithoutVisible((object)withoutVisibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(33, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceWithoutVisible((object)withoutVisibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(33, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)withoutVisibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)withoutVisibleNestedBaseClass, out fooSuccessVal));
//
// Tests for generic nested class with ComVisible(true)
NestedClassGenericServer<int> nestedGenericServer = new NestedClassGenericServer<int>();
Console.WriteLine("CCWTest_NestedInterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)nestedGenericServer, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(40, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)nestedGenericServer, out fooSuccessVal));
+ Assert.Equal(40, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)nestedGenericServer, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(41, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)nestedGenericServer, out fooSuccessVal));
+ Assert.Equal(41, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceGenericVisibleTrue");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceGenericVisibleTrue((object)nestedGenericServer, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceGenericVisibleTrue((object)nestedGenericServer, out fooSuccessVal));
}
-
+
public static int Main()
{
try
using System.Reflection;
using System.Collections.Generic;
using NativeCallManagedComVisible;
-using TestLibrary;
+using Xunit;
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components by default. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components by default. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
/// <summary>
/// Interface visible with ComVisible(true) and without Custom Attribute Guid.
-/// Note that in this test, change the method sequence in the interface will
+/// Note that in this test, change the method sequence in the interface will
/// change the GUID and could reduce the test efficiency.
/// </summary>
[ComVisible(true)]
[ComVisible(true)]
[Guid("48FC2EFC-C7ED-4E02-8D02-F05B6A439FC9")]
public sealed class ClassVisibleTrueServer :
- IInterfaceComImport, IInterfaceVisibleTrue, IInterfaceVisibleFalse, IInterfaceWithoutVisible, IInterfaceNotPublic,
+ IInterfaceComImport, IInterfaceVisibleTrue, IInterfaceVisibleFalse, IInterfaceWithoutVisible, IInterfaceNotPublic,
IInterfaceVisibleTrueNoGuid, IInterfaceNotVisibleNoGuid, IInterfaceVisibleTrueNoGuidGenericInterface,
IInterfaceComImport_ComImport, IInterfaceVisibleTrue_ComImport, IInterfaceVisibleFalse_ComImport,
IInterfaceVisibleTrue_VisibleTrue, IInterfaceVisibleFalse_VisibleTrue, IInterfaceVisibleTrue_VisibleFalse, IInterfaceNotPublic_VisibleTrue
int IInterfaceVisibleTrueNoGuid.Foo() { return 6; }
int IInterfaceVisibleTrueNoGuid.Foo1(UInt16 int16Val, bool boolVal) { return 7; }
- int IInterfaceVisibleTrueNoGuid.Foo2(string str, out int outIntVal, IntPtr intPtrVal, int[] arrayVal, byte inByteVal, int inIntVal)
+ int IInterfaceVisibleTrueNoGuid.Foo2(string str, out int outIntVal, IntPtr intPtrVal, int[] arrayVal, byte inByteVal, int inIntVal)
{
- outIntVal = 10;
- return 8;
+ outIntVal = 10;
+ return 8;
}
int IInterfaceVisibleTrueNoGuid.Foo3(ref short refShortVal, params byte[] paramsList) { return 9; }
int IInterfaceVisibleTrueNoGuid.Foo4(ref List<short> refShortVal, GenericClassW2Pars<int, short> genericClass, params object[] paramsList) { return 10; }
int IInterfaceVisibleTrueNoGuidGenericInterface.Foo() { return 17; }
int IInterfaceVisibleTrueNoGuidGenericInterface.Foo9(List<int> listInt) { return 18; }
int IInterfaceVisibleTrueNoGuidGenericInterface.Foo10(ICollection<int> intCollection, ICollection<string> stringCollection) { return 19; }
-
+
int IInterfaceComImport_ComImport.Foo() { return 101; }
int IInterfaceVisibleTrue_ComImport.Foo() { return 102; }
int IInterfaceVisibleFalse_ComImport.Foo() { return 103; }
/// <summary>
/// Class visible with ComVisible(true) and without Custom Attribute Guid.
-/// Note that in this test, change the method sequence in the interface will
+/// Note that in this test, change the method sequence in the interface will
/// change the GUID and could broke the test or reduce the test efficiency.
/// </summary>
[ComVisible(true)]
/// </summary>
[ComVisible(true)]
[Guid("CF681980-CE6D-421E-8B21-AEAE3F1B7DAC")]
- public sealed class NestedClassVisibleTrueServer :
+ public sealed class NestedClassVisibleTrueServer :
INestedInterfaceComImport, INestedInterfaceVisibleTrue, INestedInterfaceVisibleFalse, INestedInterfaceWithoutVisible, INestedInterfaceNotPublic,
INestedInterfaceVisibleTrueNoGuid, NestedClass.INestedInterfaceNestedInClassNoGuid,
NestedClass.INestedInterfaceNestedInClass, INestedInterfaceComImport_ComImport, INestedInterfaceVisibleTrue_ComImport, INestedInterfaceVisibleFalse_ComImport,
/// </summary>
[ComVisible(false)]
[Guid("6DF17EC1-A8F4-4693-B195-EDB27DF00170")]
- public sealed class NestedClassVisibleFalseServer :
+ public sealed class NestedClassVisibleFalseServer :
INestedInterfaceComImport, INestedInterfaceVisibleTrue, INestedInterfaceVisibleFalse, INestedInterfaceWithoutVisible, INestedInterfaceNotPublic
{
int INestedInterfaceComImport.Foo() { return 20; }
/// Nested class not visible without ComVisible().
/// </summary>
[Guid("A57430B8-E0C1-486E-AE57-A15D6A729F99")]
- public sealed class NestedClassWithoutVisibleServer :
+ public sealed class NestedClassWithoutVisibleServer :
INestedInterfaceComImport, INestedInterfaceVisibleTrue, INestedInterfaceVisibleFalse, INestedInterfaceWithoutVisible, INestedInterfaceNotPublic
{
int INestedInterfaceComImport.Foo() { return 30; }
[DllImport("ComVisibleNative")]
public static extern int CCWTest_InterfaceVisibleTrue([MarshalAs(UnmanagedType.IUnknown)] object unk, out int fooSuccessVal);
-
+
[DllImport("ComVisibleNative")]
public static extern int CCWTest_InterfaceVisibleFalse([MarshalAs(UnmanagedType.IUnknown)] object unk, out int fooSuccessVal);
-
+
[DllImport("ComVisibleNative")]
public static extern int CCWTest_InterfaceWithoutVisible([MarshalAs(UnmanagedType.IUnknown)] object unk, out int fooSuccessVal);
[DllImport("ComVisibleNative")]
public static extern int CCWTest_NestedInterfaceNotPublic([MarshalAs(UnmanagedType.IUnknown)] object unk, out int fooSuccessVal);
-
+
[DllImport("ComVisibleNative")]
public static extern int CCWTest_NestedInterfaceNestedInClass([MarshalAs(UnmanagedType.IUnknown)] object unk, out int fooSuccessVal);
ClassVisibleTrueServer visibleBaseClass = new ClassVisibleTrueServer();
Console.WriteLine("CCWTest_InterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceComImport((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(1, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceComImport((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(1, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(2, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(2, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)visibleBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_InterfaceWithoutVisible");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceWithoutVisible((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceWithoutVisible((object)visibleBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_InterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)visibleBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_InterfaceVisibleTrueNoGuid");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrueNoGuid((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(6, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrueNoGuid((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(6, fooSuccessVal);
Console.WriteLine("CCWTest_InterfaceVisibleTrueNoGuidGenericInterface");
- Assert.AreEqual(Helpers.COR_E_GENERICMETHOD, CCWTest_InterfaceVisibleTrueNoGuidGenericInterface((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.COR_E_GENERICMETHOD, CCWTest_InterfaceVisibleTrueNoGuidGenericInterface((object)visibleBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_InterfaceNotVisibleNoGuid");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotVisibleNoGuid((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotVisibleNoGuid((object)visibleBaseClass, out fooSuccessVal));
//
// Tests for nested Interface in a class with ComVisible(true)
//
Console.WriteLine("Nested Interface in a class with ComVisible(true)");
-
+
Console.WriteLine("CCWTest_InterfaceComImport_ComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceComImport_ComImport((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(101, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceComImport_ComImport((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(101, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleTrue_ComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_ComImport((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(102, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_ComImport((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(102, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleFalse_ComImport");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse_ComImport((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse_ComImport((object)visibleBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_InterfaceVisibleTrue_VisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_VisibleTrue((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(104, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_VisibleTrue((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(104, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleFalse_VisibleTrue");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse_VisibleTrue((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse_VisibleTrue((object)visibleBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_InterfaceVisibleTrue_VisibleFalse");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_VisibleFalse((object)visibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(106, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue_VisibleFalse((object)visibleBaseClass, out fooSuccessVal));
+ Assert.Equal(106, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceNotPublic_VisibleTrue");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic_VisibleTrue((object)visibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic_VisibleTrue((object)visibleBaseClass, out fooSuccessVal));
//
// Tests for class with ComVisible(false)
ClassVisibleFalseServer visibleFalseBaseClass = new ClassVisibleFalseServer();
Console.WriteLine("CCWTest_InterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceComImport((object)visibleFalseBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(120, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceComImport((object)visibleFalseBaseClass, out fooSuccessVal));
+ Assert.Equal(120, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)visibleFalseBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(121, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)visibleFalseBaseClass, out fooSuccessVal));
+ Assert.Equal(121, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)visibleFalseBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)visibleFalseBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_InterfaceWithoutVisible");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceWithoutVisible((object)visibleFalseBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceWithoutVisible((object)visibleFalseBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_InterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)visibleFalseBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)visibleFalseBaseClass, out fooSuccessVal));
//
// Tests for class without ComVisible()
ClassWithoutVisibleServer withoutVisibleBaseClass = new ClassWithoutVisibleServer();
Console.WriteLine("CCWTest_InterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceComImport((object)withoutVisibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(130, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceComImport((object)withoutVisibleBaseClass, out fooSuccessVal));
+ Assert.Equal(130, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)withoutVisibleBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(131, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)withoutVisibleBaseClass, out fooSuccessVal));
+ Assert.Equal(131, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)withoutVisibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceVisibleFalse((object)withoutVisibleBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_InterfaceWithoutVisible");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceWithoutVisible((object)withoutVisibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceWithoutVisible((object)withoutVisibleBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_InterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)withoutVisibleBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_InterfaceNotPublic((object)withoutVisibleBaseClass, out fooSuccessVal));
//
// Tests for generic class with ComVisible(true)
ClassGenericServer<int> genericServer = new ClassGenericServer<int>();
Console.WriteLine("CCWTest_InterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceComImport((object)genericServer, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(140, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceComImport((object)genericServer, out fooSuccessVal));
+ Assert.Equal(140, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)genericServer, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(141, fooSuccessVal, "COM method didn't return the expected value.");
-
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)genericServer, out fooSuccessVal));
+ Assert.Equal(141, fooSuccessVal);
+
Console.WriteLine("CCWTest_InterfaceGenericVisibleTrue");
- Assert.AreEqual(Helpers.COR_E_INVALIDOPERATION, CCWTest_InterfaceGenericVisibleTrue((object)genericServer, out fooSuccessVal), "Returned diferent exception than the expected COR_E_INVALIDOPERATION.");
+ Assert.Equal(Helpers.COR_E_INVALIDOPERATION, CCWTest_InterfaceGenericVisibleTrue((object)genericServer, out fooSuccessVal));
//
// Tests for nested class with ComVisible(true)
//
Console.WriteLine("Nested class with ComVisible(true)");
NestedClassVisibleTrueServer visibleNestedBaseClass = new NestedClassVisibleTrueServer();
-
+
Console.WriteLine("CCWTest_NestedInterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(10, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(10, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(11, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(11, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)visibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)visibleNestedBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_NestedInterfaceWithoutVisible");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceWithoutVisible((object)visibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceWithoutVisible((object)visibleNestedBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_NestedInterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)visibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)visibleNestedBaseClass, out fooSuccessVal));
//
// Tests for nested Interface in a nested class with ComVisible(true)
Console.WriteLine("Nested Interface in a nested class with ComVisible(true)");
Console.WriteLine("CCWTest_NestedInterfaceNestedInClass");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceNestedInClass((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(110, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceNestedInClass((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(110, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrueNoGuid");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrueNoGuid((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(50, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrueNoGuid((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(50, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceNestedInClassNoGuid");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceNestedInClassNoGuid((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(51, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceNestedInClassNoGuid((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(51, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceComImport_ComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceComImport_ComImport((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(111, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceComImport_ComImport((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(111, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue_ComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_ComImport((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(112, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_ComImport((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(112, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleFalse_ComImport");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse_ComImport((object)visibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse_ComImport((object)visibleNestedBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue_VisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(114, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(114, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleFalse_VisibleTrue");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
-
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal));
+
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue_VisibleFalse");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_VisibleFalse((object)visibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(116, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue_VisibleFalse((object)visibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(116, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceNotPublic_VisibleTrue");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic_VisibleTrue((object)visibleNestedBaseClass, out fooSuccessVal));
//
// Tests for nested class with ComVisible(false)
//
Console.WriteLine("Nested class with ComVisible(false)");
NestedClassVisibleFalseServer visibleFalseNestedBaseClass = new NestedClassVisibleFalseServer();
-
+
Console.WriteLine("CCWTest_NestedInterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)visibleFalseNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(20, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)visibleFalseNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(20, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)visibleFalseNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(21, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)visibleFalseNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(21, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)visibleFalseNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)visibleFalseNestedBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_NestedInterfaceWithoutVisible");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceWithoutVisible((object)visibleFalseNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceWithoutVisible((object)visibleFalseNestedBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_NestedInterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)visibleFalseNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)visibleFalseNestedBaseClass, out fooSuccessVal));
//
// Tests for nested class without ComVisible()
//
Console.WriteLine("Nested class without ComVisible()");
NestedClassWithoutVisibleServer withoutVisibleNestedBaseClass = new NestedClassWithoutVisibleServer();
-
+
Console.WriteLine("CCWTest_NestedInterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)withoutVisibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(30, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)withoutVisibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(30, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)withoutVisibleNestedBaseClass, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(31, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)withoutVisibleNestedBaseClass, out fooSuccessVal));
+ Assert.Equal(31, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleFalse");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)withoutVisibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceVisibleFalse((object)withoutVisibleNestedBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_NestedInterfaceWithoutVisible");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceWithoutVisible((object)withoutVisibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceWithoutVisible((object)withoutVisibleNestedBaseClass, out fooSuccessVal));
Console.WriteLine("CCWTest_NestedInterfaceNotPublic");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)withoutVisibleNestedBaseClass, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceNotPublic((object)withoutVisibleNestedBaseClass, out fooSuccessVal));
//
// Tests for generic nested class with ComVisible(true)
//
Console.WriteLine("Nested generic class with ComVisible(true)");
NestedClassGenericServer<int> nestedGenericServer = new NestedClassGenericServer<int>();
-
+
Console.WriteLine("CCWTest_NestedInterfaceComImport");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)nestedGenericServer, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(40, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceComImport((object)nestedGenericServer, out fooSuccessVal));
+ Assert.Equal(40, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)nestedGenericServer, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(41, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_NestedInterfaceVisibleTrue((object)nestedGenericServer, out fooSuccessVal));
+ Assert.Equal(41, fooSuccessVal);
Console.WriteLine("CCWTest_NestedInterfaceGenericVisibleTrue");
- Assert.AreEqual(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceGenericVisibleTrue((object)nestedGenericServer, out fooSuccessVal), "Returned diferent exception than the expected E_NOINTERFACE.");
+ Assert.Equal(Helpers.E_NOINTERFACE, CCWTest_NestedInterfaceGenericVisibleTrue((object)nestedGenericServer, out fooSuccessVal));
//
// Tests for class with ComVisible(true) without Custom Attribute Guid.
ClassVisibleTrueServerNoGuid visibleBaseClassNoGuid = new ClassVisibleTrueServerNoGuid();
Console.WriteLine("CCWTest_InterfaceVisibleTrue");
- Assert.AreEqual(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)visibleBaseClassNoGuid, out fooSuccessVal), "COM method thrown an unexpected exception.");
- Assert.AreEqual(150, fooSuccessVal, "COM method didn't return the expected value.");
+ Assert.Equal(Helpers.S_OK, CCWTest_InterfaceVisibleTrue((object)visibleBaseClassNoGuid, out fooSuccessVal));
+ Assert.Equal(150, fooSuccessVal);
//
// Tests for get the GetTypeInfo().GUID for Interface and class without Custom Attribute Guid.
Console.WriteLine("GetTypeInfo().GUID for Interface and Class without GUID");
Console.WriteLine("IInterfaceVisibleTrueNoGuid.GUID");
- Assert.AreEqual<Guid>(new Guid("ad50a327-d23a-38a4-9d6e-b32b32acf572"), typeof(IInterfaceVisibleTrueNoGuid).GetTypeInfo().GUID,
- typeof(IInterfaceVisibleTrueNoGuid).GetTypeInfo() + " returns a wrong GUID {" + typeof(IInterfaceVisibleTrueNoGuid).GetTypeInfo().GUID + "}");
+ Assert.Equal<Guid>(new Guid("ad50a327-d23a-38a4-9d6e-b32b32acf572"), typeof(IInterfaceVisibleTrueNoGuid).GetTypeInfo().GUID);
Console.WriteLine("IInterfaceNotVisibleNoGuid.GUID");
- Assert.AreEqual<Guid>(new Guid("b45587ec-9671-35bc-8b8e-f6bfb18a4d3a"), typeof(IInterfaceNotVisibleNoGuid).GetTypeInfo().GUID,
- typeof(IInterfaceNotVisibleNoGuid).GetTypeInfo() + " returns a wrong GUID {" + typeof(IInterfaceNotVisibleNoGuid).GetTypeInfo().GUID + "}");
+ Assert.Equal<Guid>(new Guid("b45587ec-9671-35bc-8b8e-f6bfb18a4d3a"), typeof(IInterfaceNotVisibleNoGuid).GetTypeInfo().GUID);
Console.WriteLine("IDerivedInterfaceVisibleTrueNoGuid.GUID");
- Assert.AreEqual<Guid>(new Guid("c3f73319-f6b3-3ef6-a095-8cb04fb8cf8b"), typeof(IDerivedInterfaceVisibleTrueNoGuid).GetTypeInfo().GUID,
- typeof(IDerivedInterfaceVisibleTrueNoGuid).GetTypeInfo() + " returns a wrong GUID {" + typeof(IDerivedInterfaceVisibleTrueNoGuid).GetTypeInfo().GUID + "}");
+ Assert.Equal<Guid>(new Guid("c3f73319-f6b3-3ef6-a095-8cb04fb8cf8b"), typeof(IDerivedInterfaceVisibleTrueNoGuid).GetTypeInfo().GUID);
Console.WriteLine("IInterfaceVisibleTrueNoGuidGeneric.GUID");
- Assert.AreEqual<Guid>(new Guid("50c0a59c-b6e1-36dd-b488-a905b54910d4"), typeof(IInterfaceVisibleTrueNoGuidGeneric).GetTypeInfo().GUID,
- typeof(IInterfaceVisibleTrueNoGuidGeneric).GetTypeInfo() + " returns a wrong GUID {" + typeof(IInterfaceVisibleTrueNoGuidGeneric).GetTypeInfo().GUID + "}");
+ Assert.Equal<Guid>(new Guid("50c0a59c-b6e1-36dd-b488-a905b54910d4"), typeof(IInterfaceVisibleTrueNoGuidGeneric).GetTypeInfo().GUID);
Console.WriteLine("IInterfaceVisibleTrueNoGuidGenericInterface.GUID");
- Assert.AreEqual<Guid>(new Guid("384f0b5c-28d0-368c-8c7e-5e31a84a5c84"), typeof(IInterfaceVisibleTrueNoGuidGenericInterface).GetTypeInfo().GUID,
- typeof(IInterfaceVisibleTrueNoGuidGenericInterface).GetTypeInfo() + " returns a wrong GUID {" + typeof(IInterfaceVisibleTrueNoGuidGenericInterface).GetTypeInfo().GUID + "}");
+ Assert.Equal<Guid>(new Guid("384f0b5c-28d0-368c-8c7e-5e31a84a5c84"), typeof(IInterfaceVisibleTrueNoGuidGenericInterface).GetTypeInfo().GUID);
Console.WriteLine("ClassVisibleTrueServerNoGuid.GUID");
- Assert.AreEqual<Guid>(new Guid("afb3aafc-75bc-35d3-be41-a399c2701929"), typeof(ClassVisibleTrueServerNoGuid).GetTypeInfo().GUID,
- typeof(ClassVisibleTrueServerNoGuid).GetTypeInfo() + " returns a wrong GUID {" + typeof(ClassVisibleTrueServerNoGuid).GetTypeInfo().GUID + "}");
+ Assert.Equal<Guid>(new Guid("afb3aafc-75bc-35d3-be41-a399c2701929"), typeof(ClassVisibleTrueServerNoGuid).GetTypeInfo().GUID);
Console.WriteLine("INestedInterfaceNestedInClassNoGuid.GUID");
- Assert.AreEqual<Guid>(new Guid("486bcec9-904d-3445-871c-e7084a52eb1a"), typeof(NestedClass.INestedInterfaceNestedInClassNoGuid).GetTypeInfo().GUID,
- typeof(NestedClass.INestedInterfaceNestedInClassNoGuid).GetTypeInfo() + " returns a wrong GUID {" + typeof(NestedClass.INestedInterfaceNestedInClassNoGuid).GetTypeInfo().GUID + "}");
+ Assert.Equal<Guid>(new Guid("486bcec9-904d-3445-871c-e7084a52eb1a"), typeof(NestedClass.INestedInterfaceNestedInClassNoGuid).GetTypeInfo().GUID);
Console.WriteLine("INestedInterfaceVisibleTrueNoGuid.GUID");
- Assert.AreEqual<Guid>(new Guid("0ea2cb33-db9f-3655-9240-47ef1dea0f1e"), typeof(INestedInterfaceVisibleTrueNoGuid).GetTypeInfo().GUID,
- typeof(INestedInterfaceVisibleTrueNoGuid).GetTypeInfo() + " returns a wrong GUID {" + typeof(INestedInterfaceVisibleTrueNoGuid).GetTypeInfo().GUID + "}");
+ Assert.Equal<Guid>(new Guid("0ea2cb33-db9f-3655-9240-47ef1dea0f1e"), typeof(INestedInterfaceVisibleTrueNoGuid).GetTypeInfo().GUID);
}
-
+
public static int Main()
{
try
using System.Runtime.InteropServices;
using System;
using System.Reflection;
-using TestLibrary;
+using Xunit;
class TestClass
{
private static void TestRuntimeMethodHandle()
{
RuntimeMethodHandle handle = typeof(TestClass).GetMethod(nameof(TestClass.Method)).MethodHandle;
- Assert.IsTrue(Marshal_In(handle, handle.Value));
+ Assert.True(Marshal_In(handle, handle.Value));
}
private static void TestRuntimeFieldHandle()
{
RuntimeFieldHandle handle = typeof(TestClass).GetField(nameof(TestClass.field)).FieldHandle;
- Assert.IsTrue(Marshal_In(handle, handle.Value));
+ Assert.True(Marshal_In(handle, handle.Value));
}
private static void TestRuntimeTypeHandle()
{
RuntimeTypeHandle handle = typeof(TestClass).TypeHandle;
- Assert.IsTrue(Marshal_In(handle, handle.Value));
+ Assert.True(Marshal_In(handle, handle.Value));
}
public static int Main()
using System;
using System.IO;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
namespace SafeHandleTests
{
using System;
using System.IO;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
namespace SafeHandleTests
{
Assert.Throws<InvalidOperationException>(() => SafeHandleNative.GetHandleAndCookie(out _, value, out h));
- Assert.AreEqual(value, h.DangerousGetHandle());
+ Assert.Equal(value, h.DangerousGetHandle());
// Try again, this time triggering unmarshal failure with an array.
value = (IntPtr)456;
Assert.Throws<OverflowException>(() => SafeHandleNative.GetHandleAndArray(out _, out _, value, out h));
- Assert.AreEqual(value, h.DangerousGetHandle());
+ Assert.Equal(value, h.DangerousGetHandle());
}
}
}
using System;
using System.IO;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
namespace SafeHandleTests
{
public static void RunTest()
{
var testHandle = new TestSafeHandle(initialValue);
- Assert.IsTrue(SafeHandleNative.SafeHandleByValue(testHandle, initialValue));
- Assert.IsFalse(testHandle.IsClosed);
+ Assert.True(SafeHandleNative.SafeHandleByValue(testHandle, initialValue));
+ Assert.False(testHandle.IsClosed);
- Assert.IsTrue(SafeHandleNative.SafeHandleByRef(ref testHandle, initialValue, newValue));
- Assert.IsFalse(testHandle.IsClosed);
+ Assert.True(SafeHandleNative.SafeHandleByRef(ref testHandle, initialValue, newValue));
+ Assert.False(testHandle.IsClosed);
testHandle = null;
SafeHandleNative.SafeHandleOut(out testHandle, initialValue);
- Assert.IsFalse(testHandle.IsClosed);
+ Assert.False(testHandle.IsClosed);
testHandle = SafeHandleNative.SafeHandleReturn(newValue);
- Assert.IsFalse(testHandle.IsClosed);
+ Assert.False(testHandle.IsClosed);
testHandle = SafeHandleNative.SafeHandleReturn_Swapped(newValue);
- Assert.IsFalse(testHandle.IsClosed);
+ Assert.False(testHandle.IsClosed);
var str = new SafeHandleNative.StructWithHandle
{
};
SafeHandleNative.StructWithSafeHandleByValue(str, initialValue);
- Assert.IsFalse(str.handle.IsClosed);
-
+ Assert.False(str.handle.IsClosed);
+
SafeHandleNative.StructWithSafeHandleByRef(ref str, initialValue, initialValue);
- Assert.IsFalse(str.handle.IsClosed);
+ Assert.False(str.handle.IsClosed);
}
}
}
using System;
using System.IO;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
namespace SafeHandleTests
{
public static void RunTest()
{
var testHandle = new TestSafeHandle(initialValue);
- Assert.IsTrue(SafeHandleNative.SafeHandleByValue(testHandle, initialValue));
+ Assert.True(SafeHandleNative.SafeHandleByValue(testHandle, initialValue));
- Assert.IsTrue(SafeHandleNative.SafeHandleByRef(ref testHandle, initialValue, newValue));
- Assert.AreEqual(newValue, testHandle.DangerousGetHandle());
+ Assert.True(SafeHandleNative.SafeHandleByRef(ref testHandle, initialValue, newValue));
+ Assert.Equal(newValue, testHandle.DangerousGetHandle());
AbstractDerivedSafeHandle abstrHandle = new AbstractDerivedSafeHandleImplementation(initialValue);
- Assert.IsTrue(SafeHandleNative.SafeHandleInByRef(abstrHandle, initialValue));
+ Assert.True(SafeHandleNative.SafeHandleInByRef(abstrHandle, initialValue));
Assert.Throws<MarshalDirectiveException>(() => SafeHandleNative.SafeHandleByRef(ref abstrHandle, initialValue, newValue));
NoDefaultConstructorSafeHandle noDefaultCtorHandle = new NoDefaultConstructorSafeHandle(initialValue);
testHandle = null;
SafeHandleNative.SafeHandleOut(out testHandle, initialValue);
- Assert.AreEqual(initialValue, testHandle.DangerousGetHandle());
+ Assert.Equal(initialValue, testHandle.DangerousGetHandle());
testHandle = SafeHandleNative.SafeHandleReturn(newValue);
- Assert.AreEqual(newValue, testHandle.DangerousGetHandle());
-
+ Assert.Equal(newValue, testHandle.DangerousGetHandle());
+
Assert.Throws<MarshalDirectiveException>(() => SafeHandleNative.SafeHandleReturn_AbstractDerived(initialValue));
Assert.Throws<MissingMethodException>(() => SafeHandleNative.SafeHandleReturn_NoDefaultConstructor(initialValue));
var abstractDerivedImplementationHandle = SafeHandleNative.SafeHandleReturn_AbstractDerivedImplementation(initialValue);
- Assert.AreEqual(initialValue, abstractDerivedImplementationHandle.DangerousGetHandle());
-
+ Assert.Equal(initialValue, abstractDerivedImplementationHandle.DangerousGetHandle());
+
testHandle = SafeHandleNative.SafeHandleReturn_Swapped(newValue);
- Assert.AreEqual(newValue, testHandle.DangerousGetHandle());
-
+ Assert.Equal(newValue, testHandle.DangerousGetHandle());
+
Assert.Throws<MarshalDirectiveException>(() => SafeHandleNative.SafeHandleReturn_Swapped_AbstractDerived(initialValue));
Assert.Throws<MissingMethodException>(() => SafeHandleNative.SafeHandleReturn_Swapped_NoDefaultConstructor(initialValue));
handle = new TestSafeHandle(initialValue)
};
- Assert.IsTrue(SafeHandleNative.StructWithSafeHandleByValue(str, initialValue));
-
- Assert.IsTrue(SafeHandleNative.StructWithSafeHandleByRef(ref str, initialValue, initialValue));
+ Assert.True(SafeHandleNative.StructWithSafeHandleByValue(str, initialValue));
+
+ Assert.True(SafeHandleNative.StructWithSafeHandleByRef(ref str, initialValue, initialValue));
// Cannot change the value of a SafeHandle-derived field in a struct when marshalling byref.
Assert.Throws<NotSupportedException>(() => SafeHandleNative.StructWithSafeHandleByRef(ref str, initialValue, newValue));
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
class SetLastErrorTest
{
int expected = Marshal.GetLastPInvokeError();
SetLastErrorNative.SetError_Default(expected + 1, shouldSetError: true);
int actual = Marshal.GetLastPInvokeError();
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
}
// SetLastError=false
int expected = Marshal.GetLastPInvokeError();
SetLastErrorNative.SetError_False(expected + 1, shouldSetError: true);
int actual = Marshal.GetLastPInvokeError();
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
}
// SetLastError=true
expected++;
SetLastErrorNative.SetError_True(expected, shouldSetError: true);
int actual = Marshal.GetLastPInvokeError();
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
}
}
// Calling a P/Invoke with SetLastError=true should clear any existing error.
SetLastErrorNative.SetError_True(error, shouldSetError: false);
int actual = Marshal.GetLastPInvokeError();
- Assert.AreEqual(0, actual);
+ Assert.Equal(0, actual);
}
static int Main(string[] args)
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
class Program
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
/// <summary>
/// Pass Array Size by out keyword using SizeParamIndex Attributes
byte byte_Array_Size;
byte[] arrByte;
- Assert.IsTrue(MarshalCStyleArrayByte_AsByOut_AsSizeParamIndex(out byte_Array_Size, out arrByte));
+ Assert.True(MarshalCStyleArrayByte_AsByOut_AsSizeParamIndex(out byte_Array_Size, out arrByte));
//Construct Expected array
int expected_ByteArray_Size = 1;
byte[] expectedArrByte = Helper.GetExpChangeArray<byte>(expected_ByteArray_Size);
- Assert.IsTrue(Helper.EqualArray<byte>(arrByte, (int)byte_Array_Size, expectedArrByte, (int)expectedArrByte.Length));
+ Assert.True(Helper.EqualArray<byte>(arrByte, (int)byte_Array_Size, expectedArrByte, (int)expectedArrByte.Length));
Console.WriteLine(strDescription + " Ends!");
}
sbyte sbyte_Array_Size;
sbyte[] arrSbyte;
- Assert.IsTrue(MarshalCStyleArraySbyte_AsByOut_AsSizeParamIndex(out sbyte_Array_Size, out arrSbyte));
+ Assert.True(MarshalCStyleArraySbyte_AsByOut_AsSizeParamIndex(out sbyte_Array_Size, out arrSbyte));
sbyte[] expectedArrSbyte = Helper.GetExpChangeArray<sbyte>(sbyte.MaxValue);
- Assert.IsTrue(Helper.EqualArray<sbyte>(arrSbyte, (int)sbyte_Array_Size, expectedArrSbyte, (int)expectedArrSbyte.Length));
+ Assert.True(Helper.EqualArray<sbyte>(arrSbyte, (int)sbyte_Array_Size, expectedArrSbyte, (int)expectedArrSbyte.Length));
Console.WriteLine(strDescription + " Ends!");
}
short shortArray_Size = (short)-1;
short[] arrShort = Helper.InitArray<short>(10);
- Assert.IsTrue(MarshalCStyleArrayShort_AsByOut_AsSizeParamIndex(out shortArray_Size, out arrShort));
+ Assert.True(MarshalCStyleArrayShort_AsByOut_AsSizeParamIndex(out shortArray_Size, out arrShort));
//Construct Expected Array
int expected_ShortArray_Size = 16384;//(SHRT_MAX+1)/2
short[] expectedArrShort = Helper.GetExpChangeArray<short>(expected_ShortArray_Size);
- Assert.IsTrue(Helper.EqualArray<short>(arrShort, (int)shortArray_Size, expectedArrShort, (int)expectedArrShort.Length));
+ Assert.True(Helper.EqualArray<short>(arrShort, (int)shortArray_Size, expectedArrShort, (int)expectedArrShort.Length));
Console.WriteLine(strDescription + " Ends!");
}
ushort ushort_Array_Size;
ushort[] arrUshort;
- Assert.IsTrue(MarshalCStyleArrayUshort_AsByOut_AsSizeParamIndex(out arrUshort, out ushort_Array_Size));
+ Assert.True(MarshalCStyleArrayUshort_AsByOut_AsSizeParamIndex(out arrUshort, out ushort_Array_Size));
//Expected Array
ushort[] expectedArrUshort = Helper.GetExpChangeArray<ushort>(ushort.MaxValue);
- Assert.IsTrue(Helper.EqualArray<ushort>(arrUshort, (int)ushort_Array_Size, expectedArrUshort, (ushort)expectedArrUshort.Length));
+ Assert.True(Helper.EqualArray<ushort>(arrUshort, (int)ushort_Array_Size, expectedArrUshort, (ushort)expectedArrUshort.Length));
Console.WriteLine(strDescription + " Ends!");
}
Int32 Int32_Array_Size;
Int32[] arrInt32;
- Assert.IsTrue(MarshalCStyleArrayInt_AsByOut_AsSizeParamIndex(out Int32_Array_Size, out arrInt32));
+ Assert.True(MarshalCStyleArrayInt_AsByOut_AsSizeParamIndex(out Int32_Array_Size, out arrInt32));
//Expected Array
Int32[] expectedArrInt32 = Helper.GetExpChangeArray<Int32>(0);
- Assert.IsTrue(Helper.EqualArray<Int32>(arrInt32, Int32_Array_Size, expectedArrInt32, expectedArrInt32.Length));
+ Assert.True(Helper.EqualArray<Int32>(arrInt32, Int32_Array_Size, expectedArrInt32, expectedArrInt32.Length));
Console.WriteLine(strDescription + " Ends!");
}
UInt32 UInt32_Array_Size = (UInt32)10;
UInt32[] arrUInt32 = Helper.InitArray<UInt32>((Int32)UInt32_Array_Size);
- Assert.IsTrue(MarshalCStyleArrayUInt_AsByOut_AsSizeParamIndex(out UInt32_Array_Size, out arrUInt32));
+ Assert.True(MarshalCStyleArrayUInt_AsByOut_AsSizeParamIndex(out UInt32_Array_Size, out arrUInt32));
//Construct expected
UInt32[] expectedArrUInt32 = Helper.GetExpChangeArray<UInt32>(expected_UInt32ArraySize);
- Assert.IsTrue(Helper.EqualArray<UInt32>(arrUInt32, (Int32)UInt32_Array_Size, expectedArrUInt32, (Int32)expectedArrUInt32.Length));
+ Assert.True(Helper.EqualArray<UInt32>(arrUInt32, (Int32)UInt32_Array_Size, expectedArrUInt32, (Int32)expectedArrUInt32.Length));
Console.WriteLine(strDescription + " Ends!");
}
long long_Array_Size = (long)10;
long[] arrLong = Helper.InitArray<long>((Int32)long_Array_Size);
- Assert.IsTrue(MarshalCStyleArrayLong_AsByOut_AsSizeParamIndex(out long_Array_Size, out arrLong));
+ Assert.True(MarshalCStyleArrayLong_AsByOut_AsSizeParamIndex(out long_Array_Size, out arrLong));
long[] expectedArrLong = Helper.GetExpChangeArray<long>(expected_LongArraySize);
- Assert.IsTrue(Helper.EqualArray<long>(arrLong, (Int32)long_Array_Size, expectedArrLong, (Int32)expectedArrLong.Length));
+ Assert.True(Helper.EqualArray<long>(arrLong, (Int32)long_Array_Size, expectedArrLong, (Int32)expectedArrLong.Length));
Console.WriteLine(strDescription + " Ends!");
}
ulong ulong_Array_Size = (ulong)10;
ulong[] arrUlong = Helper.InitArray<ulong>((Int32)ulong_Array_Size);
- Assert.IsTrue(MarshalCStyleArrayUlong_AsByOut_AsSizeParamIndex(out arrUlong, out ulong_Array_Size, ulong_Array_Size));
+ Assert.True(MarshalCStyleArrayUlong_AsByOut_AsSizeParamIndex(out arrUlong, out ulong_Array_Size, ulong_Array_Size));
ulong[] expectedArrUlong = Helper.GetExpChangeArray<ulong>(expected_ULongArraySize);
- Assert.IsTrue(Helper.EqualArray<ulong>(arrUlong, (Int32)ulong_Array_Size, expectedArrUlong, (Int32)expectedArrUlong.Length));
+ Assert.True(Helper.EqualArray<ulong>(arrUlong, (Int32)ulong_Array_Size, expectedArrUlong, (Int32)expectedArrUlong.Length));
Console.WriteLine(strDescription + " Ends!");
}
int expected_StringArraySize = 20;
int string_Array_Size = 10;
String[] arrString = Helper.InitArray<String>(string_Array_Size);
- Assert.IsTrue(MarshalCStyleArrayString_AsByOut_AsSizeParamIndex(out arrString, out string_Array_Size));
+ Assert.True(MarshalCStyleArrayString_AsByOut_AsSizeParamIndex(out arrString, out string_Array_Size));
String[] expArrString = Helper.GetExpChangeArray<String>(expected_StringArraySize);
- Assert.IsTrue(Helper.EqualArray<String>(arrString, string_Array_Size, expArrString, expArrString.Length));
+ Assert.True(Helper.EqualArray<String>(arrString, string_Array_Size, expArrString, expArrString.Length));
Console.WriteLine(strDescription + " Ends!");
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
/// <summary>
/// Pass LPArray Size by ref keyword using SizeParamIndex Attributes
byte byte_Array_Size = 1;
byte[] arrByte = Helper.InitArray<byte>(byte_Array_Size);
- Assert.IsTrue(MarshalCStyleArrayByte_AsByRef_AsSizeParamIndex(ref byte_Array_Size, ref arrByte));
+ Assert.True(MarshalCStyleArrayByte_AsByRef_AsSizeParamIndex(ref byte_Array_Size, ref arrByte));
//Construct Expected array
int expected_ByteArray_Size = Byte.MinValue;
byte[] expectedArrByte = Helper.GetExpChangeArray<byte>(expected_ByteArray_Size);
- Assert.IsTrue(Helper.EqualArray<byte>(arrByte, (int)byte_Array_Size, expectedArrByte, (int)expectedArrByte.Length));
+ Assert.True(Helper.EqualArray<byte>(arrByte, (int)byte_Array_Size, expectedArrByte, (int)expectedArrByte.Length));
Console.WriteLine(strDescription + " Ends!");
}
sbyte sbyte_Array_Size = (sbyte)10;
sbyte[] arrSbyte = Helper.InitArray<sbyte>(sbyte_Array_Size);
- Assert.IsTrue(MarshalCStyleArraySbyte_AsByRef_AsSizeParamIndex(ref sbyte_Array_Size, ref arrSbyte));
+ Assert.True(MarshalCStyleArraySbyte_AsByRef_AsSizeParamIndex(ref sbyte_Array_Size, ref arrSbyte));
//Construct Expected
sbyte[] expectedArrSbyte = Helper.GetExpChangeArray<sbyte>(sbyte.MaxValue);
- Assert.IsTrue(Helper.EqualArray<sbyte>(arrSbyte, (int)sbyte_Array_Size, expectedArrSbyte, (int)sbyte.MaxValue));
+ Assert.True(Helper.EqualArray<sbyte>(arrSbyte, (int)sbyte_Array_Size, expectedArrSbyte, (int)sbyte.MaxValue));
Console.WriteLine(strDescription + " Ends!");
}
short[] arrShort = Helper.InitArray<short>(10);
int expected_ByteArraySize = 20;
- Assert.IsTrue(MarshalCStyleArrayShort_AsByRef_AsSizeParamIndex(ref short_Array_Size, ref arrShort));
+ Assert.True(MarshalCStyleArrayShort_AsByRef_AsSizeParamIndex(ref short_Array_Size, ref arrShort));
//Construct Expected
short[] expectedArrShort = Helper.GetExpChangeArray<short>(expected_ByteArraySize);
- Assert.IsTrue(Helper.EqualArray<short>(arrShort, (int)short_Array_Size, expectedArrShort, expectedArrShort.Length));
+ Assert.True(Helper.EqualArray<short>(arrShort, (int)short_Array_Size, expectedArrShort, expectedArrShort.Length));
Console.WriteLine(strDescription + " Ends!");
}
ushort[] arrUshort = Helper.InitArray<ushort>(ushort_Array_Size);
int expected_UshortArraySize = ushort.MaxValue;
- Assert.IsTrue(MarshalCStyleArrayUshort_AsByRef_AsSizeParamIndex(ref arrUshort, ref ushort_Array_Size));
+ Assert.True(MarshalCStyleArrayUshort_AsByRef_AsSizeParamIndex(ref arrUshort, ref ushort_Array_Size));
//Construct Expected
ushort[] expectedArrShort = Helper.GetExpChangeArray<ushort>(expected_UshortArraySize);
- Assert.IsTrue(Helper.EqualArray<ushort>(arrUshort, (int)ushort_Array_Size, expectedArrShort, expectedArrShort.Length));
+ Assert.True(Helper.EqualArray<ushort>(arrUshort, (int)ushort_Array_Size, expectedArrShort, expectedArrShort.Length));
Console.WriteLine(strDescription + " Ends!");
}
Int32 Int32_Array_Size = (Int32)10;
Int32[] arrInt32 = Helper.InitArray<Int32>(Int32_Array_Size);
- Assert.IsTrue(MarshalCStyleArrayInt_AsByRef_AsSizeParamIndex(ref Int32_Array_Size, Int32.MaxValue, ref arrInt32));
+ Assert.True(MarshalCStyleArrayInt_AsByRef_AsSizeParamIndex(ref Int32_Array_Size, Int32.MaxValue, ref arrInt32));
//Construct Expected
int expected_UshortArraySize = 1;
Int32[] expectedArrInt32 = Helper.GetExpChangeArray<Int32>(expected_UshortArraySize);
- Assert.IsTrue(Helper.EqualArray<Int32>(arrInt32, Int32_Array_Size, expectedArrInt32, expectedArrInt32.Length));
+ Assert.True(Helper.EqualArray<Int32>(arrInt32, Int32_Array_Size, expectedArrInt32, expectedArrInt32.Length));
Console.WriteLine(strDescription + " Ends!");
}
UInt32 UInt32_Array_Size = (UInt32)1234;
UInt32[] arrUInt32 = Helper.InitArray<UInt32>((Int32)UInt32_Array_Size);
- Assert.IsTrue(MarshalCStyleArrayUInt_AsByRef_AsSizeParamIndex(ref arrUInt32, 1234, ref UInt32_Array_Size));
+ Assert.True(MarshalCStyleArrayUInt_AsByRef_AsSizeParamIndex(ref arrUInt32, 1234, ref UInt32_Array_Size));
//Construct Expected
int expected_UInt32ArraySize = 4321;
UInt32[] expectedArrUInt32 = Helper.GetExpChangeArray<UInt32>(expected_UInt32ArraySize);
- Assert.IsTrue(Helper.EqualArray<UInt32>(arrUInt32, (Int32)UInt32_Array_Size, expectedArrUInt32, (Int32)expectedArrUInt32.Length));
+ Assert.True(Helper.EqualArray<UInt32>(arrUInt32, (Int32)UInt32_Array_Size, expectedArrUInt32, (Int32)expectedArrUInt32.Length));
Console.WriteLine(strDescription + " Ends!");
}
long long_Array_Size = (long)10;
long[] arrLong = Helper.InitArray<long>((Int32)long_Array_Size);
- Assert.IsTrue(MarshalCStyleArrayLong_AsByRef_AsSizeParamIndex(ref long_Array_Size, ref arrLong));
+ Assert.True(MarshalCStyleArrayLong_AsByRef_AsSizeParamIndex(ref long_Array_Size, ref arrLong));
//Construct Expected Array
int expected_LongArraySize = 20;
long[] expectedArrLong = Helper.GetExpChangeArray<long>(expected_LongArraySize);
- Assert.IsTrue(Helper.EqualArray<long>(arrLong, (Int32)long_Array_Size, expectedArrLong, (Int32)expectedArrLong.Length));
+ Assert.True(Helper.EqualArray<long>(arrLong, (Int32)long_Array_Size, expectedArrLong, (Int32)expectedArrLong.Length));
Console.WriteLine(strDescription + " Ends!");
}
ulong ulong_Array_Size = (ulong)0;
ulong[] arrUlong = Helper.InitArray<ulong>((Int32)ulong_Array_Size);
- Assert.IsTrue(MarshalCStyleArrayUlong_AsByRef_AsSizeParamIndex(ref ulong_Array_Size, ref arrUlong));
+ Assert.True(MarshalCStyleArrayUlong_AsByRef_AsSizeParamIndex(ref ulong_Array_Size, ref arrUlong));
//Construct Expected
int expected_ULongArraySize = 0;
ulong[] expectedArrUlong = Helper.GetExpChangeArray<ulong>(expected_ULongArraySize);
- Assert.IsTrue(Helper.EqualArray<ulong>(arrUlong, (Int32)ulong_Array_Size, expectedArrUlong, (Int32)expectedArrUlong.Length));
+ Assert.True(Helper.EqualArray<ulong>(arrUlong, (Int32)ulong_Array_Size, expectedArrUlong, (Int32)expectedArrUlong.Length));
Console.WriteLine(strDescription + " Ends!");
}
String[] arrString = Helper.InitArray<String>(array_Size);
String[] arrString2 = Helper.InitArray<String>(array_Size);
- Assert.IsTrue(MarshalCStyleArrayString_AsByRef_AsSizeParamIndex(ref array_Size, ref arrString, ref arrString2));
+ Assert.True(MarshalCStyleArrayString_AsByRef_AsSizeParamIndex(ref array_Size, ref arrString, ref arrString2));
//Construct Expected
int expected_StringArraySize = 10;
String[] expArrString = Helper.GetExpChangeArray<String>(expected_StringArraySize);
- Assert.IsTrue(Helper.EqualArray<String>(arrString, array_Size, expArrString, expArrString.Length));
+ Assert.True(Helper.EqualArray<String>(arrString, array_Size, expArrString, expArrString.Length));
Console.WriteLine(strDescription + " Ends!");
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public class ReversePInvoke_MashalArrayByOut_AsManagedTest
{
public delegate bool DelUlongArrByOutAsCdeclCaller([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] out ulong[] arrArg, out ulong arraySize);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelStringArrByOutAsCdeclCaller([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1, ArraySubType = UnmanagedType.BStr)] out string[] arrArg, out Int32 arraySize);
-
+
#endregion
#region Test Method
//Common value type
Console.WriteLine("\tScenario 1 : byte ==> BYTE, Array_Size = byte.MinValue, Return_Array_Size = 20");
- Assert.IsTrue(DoCallBack_MarshalByteArray_AsParam_AsByOut(new DelByteArrByOutAsCdeclCaller(TestMethodForByteArray_AsReversePInvokeByOut_AsCdecl)));
+ Assert.True(DoCallBack_MarshalByteArray_AsParam_AsByOut(new DelByteArrByOutAsCdeclCaller(TestMethodForByteArray_AsReversePInvokeByOut_AsCdecl)));
Console.WriteLine("\t\tMarshalByteArray_AsReversePInvokeByOut_AsCdecl Passed!");
Console.WriteLine("\tScenario 2 : sbyte ==> CHAR, Array_Size = 1, Return_Array_Size = sbyte.Max");
- Assert.IsTrue(DoCallBack_MarshalSbyteArray_AsParam_AsByOut(new DelSbyteArrByOutAsCdeclCaller(TestMethodForSbyteArray_AsReversePInvokeByOut_AsCdecl)));
+ Assert.True(DoCallBack_MarshalSbyteArray_AsParam_AsByOut(new DelSbyteArrByOutAsCdeclCaller(TestMethodForSbyteArray_AsReversePInvokeByOut_AsCdecl)));
Console.WriteLine("\t\tMarshalSbyteArray_AsReversePInvokeByOut_AsCdecl Passed!");
Console.WriteLine("\tScenario 3 : short ==> SHORT, Array_Size = -1, Return_Array_Size = 20");
- Assert.IsTrue(DoCallBack_MarshalShortArray_AsParam_AsByOut(new DelShortArrByOutAsCdeclCaller(TestMethodForShortArray_AsReversePInvokeByOut_AsCdecl)));
+ Assert.True(DoCallBack_MarshalShortArray_AsParam_AsByOut(new DelShortArrByOutAsCdeclCaller(TestMethodForShortArray_AsReversePInvokeByOut_AsCdecl)));
Console.WriteLine("\t\tMarshalShortArray_AsReversePInvokeByOut_AsCdecl Failed!");
Console.WriteLine("\tScenario 4 : short ==> SHORT, Array_Size = 10, Return_Array_Size = -1");
- Assert.IsTrue(DoCallBack_MarshalShortArrayReturnNegativeSize_AsParam_AsByOut(new DelShortArrByOutAsCdeclCaller(TestMethodForShortArrayReturnNegativeSize_AsReversePInvokeByOut_AsCdecl)));
+ Assert.True(DoCallBack_MarshalShortArrayReturnNegativeSize_AsParam_AsByOut(new DelShortArrByOutAsCdeclCaller(TestMethodForShortArrayReturnNegativeSize_AsReversePInvokeByOut_AsCdecl)));
Console.WriteLine("\t\tMarshalShortArray_AsReversePInvokeByOut_AsCdecl Passed!");
Console.WriteLine("\tScenario 5 : ushort ==> USHORT, Array_Size = ushort.MaxValue, Return_Array_Size = 20");
- Assert.IsTrue(DoCallBack_MarshalUshortArray_AsParam_AsByOut(new DelUshortArrByOutAsCdeclCaller(TestMethodForUshortArray_AsReversePInvokeByOut_AsCdecl)));
+ Assert.True(DoCallBack_MarshalUshortArray_AsParam_AsByOut(new DelUshortArrByOutAsCdeclCaller(TestMethodForUshortArray_AsReversePInvokeByOut_AsCdecl)));
Console.WriteLine("\t\tMarshalUshortArray_AsReversePInvokeByOut_AsCdecl Passed!");
Console.WriteLine("\tScenario 6 : Int32 ==> LONG, Array_Size = 10, Return_Array_Size = 20");
- Assert.IsTrue(DoCallBack_MarshalInt32Array_AsParam_AsByOut(new DelInt32ArrByOutAsCdeclCaller(TestMethodForInt32Array_AsReversePInvokeByOut_AsCdecl)));
+ Assert.True(DoCallBack_MarshalInt32Array_AsParam_AsByOut(new DelInt32ArrByOutAsCdeclCaller(TestMethodForInt32Array_AsReversePInvokeByOut_AsCdecl)));
Console.WriteLine("\t\tMarshalInt32Array_AsReversePInvokeByOut_AsCdecl Passed!");
Console.WriteLine("\tScenario 7 : UInt32 ==> ULONG, Array_Size = 10, Return_Array_Size = 20");
- Assert.IsTrue(DoCallBack_MarshalUint32Array_AsParam_AsByOut(new DelUint32ArrByOutAsCdeclCaller(TestMethodForUint32Array_AsReversePInvokeByOut_AsCdecl)));
+ Assert.True(DoCallBack_MarshalUint32Array_AsParam_AsByOut(new DelUint32ArrByOutAsCdeclCaller(TestMethodForUint32Array_AsReversePInvokeByOut_AsCdecl)));
Console.WriteLine("\t\tMarshalUint32Array_AsReversePInvokeByOut_AsCdecl Passed!");
Console.WriteLine("\tScenario 8 : long ==> LONGLONG, Array_Size = 10, Return_Array_Size = 20");
- Assert.IsTrue(DoCallBack_MarshalLongArray_AsParam_AsByOut(new DelLongArrByOutAsCdeclCaller(TestMethodForLongArray_AsReversePInvokeByOut_AsCdecl)));
+ Assert.True(DoCallBack_MarshalLongArray_AsParam_AsByOut(new DelLongArrByOutAsCdeclCaller(TestMethodForLongArray_AsReversePInvokeByOut_AsCdecl)));
Console.WriteLine("\t\tMarshalLongArray_AsReversePInvokeByOut_AsCdecl Passed!");
Console.WriteLine("\tScenario 9 : ulong ==> ULONGLONG, Array_Size = 10, Return_Array_Size = 20");
- Assert.IsTrue(DoCallBack_MarshalUlongArray_AsParam_AsByOut(new DelUlongArrByOutAsCdeclCaller(TestMethodForUlongArray_AsReversePInvokeByOut_AsCdecl)));
+ Assert.True(DoCallBack_MarshalUlongArray_AsParam_AsByOut(new DelUlongArrByOutAsCdeclCaller(TestMethodForUlongArray_AsReversePInvokeByOut_AsCdecl)));
Console.WriteLine("\t\tMarshalUlongArray_AsReversePInvokeByOut_AsCdecl Passed!");
if (OperatingSystem.IsWindows())
{
Console.WriteLine("\tScenario 10 : string ==> BSTR, Array_Size = 10, Return_Array_Size = 20");
- Assert.IsTrue(DoCallBack_MarshalStringArray_AsParam_AsByOut(new DelStringArrByOutAsCdeclCaller(TestMethodForStringArray_AsReversePInvokeByOut_AsCdecl)));
+ Assert.True(DoCallBack_MarshalStringArray_AsParam_AsByOut(new DelStringArrByOutAsCdeclCaller(TestMethodForStringArray_AsReversePInvokeByOut_AsCdecl)));
Console.WriteLine("\t\tMarshalStringArray_AsReversePInvokeByOut_AsCdecl Passed!");
}
}
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public class ReversePInvoke_MashalArrayByRef_AsManagedTest
{
public delegate bool DelUlongArrByRefAsCdeclCaller([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] ref ulong[] arrArg, ref ulong arraySize);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelStringArrByRefAsCdeclCaller([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1, ArraySubType = UnmanagedType.BStr)] ref string[] arrArg, ref Int32 arraySize);
-
+
#endregion
#region Test Method
//Common value type
Console.WriteLine("\tScenario 1 : byte ==> BYTE, Array_Size = byte.MinValue, Return_Array_Size = 20");
- Assert.IsTrue(DoCallBack_MarshalByteArray_AsParam_AsByRef(new DelByteArrByRefAsCdeclCaller(TestMethodForByteArray_AsReversePInvokeByRef_AsCdecl)));
+ Assert.True(DoCallBack_MarshalByteArray_AsParam_AsByRef(new DelByteArrByRefAsCdeclCaller(TestMethodForByteArray_AsReversePInvokeByRef_AsCdecl)));
Console.WriteLine("\t\tMarshalByteArray_AsReversePInvokeByRef_AsCdecl Passed!");
Console.WriteLine("\tScenario 2 : sbyte ==> CHAR, Array_Size = 1, Return_Array_Size = sbyte.Max");
- Assert.IsTrue(DoCallBack_MarshalSbyteArray_AsParam_AsByRef(new DelSbyteArrByRefAsCdeclCaller(TestMethodForSbyteArray_AsReversePInvokeByRef_AsCdecl)));
+ Assert.True(DoCallBack_MarshalSbyteArray_AsParam_AsByRef(new DelSbyteArrByRefAsCdeclCaller(TestMethodForSbyteArray_AsReversePInvokeByRef_AsCdecl)));
Console.WriteLine("\t\tMarshalSbyteArray_AsReversePInvokeByRef_AsCdecl Passed!");
// We don't support exception interop in .NET off-Windows.
Console.WriteLine("\tScenario 4 : short ==> SHORT, Array_Size = 10, Return_Array_Size = -1");
- Assert.IsTrue(DoCallBack_MarshalShortArrayReturnNegativeSize_AsParam_AsByRef(new DelShortArrByRefAsCdeclCaller(TestMethodForShortArrayReturnNegativeSize_AsReversePInvokeByRef_AsCdecl)));
+ Assert.True(DoCallBack_MarshalShortArrayReturnNegativeSize_AsParam_AsByRef(new DelShortArrByRefAsCdeclCaller(TestMethodForShortArrayReturnNegativeSize_AsReversePInvokeByRef_AsCdecl)));
Console.WriteLine("\t\tMarshalShortArray_AsReversePInvokeByRef_AsCdecl Passed!");
Console.WriteLine("\tScenario 5 : ushort ==> USHORT, Array_Size = ushort.MaxValue, Return_Array_Size = 20");
- Assert.IsTrue(DoCallBack_MarshalUshortArray_AsParam_AsByRef(new DelUshortArrByRefAsCdeclCaller(TestMethodForUshortArray_AsReversePInvokeByRef_AsCdecl)));
+ Assert.True(DoCallBack_MarshalUshortArray_AsParam_AsByRef(new DelUshortArrByRefAsCdeclCaller(TestMethodForUshortArray_AsReversePInvokeByRef_AsCdecl)));
Console.WriteLine("\t\tMarshalUshortArray_AsReversePInvokeByRef_AsCdecl Passed!");
Console.WriteLine("\tScenario 6 : Int32 ==> LONG, Array_Size = 10, Return_Array_Size = 20");
- Assert.IsTrue(DoCallBack_MarshalInt32Array_AsParam_AsByRef(new DelInt32ArrByRefAsCdeclCaller(TestMethodForInt32Array_AsReversePInvokeByRef_AsCdecl)));
+ Assert.True(DoCallBack_MarshalInt32Array_AsParam_AsByRef(new DelInt32ArrByRefAsCdeclCaller(TestMethodForInt32Array_AsReversePInvokeByRef_AsCdecl)));
Console.WriteLine("\t\tMarshalInt32Array_AsReversePInvokeByRef_AsCdecl Passed!");
Console.WriteLine("\tScenario 7 : UInt32 ==> ULONG, Array_Size = 10, Return_Array_Size = 20");
- Assert.IsTrue(DoCallBack_MarshalUint32Array_AsParam_AsByRef(new DelUint32ArrByRefAsCdeclCaller(TestMethodForUint32Array_AsReversePInvokeByRef_AsCdecl)));
+ Assert.True(DoCallBack_MarshalUint32Array_AsParam_AsByRef(new DelUint32ArrByRefAsCdeclCaller(TestMethodForUint32Array_AsReversePInvokeByRef_AsCdecl)));
Console.WriteLine("\t\tMarshalUint32Array_AsReversePInvokeByRef_AsCdecl Passed!");
Console.WriteLine("\tScenario 8 : long ==> LONGLONG, Array_Size = 10, Return_Array_Size = 20");
- Assert.IsTrue(DoCallBack_MarshalLongArray_AsParam_AsByRef(new DelLongArrByRefAsCdeclCaller(TestMethodForLongArray_AsReversePInvokeByRef_AsCdecl)));
+ Assert.True(DoCallBack_MarshalLongArray_AsParam_AsByRef(new DelLongArrByRefAsCdeclCaller(TestMethodForLongArray_AsReversePInvokeByRef_AsCdecl)));
Console.WriteLine("\t\tMarshalLongArray_AsReversePInvokeByRef_AsCdecl Passed!");
Console.WriteLine("\tScenario 9 : ulong ==> ULONGLONG, Array_Size = 10, Return_Array_Size = 20");
- Assert.IsTrue(DoCallBack_MarshalUlongArray_AsParam_AsByRef(new DelUlongArrByRefAsCdeclCaller(TestMethodForUlongArray_AsReversePInvokeByRef_AsCdecl)));
+ Assert.True(DoCallBack_MarshalUlongArray_AsParam_AsByRef(new DelUlongArrByRefAsCdeclCaller(TestMethodForUlongArray_AsReversePInvokeByRef_AsCdecl)));
Console.WriteLine("\t\tMarshalUlongArray_AsReversePInvokeByRef_AsCdecl Passed!");
if (OperatingSystem.IsWindows())
{
Console.WriteLine("\tScenario 10 : string ==> BSTR, Array_Size = 10, Return_Array_Size = 20");
- Assert.IsTrue(DoCallBack_MarshalStringArray_AsParam_AsByRef(new DelStringArrByRefAsCdeclCaller(TestMethodForStringArray_AsReversePInvokeByRef_AsCdecl)));
+ Assert.True(DoCallBack_MarshalStringArray_AsParam_AsByRef(new DelStringArrByRefAsCdeclCaller(TestMethodForStringArray_AsReversePInvokeByRef_AsCdecl)));
Console.WriteLine("\t\tMarshalStringArray_AsReversePInvokeByRef_AsCdecl Passed!");
}
}
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
namespace PInvokeTests
{
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
using static VariantNative;
#pragma warning disable CS0612, CS0618
using System.Collections;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
using static VariantNative;
using ComTypes = System.Runtime.InteropServices.ComTypes;
using System;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
using static VariantNative;
// Class used to validate the IClassX generation path doesn't fail.
private unsafe static void TestByValue(bool hasComSupport)
{
- Assert.IsTrue(Marshal_ByValue_Byte((byte)NumericValue, NumericValue));
- Assert.IsTrue(Marshal_ByValue_SByte((sbyte)NumericValue, (sbyte)NumericValue));
- Assert.IsTrue(Marshal_ByValue_Int16((short)NumericValue, NumericValue));
- Assert.IsTrue(Marshal_ByValue_UInt16((ushort)NumericValue, NumericValue));
- Assert.IsTrue(Marshal_ByValue_Int32((int)NumericValue, NumericValue));
- Assert.IsTrue(Marshal_ByValue_UInt32((uint)NumericValue, NumericValue));
- Assert.IsTrue(Marshal_ByValue_Int64((long)NumericValue, NumericValue));
- Assert.IsTrue(Marshal_ByValue_UInt64((ulong)NumericValue, NumericValue));
- Assert.IsTrue(Marshal_ByValue_Single((float)NumericValue, NumericValue));
- Assert.IsTrue(Marshal_ByValue_Double((double)NumericValue, NumericValue));
- Assert.IsTrue(Marshal_ByValue_String(StringValue, StringValue));
- Assert.IsTrue(Marshal_ByValue_String(new BStrWrapper(null), null));
- Assert.IsTrue(Marshal_ByValue_Char(CharValue, CharValue));
- Assert.IsTrue(Marshal_ByValue_Boolean(true, true));
- Assert.IsTrue(Marshal_ByValue_DateTime(DateValue, DateValue));
- Assert.IsTrue(Marshal_ByValue_Decimal(DecimalValue, DecimalValue));
- Assert.IsTrue(Marshal_ByValue_Currency(new CurrencyWrapper(DecimalValue), DecimalValue));
- Assert.IsTrue(Marshal_ByValue_Null(DBNull.Value));
- Assert.IsTrue(Marshal_ByValue_Missing(System.Reflection.Missing.Value));
- Assert.IsTrue(Marshal_ByValue_Empty(null));
+ Assert.True(Marshal_ByValue_Byte((byte)NumericValue, NumericValue));
+ Assert.True(Marshal_ByValue_SByte((sbyte)NumericValue, (sbyte)NumericValue));
+ Assert.True(Marshal_ByValue_Int16((short)NumericValue, NumericValue));
+ Assert.True(Marshal_ByValue_UInt16((ushort)NumericValue, NumericValue));
+ Assert.True(Marshal_ByValue_Int32((int)NumericValue, NumericValue));
+ Assert.True(Marshal_ByValue_UInt32((uint)NumericValue, NumericValue));
+ Assert.True(Marshal_ByValue_Int64((long)NumericValue, NumericValue));
+ Assert.True(Marshal_ByValue_UInt64((ulong)NumericValue, NumericValue));
+ Assert.True(Marshal_ByValue_Single((float)NumericValue, NumericValue));
+ Assert.True(Marshal_ByValue_Double((double)NumericValue, NumericValue));
+ Assert.True(Marshal_ByValue_String(StringValue, StringValue));
+ Assert.True(Marshal_ByValue_String(new BStrWrapper(null), null));
+ Assert.True(Marshal_ByValue_Char(CharValue, CharValue));
+ Assert.True(Marshal_ByValue_Boolean(true, true));
+ Assert.True(Marshal_ByValue_DateTime(DateValue, DateValue));
+ Assert.True(Marshal_ByValue_Decimal(DecimalValue, DecimalValue));
+ Assert.True(Marshal_ByValue_Currency(new CurrencyWrapper(DecimalValue), DecimalValue));
+ Assert.True(Marshal_ByValue_Null(DBNull.Value));
+ Assert.True(Marshal_ByValue_Missing(System.Reflection.Missing.Value));
+ Assert.True(Marshal_ByValue_Empty(null));
if (hasComSupport)
{
- Assert.IsTrue(Marshal_ByValue_Object(new object()));
- Assert.IsTrue(Marshal_ByValue_Object_IUnknown(new UnknownWrapper(new object())));
- Assert.IsTrue(Marshal_ByValue_Object(new GenerateIClassX()));
- Assert.IsTrue(Marshal_ByValue_Object_IUnknown(new UnknownWrapper(new GenerateIClassX())));
+ Assert.True(Marshal_ByValue_Object(new object()));
+ Assert.True(Marshal_ByValue_Object_IUnknown(new UnknownWrapper(new object())));
+ Assert.True(Marshal_ByValue_Object(new GenerateIClassX()));
+ Assert.True(Marshal_ByValue_Object_IUnknown(new UnknownWrapper(new GenerateIClassX())));
}
else
{
() =>
{
Marshal_ByValue_Object(new object());
- },
- "Built-in COM has been disabled via a feature switch");
+ });
Assert.Throws<NotSupportedException>(
() =>
{
Marshal_ByValue_Object_IUnknown(new UnknownWrapper(new object()));
- },
- "Built-in COM has been disabled via a feature switch");
+ });
}
Assert.Throws<ArgumentException>(() => Marshal_ByValue_Invalid(TimeSpan.Zero));
object obj;
obj = (byte)NumericValue;
- Assert.IsTrue(Marshal_ByRef_Byte(ref obj, NumericValue));
+ Assert.True(Marshal_ByRef_Byte(ref obj, NumericValue));
obj = (sbyte)NumericValue;
- Assert.IsTrue(Marshal_ByRef_SByte(ref obj, (sbyte)NumericValue));
+ Assert.True(Marshal_ByRef_SByte(ref obj, (sbyte)NumericValue));
obj = (short)NumericValue;
- Assert.IsTrue(Marshal_ByRef_Int16(ref obj, NumericValue));
+ Assert.True(Marshal_ByRef_Int16(ref obj, NumericValue));
obj = (ushort)NumericValue;
- Assert.IsTrue(Marshal_ByRef_UInt16(ref obj, NumericValue));
+ Assert.True(Marshal_ByRef_UInt16(ref obj, NumericValue));
obj = (int)NumericValue;
- Assert.IsTrue(Marshal_ByRef_Int32(ref obj, NumericValue));
+ Assert.True(Marshal_ByRef_Int32(ref obj, NumericValue));
obj = (uint)NumericValue;
- Assert.IsTrue(Marshal_ByRef_UInt32(ref obj, NumericValue));
+ Assert.True(Marshal_ByRef_UInt32(ref obj, NumericValue));
obj = (long)NumericValue;
- Assert.IsTrue(Marshal_ByRef_Int64(ref obj, NumericValue));
+ Assert.True(Marshal_ByRef_Int64(ref obj, NumericValue));
obj = (ulong)NumericValue;
- Assert.IsTrue(Marshal_ByRef_UInt64(ref obj, NumericValue));
+ Assert.True(Marshal_ByRef_UInt64(ref obj, NumericValue));
obj = (float)NumericValue;
- Assert.IsTrue(Marshal_ByRef_Single(ref obj, NumericValue));
+ Assert.True(Marshal_ByRef_Single(ref obj, NumericValue));
obj = (double)NumericValue;
- Assert.IsTrue(Marshal_ByRef_Double(ref obj, NumericValue));
+ Assert.True(Marshal_ByRef_Double(ref obj, NumericValue));
obj = StringValue;
- Assert.IsTrue(Marshal_ByRef_String(ref obj, StringValue));
+ Assert.True(Marshal_ByRef_String(ref obj, StringValue));
obj = new BStrWrapper(null);
- Assert.IsTrue(Marshal_ByRef_String(ref obj, null));
+ Assert.True(Marshal_ByRef_String(ref obj, null));
obj = CharValue;
- Assert.IsTrue(Marshal_ByRef_Char(ref obj, CharValue));
+ Assert.True(Marshal_ByRef_Char(ref obj, CharValue));
obj = true;
- Assert.IsTrue(Marshal_ByRef_Boolean(ref obj, true));
+ Assert.True(Marshal_ByRef_Boolean(ref obj, true));
obj = DateValue;
- Assert.IsTrue(Marshal_ByRef_DateTime(ref obj, DateValue));
+ Assert.True(Marshal_ByRef_DateTime(ref obj, DateValue));
obj = DecimalValue;
- Assert.IsTrue(Marshal_ByRef_Decimal(ref obj, DecimalValue));
+ Assert.True(Marshal_ByRef_Decimal(ref obj, DecimalValue));
obj = new CurrencyWrapper(DecimalValue);
- Assert.IsTrue(Marshal_ByRef_Currency(ref obj, DecimalValue));
+ Assert.True(Marshal_ByRef_Currency(ref obj, DecimalValue));
obj = DBNull.Value;
- Assert.IsTrue(Marshal_ByRef_Null(ref obj));
+ Assert.True(Marshal_ByRef_Null(ref obj));
obj = System.Reflection.Missing.Value;
- Assert.IsTrue(Marshal_ByRef_Missing(ref obj));
+ Assert.True(Marshal_ByRef_Missing(ref obj));
obj = null;
- Assert.IsTrue(Marshal_ByRef_Empty(ref obj));
+ Assert.True(Marshal_ByRef_Empty(ref obj));
if (hasComSupport)
{
obj = new object();
- Assert.IsTrue(Marshal_ByRef_Object(ref obj));
+ Assert.True(Marshal_ByRef_Object(ref obj));
obj = new UnknownWrapper(new object());
- Assert.IsTrue(Marshal_ByRef_Object_IUnknown(ref obj));
+ Assert.True(Marshal_ByRef_Object_IUnknown(ref obj));
obj = new GenerateIClassX();
- Assert.IsTrue(Marshal_ByRef_Object(ref obj));
+ Assert.True(Marshal_ByRef_Object(ref obj));
obj = new UnknownWrapper(new GenerateIClassX());
- Assert.IsTrue(Marshal_ByRef_Object_IUnknown(ref obj));
+ Assert.True(Marshal_ByRef_Object_IUnknown(ref obj));
}
else
{
{
obj = new object();
Marshal_ByRef_Object(ref obj);
- },
- "Built-in COM has been disabled via a feature switch");
+ });
Assert.Throws<NotSupportedException>(
() =>
{
obj = new UnknownWrapper(new object());
Marshal_ByRef_Object_IUnknown(ref obj);
- },
- "Built-in COM has been disabled via a feature switch");
+ });
}
obj = DecimalValue;
- Assert.IsTrue(Marshal_ChangeVariantType(ref obj, NumericValue));
- Assert.IsTrue(obj is int);
- Assert.AreEqual(NumericValue, (int)obj);
+ Assert.True(Marshal_ChangeVariantType(ref obj, NumericValue));
+ Assert.True(obj is int);
+ Assert.Equal(NumericValue, (int)obj);
}
private unsafe static void TestOut()
{
- Assert.IsTrue(Marshal_Out(out object obj, NumericValue));
- Assert.IsTrue(obj is int);
- Assert.AreEqual(NumericValue, (int)obj);
+ Assert.True(Marshal_Out(out object obj, NumericValue));
+ Assert.True(obj is int);
+ Assert.Equal(NumericValue, (int)obj);
}
private unsafe static void TestFieldByValue(bool hasComSupport)
ObjectWrapper wrapper = new ObjectWrapper();
wrapper.value = (byte)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByValue_Byte(wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByValue_Byte(wrapper, NumericValue));
wrapper.value = (sbyte)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByValue_SByte(wrapper, (sbyte)NumericValue));
+ Assert.True(Marshal_Struct_ByValue_SByte(wrapper, (sbyte)NumericValue));
wrapper.value = (short)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByValue_Int16(wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByValue_Int16(wrapper, NumericValue));
wrapper.value = (ushort)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByValue_UInt16(wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByValue_UInt16(wrapper, NumericValue));
wrapper.value = (int)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByValue_Int32(wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByValue_Int32(wrapper, NumericValue));
wrapper.value = (uint)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByValue_UInt32(wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByValue_UInt32(wrapper, NumericValue));
wrapper.value = (long)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByValue_Int64(wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByValue_Int64(wrapper, NumericValue));
wrapper.value = (ulong)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByValue_UInt64(wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByValue_UInt64(wrapper, NumericValue));
wrapper.value = (float)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByValue_Single(wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByValue_Single(wrapper, NumericValue));
wrapper.value = (double)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByValue_Double(wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByValue_Double(wrapper, NumericValue));
wrapper.value = StringValue;
- Assert.IsTrue(Marshal_Struct_ByValue_String(wrapper, StringValue));
+ Assert.True(Marshal_Struct_ByValue_String(wrapper, StringValue));
wrapper.value = new BStrWrapper(null);
- Assert.IsTrue(Marshal_Struct_ByValue_String(wrapper, null));
+ Assert.True(Marshal_Struct_ByValue_String(wrapper, null));
wrapper.value = CharValue;
- Assert.IsTrue(Marshal_Struct_ByValue_Char(wrapper, CharValue));
+ Assert.True(Marshal_Struct_ByValue_Char(wrapper, CharValue));
wrapper.value = true;
- Assert.IsTrue(Marshal_Struct_ByValue_Boolean(wrapper, true));
+ Assert.True(Marshal_Struct_ByValue_Boolean(wrapper, true));
wrapper.value = DateValue;
- Assert.IsTrue(Marshal_Struct_ByValue_DateTime(wrapper, DateValue));
+ Assert.True(Marshal_Struct_ByValue_DateTime(wrapper, DateValue));
wrapper.value = DecimalValue;
- Assert.IsTrue(Marshal_Struct_ByValue_Decimal(wrapper, DecimalValue));
+ Assert.True(Marshal_Struct_ByValue_Decimal(wrapper, DecimalValue));
wrapper.value = new CurrencyWrapper(DecimalValue);
- Assert.IsTrue(Marshal_Struct_ByValue_Currency(wrapper, DecimalValue));
+ Assert.True(Marshal_Struct_ByValue_Currency(wrapper, DecimalValue));
wrapper.value = DBNull.Value;
- Assert.IsTrue(Marshal_Struct_ByValue_Null(wrapper));
+ Assert.True(Marshal_Struct_ByValue_Null(wrapper));
wrapper.value = System.Reflection.Missing.Value;
- Assert.IsTrue(Marshal_Struct_ByValue_Missing(wrapper));
+ Assert.True(Marshal_Struct_ByValue_Missing(wrapper));
wrapper.value = null;
- Assert.IsTrue(Marshal_Struct_ByValue_Empty(wrapper));
+ Assert.True(Marshal_Struct_ByValue_Empty(wrapper));
if (hasComSupport)
{
wrapper.value = new object();
- Assert.IsTrue(Marshal_Struct_ByValue_Object(wrapper));
+ Assert.True(Marshal_Struct_ByValue_Object(wrapper));
wrapper.value = new UnknownWrapper(new object());
- Assert.IsTrue(Marshal_Struct_ByValue_Object_IUnknown(wrapper));
+ Assert.True(Marshal_Struct_ByValue_Object_IUnknown(wrapper));
wrapper.value = new GenerateIClassX();
- Assert.IsTrue(Marshal_Struct_ByValue_Object(wrapper));
+ Assert.True(Marshal_Struct_ByValue_Object(wrapper));
wrapper.value = new UnknownWrapper(new GenerateIClassX());
- Assert.IsTrue(Marshal_Struct_ByValue_Object_IUnknown(wrapper));
+ Assert.True(Marshal_Struct_ByValue_Object_IUnknown(wrapper));
}
else
{
{
wrapper.value = new object();
Marshal_Struct_ByValue_Object(wrapper);
- },
- "Built-in COM has been disabled via a feature switch");
+ });
Assert.Throws<NotSupportedException>(
() =>
{
wrapper.value = new UnknownWrapper(new object());
Marshal_Struct_ByValue_Object_IUnknown(wrapper);
- },
- "Built-in COM has been disabled via a feature switch");
+ });
}
}
ObjectWrapper wrapper = new ObjectWrapper();
wrapper.value = (byte)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByRef_Byte(ref wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByRef_Byte(ref wrapper, NumericValue));
wrapper.value = (sbyte)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByRef_SByte(ref wrapper, (sbyte)NumericValue));
+ Assert.True(Marshal_Struct_ByRef_SByte(ref wrapper, (sbyte)NumericValue));
wrapper.value = (short)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByRef_Int16(ref wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByRef_Int16(ref wrapper, NumericValue));
wrapper.value = (ushort)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByRef_UInt16(ref wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByRef_UInt16(ref wrapper, NumericValue));
wrapper.value = (int)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByRef_Int32(ref wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByRef_Int32(ref wrapper, NumericValue));
wrapper.value = (uint)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByRef_UInt32(ref wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByRef_UInt32(ref wrapper, NumericValue));
wrapper.value = (long)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByRef_Int64(ref wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByRef_Int64(ref wrapper, NumericValue));
wrapper.value = (ulong)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByRef_UInt64(ref wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByRef_UInt64(ref wrapper, NumericValue));
wrapper.value = (float)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByRef_Single(ref wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByRef_Single(ref wrapper, NumericValue));
wrapper.value = (double)NumericValue;
- Assert.IsTrue(Marshal_Struct_ByRef_Double(ref wrapper, NumericValue));
+ Assert.True(Marshal_Struct_ByRef_Double(ref wrapper, NumericValue));
wrapper.value = StringValue;
- Assert.IsTrue(Marshal_Struct_ByRef_String(ref wrapper, StringValue));
+ Assert.True(Marshal_Struct_ByRef_String(ref wrapper, StringValue));
wrapper.value = new BStrWrapper(null);
- Assert.IsTrue(Marshal_Struct_ByRef_String(ref wrapper, null));
+ Assert.True(Marshal_Struct_ByRef_String(ref wrapper, null));
wrapper.value = CharValue;
- Assert.IsTrue(Marshal_Struct_ByRef_Char(ref wrapper, CharValue));
+ Assert.True(Marshal_Struct_ByRef_Char(ref wrapper, CharValue));
wrapper.value = true;
- Assert.IsTrue(Marshal_Struct_ByRef_Boolean(ref wrapper, true));
+ Assert.True(Marshal_Struct_ByRef_Boolean(ref wrapper, true));
wrapper.value = DateValue;
- Assert.IsTrue(Marshal_Struct_ByRef_DateTime(ref wrapper, DateValue));
+ Assert.True(Marshal_Struct_ByRef_DateTime(ref wrapper, DateValue));
wrapper.value = DecimalValue;
- Assert.IsTrue(Marshal_Struct_ByRef_Decimal(ref wrapper, DecimalValue));
+ Assert.True(Marshal_Struct_ByRef_Decimal(ref wrapper, DecimalValue));
wrapper.value = new CurrencyWrapper(DecimalValue);
- Assert.IsTrue(Marshal_Struct_ByRef_Currency(ref wrapper, DecimalValue));
+ Assert.True(Marshal_Struct_ByRef_Currency(ref wrapper, DecimalValue));
wrapper.value = DBNull.Value;
- Assert.IsTrue(Marshal_Struct_ByRef_Null(ref wrapper));
+ Assert.True(Marshal_Struct_ByRef_Null(ref wrapper));
wrapper.value = System.Reflection.Missing.Value;
- Assert.IsTrue(Marshal_Struct_ByRef_Missing(ref wrapper));
+ Assert.True(Marshal_Struct_ByRef_Missing(ref wrapper));
wrapper.value = null;
- Assert.IsTrue(Marshal_Struct_ByRef_Empty(ref wrapper));
+ Assert.True(Marshal_Struct_ByRef_Empty(ref wrapper));
if (hasComSupport)
{
wrapper.value = new object();
- Assert.IsTrue(Marshal_Struct_ByRef_Object(ref wrapper));
+ Assert.True(Marshal_Struct_ByRef_Object(ref wrapper));
wrapper.value = new UnknownWrapper(new object());
- Assert.IsTrue(Marshal_Struct_ByRef_Object_IUnknown(ref wrapper));
+ Assert.True(Marshal_Struct_ByRef_Object_IUnknown(ref wrapper));
wrapper.value = new GenerateIClassX();
- Assert.IsTrue(Marshal_Struct_ByRef_Object(ref wrapper));
+ Assert.True(Marshal_Struct_ByRef_Object(ref wrapper));
wrapper.value = new UnknownWrapper(new GenerateIClassX());
- Assert.IsTrue(Marshal_Struct_ByRef_Object_IUnknown(ref wrapper));
+ Assert.True(Marshal_Struct_ByRef_Object_IUnknown(ref wrapper));
}
else
{
{
wrapper.value = new object();
Marshal_Struct_ByRef_Object(ref wrapper);
- },
- "Built-in COM has been disabled via a feature switch");
+ });
Assert.Throws<NotSupportedException>(
() =>
{
wrapper.value = new UnknownWrapper(new object());
Marshal_Struct_ByRef_Object_IUnknown(ref wrapper);
- },
- "Built-in COM has been disabled via a feature switch");
+ });
}
}
}
using System;
using System.Numerics;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public class Vector2_3_4Test
{
Vector2 startingVector = new Vector2(X, Y);
Vector2 newVector = new Vector2(XNew, YNew);
- Assert.AreEqual(startingVector, Vector2_3_4TestNative.CreateVector2FromFloats(X, Y));
+ Assert.Equal(startingVector, Vector2_3_4TestNative.CreateVector2FromFloats(X, Y));
- Assert.IsTrue(Vector2_3_4TestNative.Vector2EqualToFloats(startingVector, X, Y));
+ Assert.True(Vector2_3_4TestNative.Vector2EqualToFloats(startingVector, X, Y));
Vector2 localVector = startingVector;
- Assert.IsTrue(Vector2_3_4TestNative.ValidateAndChangeVector2(ref localVector, X, Y, XNew, YNew));
- Assert.AreEqual(newVector, localVector);
+ Assert.True(Vector2_3_4TestNative.ValidateAndChangeVector2(ref localVector, X, Y, XNew, YNew));
+ Assert.Equal(newVector, localVector);
Vector2_3_4TestNative.GetVector2ForFloats(X, Y, out var vec);
- Assert.AreEqual(startingVector, vec);
-
- Assert.AreEqual(startingVector, Vector2_3_4TestNative.CreateWrappedVector2FromFloats(X, Y).vec);
+ Assert.Equal(startingVector, vec);
- Assert.IsTrue(Vector2_3_4TestNative.WrappedVector2EqualToFloats(new Vector2_3_4TestNative.Vector2Wrapper { vec = startingVector }, X, Y));
+ Assert.Equal(startingVector, Vector2_3_4TestNative.CreateWrappedVector2FromFloats(X, Y).vec);
+
+ Assert.True(Vector2_3_4TestNative.WrappedVector2EqualToFloats(new Vector2_3_4TestNative.Vector2Wrapper { vec = startingVector }, X, Y));
var localVectorWrapper = new Vector2_3_4TestNative.Vector2Wrapper { vec = startingVector };
- Assert.IsTrue(Vector2_3_4TestNative.ValidateAndChangeWrappedVector2(ref localVectorWrapper, X, Y, XNew, YNew));
- Assert.AreEqual(newVector, localVectorWrapper.vec);
+ Assert.True(Vector2_3_4TestNative.ValidateAndChangeWrappedVector2(ref localVectorWrapper, X, Y, XNew, YNew));
+ Assert.Equal(newVector, localVectorWrapper.vec);
- Assert.AreEqual(newVector, Vector2_3_4TestNative.PassThroughVector2ToCallback(startingVector, vectorParam =>
+ Assert.Equal(newVector, Vector2_3_4TestNative.PassThroughVector2ToCallback(startingVector, vectorParam =>
{
- Assert.AreEqual(startingVector, vectorParam);
+ Assert.Equal(startingVector, vectorParam);
return newVector;
}));
}
Vector3 startingVector = new Vector3(X, Y, Z);
Vector3 newVector = new Vector3(XNew, YNew, ZNew);
- Assert.AreEqual(startingVector, Vector2_3_4TestNative.CreateVector3FromFloats(X, Y, Z));
+ Assert.Equal(startingVector, Vector2_3_4TestNative.CreateVector3FromFloats(X, Y, Z));
- Assert.IsTrue(Vector2_3_4TestNative.Vector3EqualToFloats(startingVector, X, Y, Z));
+ Assert.True(Vector2_3_4TestNative.Vector3EqualToFloats(startingVector, X, Y, Z));
Vector3 localVector = startingVector;
- Assert.IsTrue(Vector2_3_4TestNative.ValidateAndChangeVector3(ref localVector, X, Y, Z, XNew, YNew, ZNew));
- Assert.AreEqual(newVector, localVector);
+ Assert.True(Vector2_3_4TestNative.ValidateAndChangeVector3(ref localVector, X, Y, Z, XNew, YNew, ZNew));
+ Assert.Equal(newVector, localVector);
Vector2_3_4TestNative.GetVector3ForFloats(X, Y, Z, out var vec);
- Assert.AreEqual(startingVector, vec);
-
- Assert.AreEqual(startingVector, Vector2_3_4TestNative.CreateWrappedVector3FromFloats(X, Y, Z).vec);
+ Assert.Equal(startingVector, vec);
+
+ Assert.Equal(startingVector, Vector2_3_4TestNative.CreateWrappedVector3FromFloats(X, Y, Z).vec);
- Assert.IsTrue(Vector2_3_4TestNative.WrappedVector3EqualToFloats(new Vector2_3_4TestNative.Vector3Wrapper { vec = startingVector }, X, Y, Z));
+ Assert.True(Vector2_3_4TestNative.WrappedVector3EqualToFloats(new Vector2_3_4TestNative.Vector3Wrapper { vec = startingVector }, X, Y, Z));
var localVectorWrapper = new Vector2_3_4TestNative.Vector3Wrapper { vec = startingVector };
- Assert.IsTrue(Vector2_3_4TestNative.ValidateAndChangeWrappedVector3(ref localVectorWrapper, X, Y, Z, XNew, YNew, ZNew));
- Assert.AreEqual(newVector, localVectorWrapper.vec);
+ Assert.True(Vector2_3_4TestNative.ValidateAndChangeWrappedVector3(ref localVectorWrapper, X, Y, Z, XNew, YNew, ZNew));
+ Assert.Equal(newVector, localVectorWrapper.vec);
- Assert.AreEqual(newVector, Vector2_3_4TestNative.PassThroughVector3ToCallback(startingVector, vectorParam =>
+ Assert.Equal(newVector, Vector2_3_4TestNative.PassThroughVector3ToCallback(startingVector, vectorParam =>
{
- Assert.AreEqual(startingVector, vectorParam);
+ Assert.Equal(startingVector, vectorParam);
return newVector;
}));
}
Vector4 startingVector = new Vector4(X, Y, Z, W);
Vector4 newVector = new Vector4(XNew, YNew, ZNew, WNew);
- Assert.AreEqual(startingVector, Vector2_3_4TestNative.CreateVector4FromFloats(X, Y, Z, W));
+ Assert.Equal(startingVector, Vector2_3_4TestNative.CreateVector4FromFloats(X, Y, Z, W));
- Assert.IsTrue(Vector2_3_4TestNative.Vector4EqualToFloats(startingVector, X, Y, Z, W));
+ Assert.True(Vector2_3_4TestNative.Vector4EqualToFloats(startingVector, X, Y, Z, W));
Vector4 localVector = startingVector;
- Assert.IsTrue(Vector2_3_4TestNative.ValidateAndChangeVector4(ref localVector, X, Y, Z, W, XNew, YNew, ZNew, WNew));
- Assert.AreEqual(newVector, localVector);
+ Assert.True(Vector2_3_4TestNative.ValidateAndChangeVector4(ref localVector, X, Y, Z, W, XNew, YNew, ZNew, WNew));
+ Assert.Equal(newVector, localVector);
Vector2_3_4TestNative.GetVector4ForFloats(X, Y, Z, W, out var vec);
- Assert.AreEqual(startingVector, vec);
-
- Assert.AreEqual(startingVector, Vector2_3_4TestNative.CreateWrappedVector4FromFloats(X, Y, Z, W).vec);
+ Assert.Equal(startingVector, vec);
+
+ Assert.Equal(startingVector, Vector2_3_4TestNative.CreateWrappedVector4FromFloats(X, Y, Z, W).vec);
- Assert.IsTrue(Vector2_3_4TestNative.WrappedVector4EqualToFloats(new Vector2_3_4TestNative.Vector4Wrapper { vec = startingVector }, X, Y, Z, W));
+ Assert.True(Vector2_3_4TestNative.WrappedVector4EqualToFloats(new Vector2_3_4TestNative.Vector4Wrapper { vec = startingVector }, X, Y, Z, W));
var localVectorWrapper = new Vector2_3_4TestNative.Vector4Wrapper { vec = startingVector };
- Assert.IsTrue(Vector2_3_4TestNative.ValidateAndChangeWrappedVector4(ref localVectorWrapper, X, Y, Z, W, XNew, YNew, ZNew, WNew));
- Assert.AreEqual(newVector, localVectorWrapper.vec);
+ Assert.True(Vector2_3_4TestNative.ValidateAndChangeWrappedVector4(ref localVectorWrapper, X, Y, Z, W, XNew, YNew, ZNew, WNew));
+ Assert.Equal(newVector, localVectorWrapper.vec);
- Assert.AreEqual(newVector, Vector2_3_4TestNative.PassThroughVector4ToCallback(startingVector, vectorParam =>
+ Assert.Equal(newVector, Vector2_3_4TestNative.PassThroughVector4ToCallback(startingVector, vectorParam =>
{
- Assert.AreEqual(startingVector, vectorParam);
+ Assert.Equal(startingVector, vectorParam);
return newVector;
}));
}
using System;
using System.Reflection;
using System.Text;
-using TestLibrary;
+using Xunit;
class Test
{
UIntPtr uintPtrReturn = (UIntPtr)3000;
UIntPtr uintPtr1 = uintPtrManaged;
- Assert.AreEqual(uintPtrReturn, Marshal_In(uintPtr1), "The return value is wrong");
+ Assert.Equal(uintPtrReturn, Marshal_In(uintPtr1));
UIntPtr uintPtr2 = uintPtrManaged;
- Assert.AreEqual(uintPtrReturn, Marshal_InOut(uintPtr2), "The return value is wrong");
- Assert.AreEqual(uintPtrManaged, uintPtr2, "The parameter value is changed");
+ Assert.Equal(uintPtrReturn, Marshal_InOut(uintPtr2));
+ Assert.Equal(uintPtrManaged, uintPtr2);
UIntPtr uintPtr3 = uintPtrManaged;
- Assert.AreEqual(uintPtrReturn, Marshal_Out(uintPtr3), "The return value is wrong");
- Assert.AreEqual(uintPtrManaged, uintPtr3, "The parameter value is changed");
+ Assert.Equal(uintPtrReturn, Marshal_Out(uintPtr3));
+ Assert.Equal(uintPtrManaged, uintPtr3);
UIntPtr uintPtr4 = uintPtrManaged;
- Assert.AreEqual(uintPtrReturn, MarshalPointer_In(ref uintPtr4), "The return value is wrong");
- Assert.AreEqual(uintPtrManaged, uintPtr4, "The parameter value is changed");
+ Assert.Equal(uintPtrReturn, MarshalPointer_In(ref uintPtr4));
+ Assert.Equal(uintPtrManaged, uintPtr4);
UIntPtr uintPtr5 = uintPtrManaged;
- Assert.AreEqual(uintPtrReturn, MarshalPointer_InOut(ref uintPtr5), "The return value is wrong");
- Assert.AreEqual(uintPtrNative, uintPtr5, "The passed value is wrong");
+ Assert.Equal(uintPtrReturn, MarshalPointer_InOut(ref uintPtr5));
+ Assert.Equal(uintPtrNative, uintPtr5);
UIntPtr uintPtr6 = uintPtrManaged;
- Assert.AreEqual(uintPtrReturn, MarshalPointer_Out(out uintPtr6), "The return value is wrong");
- Assert.AreEqual(uintPtrNative, uintPtr6, "The passed value is wrong");
+ Assert.Equal(uintPtrReturn, MarshalPointer_Out(out uintPtr6));
+ Assert.Equal(uintPtrNative, uintPtr6);
return 100;
}
Ancillary source assets for all tests should be located in `Interop/common` and can be easily added to all managed tests via the `Interop.settings.targets` file or native tests via `Interop.cmake`.
-A common pattern for testing is using the `Assert` utilities. This class is part of the `CoreCLRTestLibrary` which is included in all test projects by the `Interop.settings.targets` import. In order to use, add the following `using TestLibrary;` in the relevant test file.
+A common pattern for testing is using xUnit's `Assert` utilities. These utilities can be referenced via `CoreCLRTestLibrary` which is included in all test projects by `Directory.Build.targets` in this directory. In order to use, add the following `using Xunit;` in the relevant test file.
### Managed
using System;
using System.Reflection;
using System.Text;
-using TestLibrary;
+using Xunit;
class AnsiBStrTest
{
using System;
using System.Reflection;
using System.Text;
-using TestLibrary;
+using Xunit;
class BStrTest
{
using System;
using System.Reflection;
using System.Text;
-using TestLibrary;
+using Xunit;
using static StringMarshalingTestNative;
private static void RunStringTests()
{
- Assert.IsTrue(MatchFunctionName(nameof(MatchFunctionName)));
+ Assert.True(MatchFunctionName(nameof(MatchFunctionName)));
{
string funcNameLocal = nameof(MatchFunctionNameByRef);
- Assert.IsTrue(MatchFunctionNameByRef(ref funcNameLocal));
+ Assert.True(MatchFunctionNameByRef(ref funcNameLocal));
}
{
string reversed = InitialString;
ReverseInplaceByref(ref reversed);
- Assert.AreEqual(Helpers.Reverse(InitialString), reversed);
+ Assert.Equal(Helpers.Reverse(InitialString), reversed);
}
{
Reverse(InitialString, out string reversed);
- Assert.AreEqual(Helpers.Reverse(InitialString), reversed);
+ Assert.Equal(Helpers.Reverse(InitialString), reversed);
}
- Assert.AreEqual(Helpers.Reverse(InitialString), ReverseAndReturn(InitialString));
+ Assert.Equal(Helpers.Reverse(InitialString), ReverseAndReturn(InitialString));
- Assert.IsTrue(VerifyReversed(InitialString, (orig, rev) => rev == Helpers.Reverse(orig)));
+ Assert.True(VerifyReversed(InitialString, (orig, rev) => rev == Helpers.Reverse(orig)));
- Assert.IsTrue(ReverseInCallback(InitialString, (string str, out string rev) => rev = Helpers.Reverse(InitialString)));
+ Assert.True(ReverseInCallback(InitialString, (string str, out string rev) => rev = Helpers.Reverse(InitialString)));
- Assert.IsTrue(ReverseInCallbackReturned(InitialString, str => Helpers.Reverse(str)));
+ Assert.True(ReverseInCallbackReturned(InitialString, str => Helpers.Reverse(str)));
}
private static void RunStringBuilderTests()
{
var builder = new StringBuilder(InitialString);
ReverseInplace(builder);
- Assert.AreEqual(Helpers.Reverse(InitialString), builder.ToString());
+ Assert.Equal(Helpers.Reverse(InitialString), builder.ToString());
builder = new StringBuilder(InitialString);
ReverseInplaceByref(ref builder);
- Assert.AreEqual(Helpers.Reverse(InitialString), builder.ToString());
+ Assert.Equal(Helpers.Reverse(InitialString), builder.ToString());
builder = new StringBuilder(InitialString);
- Assert.IsTrue(ReverseInplaceInCallback(builder, b =>
+ Assert.True(ReverseInplaceInCallback(builder, b =>
{
string reversed = Helpers.Reverse(b.ToString());
b.Clear();
private static void RunStructTests()
{
- Assert.IsTrue(MatchFunctionNameInStruct(new StringInStruct { str = nameof(MatchFunctionNameInStruct)}));
+ Assert.True(MatchFunctionNameInStruct(new StringInStruct { str = nameof(MatchFunctionNameInStruct)}));
var str = new StringInStruct
{
ReverseInplaceByrefInStruct(ref str);
- Assert.AreEqual(Helpers.Reverse(InitialString), str.str);
+ Assert.Equal(Helpers.Reverse(InitialString), str.str);
}
}
using System;
using System.Reflection;
using System.Text;
-using TestLibrary;
+using Xunit;
class LPStrTest
{
using System;
using System.Reflection;
using System.Text;
-using TestLibrary;
+using Xunit;
using static LPTStrTestNative;
{
int length = 10;
StringBuilder nullTerminatorBuilder = new StringBuilder(length);
- Assert.IsTrue(Verify_NullTerminators_PastEnd(nullTerminatorBuilder, length));
- Assert.IsTrue(Verify_NullTerminators_PastEnd_Out(nullTerminatorBuilder, length));
+ Assert.True(Verify_NullTerminators_PastEnd(nullTerminatorBuilder, length));
+ Assert.True(Verify_NullTerminators_PastEnd_Out(nullTerminatorBuilder, length));
}
private static void RunByValTStrTests()
{
- Assert.IsTrue(MatchFuncNameAnsi(new ByValStringInStructAnsi { str = nameof(MatchFuncNameAnsi)}));
+ Assert.True(MatchFuncNameAnsi(new ByValStringInStructAnsi { str = nameof(MatchFuncNameAnsi)}));
var ansiStr = new ByValStringInStructAnsi
{
ReverseByValStringAnsi(ref ansiStr);
- Assert.AreEqual(Helpers.Reverse(InitialString), ansiStr.str);
+ Assert.Equal(Helpers.Reverse(InitialString), ansiStr.str);
- Assert.IsTrue(MatchFuncNameUni(new ByValStringInStructUnicode { str = nameof(MatchFuncNameUni)}));
+ Assert.True(MatchFuncNameUni(new ByValStringInStructUnicode { str = nameof(MatchFuncNameUni)}));
var uniStr = new ByValStringInStructUnicode
{
};
ReverseByValStringUni(ref uniStr);
- Assert.AreEqual(Helpers.Reverse(InitialString), uniStr.str);
+ Assert.Equal(Helpers.Reverse(InitialString), uniStr.str);
ReverseCopyByValStringAnsi(new ByValStringInStructAnsi { str = LongString }, out ByValStringInStructSplitAnsi ansiStrSplit);
- Assert.AreEqual(Helpers.Reverse(LongString[^10..]), ansiStrSplit.str1);
- Assert.AreEqual(Helpers.Reverse(LongString[..^10]), ansiStrSplit.str2);
+ Assert.Equal(Helpers.Reverse(LongString[^10..]), ansiStrSplit.str1);
+ Assert.Equal(Helpers.Reverse(LongString[..^10]), ansiStrSplit.str2);
ReverseCopyByValStringUni(new ByValStringInStructUnicode { str = LongString }, out ByValStringInStructSplitUnicode uniStrSplit);
- Assert.AreEqual(Helpers.Reverse(LongString[^10..]), uniStrSplit.str1);
- Assert.AreEqual(Helpers.Reverse(LongString[..^10]), uniStrSplit.str2);
+ Assert.Equal(Helpers.Reverse(LongString[^10..]), uniStrSplit.str1);
+ Assert.Equal(Helpers.Reverse(LongString[..^10]), uniStrSplit.str2);
ReverseCopyByValStringUni(new ByValStringInStructUnicode { str = LongUnicodeString }, out ByValStringInStructSplitUnicode uniStrSplit2);
- Assert.AreEqual(Helpers.Reverse(LongUnicodeString[^10..]), uniStrSplit2.str1);
- Assert.AreEqual(Helpers.Reverse(LongUnicodeString[..^10]), uniStrSplit2.str2);
+ Assert.Equal(Helpers.Reverse(LongUnicodeString[^10..]), uniStrSplit2.str1);
+ Assert.Equal(Helpers.Reverse(LongUnicodeString[..^10]), uniStrSplit2.str2);
}
}
using System;
using System.Reflection;
using System.Text;
-using TestLibrary;
+using Xunit;
#pragma warning disable CS0612, CS0618
string newValue = "zyxwvut\0";
actual = expected;
- Assert.IsTrue(VBByRefStrNative.Marshal_Ansi(expected, ref actual, newValue));
- Assert.AreEqual(newValue, actual);
+ Assert.True(VBByRefStrNative.Marshal_Ansi(expected, ref actual, newValue));
+ Assert.Equal(newValue, actual);
actual = expected;
- Assert.IsTrue(VBByRefStrNative.Marshal_Unicode(expected, ref actual, newValue));
- Assert.AreEqual(newValue, actual);
+ Assert.True(VBByRefStrNative.Marshal_Unicode(expected, ref actual, newValue));
+ Assert.Equal(newValue, actual);
StringBuilder builder = new StringBuilder();
using System.Text;
using System.Security;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public class Test_DelegatePInvokeTest
{
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateCdeclByRef_INNER2 Get_MarshalStructAsParam_AsExpByRefINNER2_Cdecl_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelegateCdeclByRef_InnerExplicit([In, Out]ref InnerExplicit ie);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateCdeclByRef_InnerExplicit Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Cdecl_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelegateCdeclByRef_InnerArrayExplicit([In, Out]ref InnerArrayExplicit iae);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateCdeclByRef_InnerArrayExplicit Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Cdecl_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelegateCdeclByRef_OUTER3([In, Out]ref OUTER3 outer);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateCdeclByRef_OUTER3 Get_MarshalStructAsParam_AsExpByRefOUTER3_Cdecl_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelegateCdeclByRef_U([In, Out]ref U u);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateCdeclByRef_U Get_MarshalStructAsParam_AsExpByRefU_Cdecl_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelegateCdeclByRef_ByteStructPack2Explicit([In, Out]ref ByteStructPack2Explicit bspe);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateCdeclByRef_ByteStructPack2Explicit Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Cdecl_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelegateCdeclByRef_ShortStructPack4Explicit([In, Out]ref ShortStructPack4Explicit bspe);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateCdeclByRef_ShortStructPack4Explicit Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Cdecl_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelegateCdeclByRef_IntStructPack8Explicit([In, Out]ref IntStructPack8Explicit bspe);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateCdeclByRef_IntStructPack8Explicit Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Cdecl_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelegateCdeclByRef_LongStructPack16Explicit([In, Out]ref LongStructPack16Explicit bspe);
INNER2 changeINNER2 = Helper.NewINNER2(77, 77.0F, "changed string");
DelegateCdeclByRef_INNER2 caller_INNER2 = Get_MarshalStructAsParam_AsExpByRefINNER2_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefINNER2_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_INNER2(ref sourceINNER2));
- Assert.IsTrue(Helper.ValidateINNER2(sourceINNER2, changeINNER2, "Get_MarshalStructAsParam_AsExpByRefINNER2_Cdecl_FuncPtr"));
+ Assert.True(caller_INNER2(ref sourceINNER2));
+ Assert.True(Helper.ValidateINNER2(sourceINNER2, changeINNER2, "Get_MarshalStructAsParam_AsExpByRefINNER2_Cdecl_FuncPtr"));
break;
case StructID.InnerExplicitId:
changeInnerExplicit.f3 = "changed string";
DelegateCdeclByRef_InnerExplicit caller_InnerExplicit = Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_InnerExplicit(ref sourceInnerExplicit));
- Assert.IsTrue(Helper.ValidateInnerExplicit(sourceInnerExplicit, changeInnerExplicit, "Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Cdecl_FuncPtr"));
+ Assert.True(caller_InnerExplicit(ref sourceInnerExplicit));
+ Assert.True(Helper.ValidateInnerExplicit(sourceInnerExplicit, changeInnerExplicit, "Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Cdecl_FuncPtr"));
break;
case StructID.InnerArrayExplicitId:
InnerArrayExplicit changeInnerArrayExplicit = Helper.NewInnerArrayExplicit(77, 77.0F, "change string1", "change string2");
DelegateCdeclByRef_InnerArrayExplicit caller_InnerArrayExplicit = Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_InnerArrayExplicit(ref sourceInnerArrayExplicit));
- Assert.IsTrue(Helper.ValidateInnerArrayExplicit(sourceInnerArrayExplicit, changeInnerArrayExplicit, "Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Cdecl_FuncPtr"));
+ Assert.True(caller_InnerArrayExplicit(ref sourceInnerArrayExplicit));
+ Assert.True(Helper.ValidateInnerArrayExplicit(sourceInnerArrayExplicit, changeInnerArrayExplicit, "Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Cdecl_FuncPtr"));
break;
case StructID.OUTER3Id:
OUTER3 changeOUTER3 = Helper.NewOUTER3(77, 77.0F, "changed string", "changed string");
DelegateCdeclByRef_OUTER3 caller_OUTER3 = Get_MarshalStructAsParam_AsExpByRefOUTER3_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefOUTER3_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_OUTER3(ref sourceOUTER3));
- Assert.IsTrue(Helper.ValidateOUTER3(sourceOUTER3, changeOUTER3, "Get_MarshalStructAsParam_AsExpByRefOUTER3_Cdecl_FuncPtr"));
+ Assert.True(caller_OUTER3(ref sourceOUTER3));
+ Assert.True(Helper.ValidateOUTER3(sourceOUTER3, changeOUTER3, "Get_MarshalStructAsParam_AsExpByRefOUTER3_Cdecl_FuncPtr"));
break;
case StructID.UId:
- U sourceU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue,
+ U sourceU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue,
byte.MinValue, sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 3.2);
- U changeU = Helper.NewU(Int32.MaxValue, UInt32.MinValue, new IntPtr(-64), new UIntPtr(64), short.MaxValue, ushort.MinValue,
+ U changeU = Helper.NewU(Int32.MaxValue, UInt32.MinValue, new IntPtr(-64), new UIntPtr(64), short.MaxValue, ushort.MinValue,
byte.MaxValue, sbyte.MinValue, long.MaxValue, ulong.MinValue, 64.0F, 6.4);
DelegateCdeclByRef_U caller_U = Get_MarshalStructAsParam_AsExpByRefU_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefU_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_U(ref sourceU));
- Assert.IsTrue(Helper.ValidateU(sourceU, changeU, "Get_MarshalStructAsParam_AsExpByRefU_Cdecl_FuncPtr"));
+ Assert.True(caller_U(ref sourceU));
+ Assert.True(Helper.ValidateU(sourceU, changeU, "Get_MarshalStructAsParam_AsExpByRefU_Cdecl_FuncPtr"));
break;
case StructID.ByteStructPack2ExplicitId:
ByteStructPack2Explicit change_bspe = Helper.NewByteStructPack2Explicit(64, 64);
DelegateCdeclByRef_ByteStructPack2Explicit caller_ByteStructPack2Explicit = Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_ByteStructPack2Explicit(ref source_bspe));
- Assert.IsTrue(Helper.ValidateByteStructPack2Explicit(source_bspe, change_bspe, "Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Cdecl_FuncPtr"));
+ Assert.True(caller_ByteStructPack2Explicit(ref source_bspe));
+ Assert.True(Helper.ValidateByteStructPack2Explicit(source_bspe, change_bspe, "Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Cdecl_FuncPtr"));
break;
case StructID.ShortStructPack4ExplicitId:
ShortStructPack4Explicit change_sspe = Helper.NewShortStructPack4Explicit(64, 64);
DelegateCdeclByRef_ShortStructPack4Explicit caller_ShortStructPack4Explicit = Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_ShortStructPack4Explicit(ref source_sspe));
- Assert.IsTrue(Helper.ValidateShortStructPack4Explicit(source_sspe, change_sspe, "Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Cdecl_FuncPtr"));
+ Assert.True(caller_ShortStructPack4Explicit(ref source_sspe));
+ Assert.True(Helper.ValidateShortStructPack4Explicit(source_sspe, change_sspe, "Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Cdecl_FuncPtr"));
break;
case StructID.IntStructPack8ExplicitId:
IntStructPack8Explicit change_ispe = Helper.NewIntStructPack8Explicit(64, 64);
DelegateCdeclByRef_IntStructPack8Explicit caller_IntStructPack8Explicit = Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_IntStructPack8Explicit(ref source_ispe));
- Assert.IsTrue(Helper.ValidateIntStructPack8Explicit(source_ispe, change_ispe, "Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Cdecl_FuncPtr"));
+ Assert.True(caller_IntStructPack8Explicit(ref source_ispe));
+ Assert.True(Helper.ValidateIntStructPack8Explicit(source_ispe, change_ispe, "Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Cdecl_FuncPtr"));
break;
case StructID.LongStructPack16ExplicitId:
LongStructPack16Explicit change_lspe = Helper.NewLongStructPack16Explicit(64, 64);
DelegateCdeclByRef_LongStructPack16Explicit caller_LongStructPack16Explicit = Get_MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_LongStructPack16Explicit(ref source_lspe));
- Assert.IsTrue(Helper.ValidateLongStructPack16Explicit(source_lspe, change_lspe, "Get_MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Cdecl_FuncPtr"));
+ Assert.True(caller_LongStructPack16Explicit(ref source_lspe));
+ Assert.True(Helper.ValidateLongStructPack16Explicit(source_lspe, change_lspe, "Get_MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Cdecl_FuncPtr"));
break;
default:
- Assert.Fail("TestMethod_DelegatePInvoke_MarshalByRef_Cdecl:The structid (Managed Side) is wrong");
+ Assert.True(false, "TestMethod_DelegatePInvoke_MarshalByRef_Cdecl:The structid (Managed Side) is wrong");
break;
}
}
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateStdcallByRef_INNER2 Get_MarshalStructAsParam_AsExpByRefINNER2_Stdcall_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool DelegateStdcallByRef_InnerExplicit([In, Out]ref InnerExplicit ie);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateStdcallByRef_InnerExplicit Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Stdcall_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool DelegateStdcallByRef_InnerArrayExplicit([In, Out]ref InnerArrayExplicit iae);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateStdcallByRef_InnerArrayExplicit Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Stdcall_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool DelegateStdcallByRef_OUTER3([In, Out]ref OUTER3 outer);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateStdcallByRef_OUTER3 Get_MarshalStructAsParam_AsExpByRefOUTER3_Stdcall_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool DelegateStdcallByRef_U([In, Out]ref U u);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateStdcallByRef_U Get_MarshalStructAsParam_AsExpByRefU_Stdcall_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool DelegateStdcallByRef_ByteStructPack2Explicit([In, Out]ref ByteStructPack2Explicit bspe);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateStdcallByRef_ByteStructPack2Explicit Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Stdcall_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool DelegateStdcallByRef_ShortStructPack4Explicit([In, Out]ref ShortStructPack4Explicit bspe);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateStdcallByRef_ShortStructPack4Explicit Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Stdcall_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool DelegateStdcallByRef_IntStructPack8Explicit([In, Out]ref IntStructPack8Explicit bspe);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateStdcallByRef_IntStructPack8Explicit Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Stdcall_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool DelegateStdcallByRef_LongStructPack16Explicit([In, Out]ref LongStructPack16Explicit bspe);
INNER2 changeINNER2 = Helper.NewINNER2(77, 77.0F, "changed string");
DelegateStdcallByRef_INNER2 caller_INNER2 = Get_MarshalStructAsParam_AsExpByRefINNER2_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefINNER2_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_INNER2(ref sourceINNER2));
- Assert.IsTrue(Helper.ValidateINNER2(sourceINNER2, changeINNER2, "Get_MarshalStructAsParam_AsExpByRefINNER2_Stdcall_FuncPtr"));
+ Assert.True(caller_INNER2(ref sourceINNER2));
+ Assert.True(Helper.ValidateINNER2(sourceINNER2, changeINNER2, "Get_MarshalStructAsParam_AsExpByRefINNER2_Stdcall_FuncPtr"));
break;
case StructID.InnerExplicitId:
changeInnerExplicit.f3 = "changed string";
DelegateStdcallByRef_InnerExplicit caller_InnerExplicit = Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_InnerExplicit(ref sourceInnerExplicit));
- Assert.IsTrue(Helper.ValidateInnerExplicit(sourceInnerExplicit, changeInnerExplicit, "Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Stdcall_FuncPtr"));
+ Assert.True(caller_InnerExplicit(ref sourceInnerExplicit));
+ Assert.True(Helper.ValidateInnerExplicit(sourceInnerExplicit, changeInnerExplicit, "Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Stdcall_FuncPtr"));
break;
case StructID.InnerArrayExplicitId:
InnerArrayExplicit changeInnerArrayExplicit = Helper.NewInnerArrayExplicit(77, 77.0F, "change string1", "change string2");
DelegateStdcallByRef_InnerArrayExplicit caller_InnerArrayExplicit = Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_InnerArrayExplicit(ref sourceInnerArrayExplicit));
- Assert.IsTrue(Helper.ValidateInnerArrayExplicit(sourceInnerArrayExplicit, changeInnerArrayExplicit, "Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Stdcall_FuncPtr"));
+ Assert.True(caller_InnerArrayExplicit(ref sourceInnerArrayExplicit));
+ Assert.True(Helper.ValidateInnerArrayExplicit(sourceInnerArrayExplicit, changeInnerArrayExplicit, "Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Stdcall_FuncPtr"));
break;
case StructID.OUTER3Id:
OUTER3 changeOUTER3 = Helper.NewOUTER3(77, 77.0F, "changed string", "changed string");
DelegateStdcallByRef_OUTER3 caller_OUTER3 = Get_MarshalStructAsParam_AsExpByRefOUTER3_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefOUTER3_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_OUTER3(ref sourceOUTER3));
- Assert.IsTrue(Helper.ValidateOUTER3(sourceOUTER3, changeOUTER3, "Get_MarshalStructAsParam_AsExpByRefOUTER3_Stdcall_FuncPtr"));
+ Assert.True(caller_OUTER3(ref sourceOUTER3));
+ Assert.True(Helper.ValidateOUTER3(sourceOUTER3, changeOUTER3, "Get_MarshalStructAsParam_AsExpByRefOUTER3_Stdcall_FuncPtr"));
break;
case StructID.UId:
- U sourceU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue,
+ U sourceU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue,
byte.MinValue, sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 3.2);
- U changeU = Helper.NewU(Int32.MaxValue, UInt32.MinValue, new IntPtr(-64), new UIntPtr(64), short.MaxValue, ushort.MinValue,
+ U changeU = Helper.NewU(Int32.MaxValue, UInt32.MinValue, new IntPtr(-64), new UIntPtr(64), short.MaxValue, ushort.MinValue,
byte.MaxValue, sbyte.MinValue, long.MaxValue, ulong.MinValue, 64.0F, 6.4);
DelegateStdcallByRef_U caller_U = Get_MarshalStructAsParam_AsExpByRefU_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefU_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_U(ref sourceU));
- Assert.IsTrue(Helper.ValidateU(sourceU, changeU, "Get_MarshalStructAsParam_AsExpByRefU_Stdcall_FuncPtr"));
+ Assert.True(caller_U(ref sourceU));
+ Assert.True(Helper.ValidateU(sourceU, changeU, "Get_MarshalStructAsParam_AsExpByRefU_Stdcall_FuncPtr"));
break;
case StructID.ByteStructPack2ExplicitId:
ByteStructPack2Explicit change_bspe = Helper.NewByteStructPack2Explicit(64, 64);
DelegateStdcallByRef_ByteStructPack2Explicit caller_ByteStructPack2Explicit = Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_ByteStructPack2Explicit(ref source_bspe));
- Assert.IsTrue(Helper.ValidateByteStructPack2Explicit(source_bspe, change_bspe, "Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Stdcall_FuncPtr"));
+ Assert.True(caller_ByteStructPack2Explicit(ref source_bspe));
+ Assert.True(Helper.ValidateByteStructPack2Explicit(source_bspe, change_bspe, "Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Stdcall_FuncPtr"));
break;
case StructID.ShortStructPack4ExplicitId:
ShortStructPack4Explicit change_sspe = Helper.NewShortStructPack4Explicit(64, 64);
DelegateStdcallByRef_ShortStructPack4Explicit caller_ShortStructPack4Explicit = Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_ShortStructPack4Explicit(ref source_sspe));
- Assert.IsTrue(Helper.ValidateShortStructPack4Explicit(source_sspe, change_sspe, "Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Stdcall_FuncPtr"));
+ Assert.True(caller_ShortStructPack4Explicit(ref source_sspe));
+ Assert.True(Helper.ValidateShortStructPack4Explicit(source_sspe, change_sspe, "Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Stdcall_FuncPtr"));
break;
case StructID.IntStructPack8ExplicitId:
IntStructPack8Explicit change_ispe = Helper.NewIntStructPack8Explicit(64, 64);
DelegateStdcallByRef_IntStructPack8Explicit caller_IntStructPack8Explicit = Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_IntStructPack8Explicit(ref source_ispe));
- Assert.IsTrue(Helper.ValidateIntStructPack8Explicit(source_ispe, change_ispe, "Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Stdcall_FuncPtr"));
+ Assert.True(caller_IntStructPack8Explicit(ref source_ispe));
+ Assert.True(Helper.ValidateIntStructPack8Explicit(source_ispe, change_ispe, "Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Stdcall_FuncPtr"));
break;
case StructID.LongStructPack16ExplicitId:
LongStructPack16Explicit change_lspe = Helper.NewLongStructPack16Explicit(64, 64);
DelegateStdcallByRef_LongStructPack16Explicit caller_LongStructPack16Explicit = Get_MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_LongStructPack16Explicit(ref source_lspe));
- Assert.IsTrue(Helper.ValidateLongStructPack16Explicit(source_lspe, change_lspe, "Get_MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Stdcall_FuncPtr"));
+ Assert.True(caller_LongStructPack16Explicit(ref source_lspe));
+ Assert.True(Helper.ValidateLongStructPack16Explicit(source_lspe, change_lspe, "Get_MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Stdcall_FuncPtr"));
break;
default:
- Assert.Fail("TestMethod_DelegatePInvoke_MarshalByRef_Stdcall:The structid (Managed Side) is wrong");
+ Assert.True(false, "TestMethod_DelegatePInvoke_MarshalByRef_Stdcall:The structid (Managed Side) is wrong");
break;
}
}
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateCdeclByVal_InnerExplicit Get_MarshalStructAsParam_AsExpByValInnerExplicit_Cdecl_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelegateCdeclByVal_InnerArrayExplicit([In, Out] InnerArrayExplicit iae);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateCdeclByVal_InnerArrayExplicit Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Cdecl_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelegateCdeclByVal_OUTER3([In, Out] OUTER3 outer);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateCdeclByVal_OUTER3 Get_MarshalStructAsParam_AsExpByValOUTER3_Cdecl_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelegateCdeclByVal_U([In, Out] U u);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateCdeclByVal_U Get_MarshalStructAsParam_AsExpByValU_Cdecl_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelegateCdeclByVal_ByteStructPack2Explicit([In, Out] ByteStructPack2Explicit bspe);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateCdeclByVal_ByteStructPack2Explicit Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Cdecl_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelegateCdeclByVal_ShortStructPack4Explicit([In, Out] ShortStructPack4Explicit bspe);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateCdeclByVal_ShortStructPack4Explicit Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Cdecl_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelegateCdeclByVal_IntStructPack8Explicit([In, Out] IntStructPack8Explicit bspe);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateCdeclByVal_IntStructPack8Explicit Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Cdecl_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DelegateCdeclByVal_LongStructPack16Explicit([In, Out] LongStructPack16Explicit bspe);
INNER2 cloneINNER2 = Helper.NewINNER2(1, 1.0F, "some string");
DelegateCdeclByVal_INNER2 caller_INNER2 = Get_MarshalStructAsParam_AsExpByValINNER2_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValINNER2_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_INNER2(sourceINNER2));
- Assert.IsTrue(Helper.ValidateINNER2(sourceINNER2, cloneINNER2, "Get_MarshalStructAsParam_AsExpByValINNER2_Cdecl_FuncPtr"));
+ Assert.True(caller_INNER2(sourceINNER2));
+ Assert.True(Helper.ValidateINNER2(sourceINNER2, cloneINNER2, "Get_MarshalStructAsParam_AsExpByValINNER2_Cdecl_FuncPtr"));
break;
case StructID.InnerExplicitId:
cloneInnerExplicit.f3 = "some string";
DelegateCdeclByVal_InnerExplicit caller_InnerExplicit = Get_MarshalStructAsParam_AsExpByValInnerExplicit_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValInnerExplicit_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_InnerExplicit(sourceInnerExplicit));
- Assert.IsTrue(Helper.ValidateInnerExplicit(sourceInnerExplicit, cloneInnerExplicit, "Get_MarshalStructAsParam_AsExpByValInnerExplicit_Cdecl_FuncPtr"));
+ Assert.True(caller_InnerExplicit(sourceInnerExplicit));
+ Assert.True(Helper.ValidateInnerExplicit(sourceInnerExplicit, cloneInnerExplicit, "Get_MarshalStructAsParam_AsExpByValInnerExplicit_Cdecl_FuncPtr"));
break;
case StructID.InnerArrayExplicitId:
InnerArrayExplicit cloneInnerArrayExplicit = Helper.NewInnerArrayExplicit(1, 1.0F, "some string1", "some string2");
DelegateCdeclByVal_InnerArrayExplicit caller_InnerArrayExplicit = Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_InnerArrayExplicit(sourceInnerArrayExplicit));
- Assert.IsTrue(Helper.ValidateInnerArrayExplicit(sourceInnerArrayExplicit, cloneInnerArrayExplicit, "Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Cdecl_FuncPtr"));
+ Assert.True(caller_InnerArrayExplicit(sourceInnerArrayExplicit));
+ Assert.True(Helper.ValidateInnerArrayExplicit(sourceInnerArrayExplicit, cloneInnerArrayExplicit, "Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Cdecl_FuncPtr"));
break;
case StructID.OUTER3Id:
OUTER3 cloneOUTER3 = Helper.NewOUTER3(1, 1.0F, "some string", "some string");
DelegateCdeclByVal_OUTER3 caller_OUTER3 = Get_MarshalStructAsParam_AsExpByValOUTER3_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValOUTER3_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_OUTER3(sourceOUTER3));
- Assert.IsTrue(Helper.ValidateOUTER3(sourceOUTER3, cloneOUTER3, "Get_MarshalStructAsParam_AsExpByValOUTER3_Cdecl_FuncPtr"));
+ Assert.True(caller_OUTER3(sourceOUTER3));
+ Assert.True(Helper.ValidateOUTER3(sourceOUTER3, cloneOUTER3, "Get_MarshalStructAsParam_AsExpByValOUTER3_Cdecl_FuncPtr"));
break;
case StructID.UId:
- U sourceU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue, byte.MinValue,
+ U sourceU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue, byte.MinValue,
sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 3.2);
- U cloneU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue, byte.MinValue,
+ U cloneU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue, byte.MinValue,
sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 3.2);
DelegateCdeclByVal_U caller_U = Get_MarshalStructAsParam_AsExpByValU_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValU_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_U(sourceU));
- Assert.IsTrue(Helper.ValidateU(sourceU, cloneU, "Get_MarshalStructAsParam_AsExpByValU_Cdecl_FuncPtr"));
+ Assert.True(caller_U(sourceU));
+ Assert.True(Helper.ValidateU(sourceU, cloneU, "Get_MarshalStructAsParam_AsExpByValU_Cdecl_FuncPtr"));
break;
case StructID.ByteStructPack2ExplicitId:
ByteStructPack2Explicit clone_bspe = Helper.NewByteStructPack2Explicit(32, 32);
DelegateCdeclByVal_ByteStructPack2Explicit caller_ByteStructPack2Explicit = Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_ByteStructPack2Explicit(source_bspe));
- Assert.IsTrue(Helper.ValidateByteStructPack2Explicit(source_bspe, clone_bspe, "Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Cdecl_FuncPtr"));
+ Assert.True(caller_ByteStructPack2Explicit(source_bspe));
+ Assert.True(Helper.ValidateByteStructPack2Explicit(source_bspe, clone_bspe, "Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Cdecl_FuncPtr"));
break;
case StructID.ShortStructPack4ExplicitId:
ShortStructPack4Explicit clone_sspe = Helper.NewShortStructPack4Explicit(32, 32);
DelegateCdeclByVal_ShortStructPack4Explicit caller_ShortStructPack4Explicit = Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_ShortStructPack4Explicit(source_sspe));
- Assert.IsTrue(Helper.ValidateShortStructPack4Explicit(source_sspe, clone_sspe, "Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Cdecl_FuncPtr"));
+ Assert.True(caller_ShortStructPack4Explicit(source_sspe));
+ Assert.True(Helper.ValidateShortStructPack4Explicit(source_sspe, clone_sspe, "Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Cdecl_FuncPtr"));
break;
case StructID.IntStructPack8ExplicitId:
IntStructPack8Explicit clone_ispe = Helper.NewIntStructPack8Explicit(32, 32);
DelegateCdeclByVal_IntStructPack8Explicit caller_IntStructPack8Explicit = Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_IntStructPack8Explicit(source_ispe));
- Assert.IsTrue(Helper.ValidateIntStructPack8Explicit(source_ispe, clone_ispe, "Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Cdecl_FuncPtr"));
+ Assert.True(caller_IntStructPack8Explicit(source_ispe));
+ Assert.True(Helper.ValidateIntStructPack8Explicit(source_ispe, clone_ispe, "Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Cdecl_FuncPtr"));
break;
case StructID.LongStructPack16ExplicitId:
LongStructPack16Explicit clone_lspe = Helper.NewLongStructPack16Explicit(32, 32);
DelegateCdeclByVal_LongStructPack16Explicit caller_LongStructPack16Explicit = Get_MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Cdecl_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Cdecl_FuncPtr...");
- Assert.IsTrue(caller_LongStructPack16Explicit(source_lspe));
- Assert.IsTrue(Helper.ValidateLongStructPack16Explicit(source_lspe, clone_lspe, "Get_MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Cdecl_FuncPtr"));
+ Assert.True(caller_LongStructPack16Explicit(source_lspe));
+ Assert.True(Helper.ValidateLongStructPack16Explicit(source_lspe, clone_lspe, "Get_MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Cdecl_FuncPtr"));
break;
default:
- Assert.Fail("TestMethod_DelegatePInvoke_MarshalByRef_Cdecl:The structid (Managed Side) is wrong");
+ Assert.True(false, "TestMethod_DelegatePInvoke_MarshalByRef_Cdecl:The structid (Managed Side) is wrong");
break;
}
}
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateStdcallByVal_INNER2 Get_MarshalStructAsParam_AsExpByValINNER2_Stdcall_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool DelegateStdcallByVal_InnerExplicit([In, Out] InnerExplicit ie);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateStdcallByVal_InnerExplicit Get_MarshalStructAsParam_AsExpByValInnerExplicit_Stdcall_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool DelegateStdcallByVal_InnerArrayExplicit([In, Out] InnerArrayExplicit iae);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateStdcallByVal_InnerArrayExplicit Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Stdcall_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool DelegateStdcallByVal_OUTER3([In, Out] OUTER3 outer);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateStdcallByVal_OUTER3 Get_MarshalStructAsParam_AsExpByValOUTER3_Stdcall_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool DelegateStdcallByVal_U([In, Out] U u);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateStdcallByVal_U Get_MarshalStructAsParam_AsExpByValU_Stdcall_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool DelegateStdcallByVal_ByteStructPack2Explicit([In, Out] ByteStructPack2Explicit bspe);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateStdcallByVal_ByteStructPack2Explicit Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Stdcall_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool DelegateStdcallByVal_ShortStructPack4Explicit([In, Out] ShortStructPack4Explicit bspe);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateStdcallByVal_ShortStructPack4Explicit Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Stdcall_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool DelegateStdcallByVal_IntStructPack8Explicit([In, Out] IntStructPack8Explicit bspe);
[DllImport("ReversePInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern DelegateStdcallByVal_IntStructPack8Explicit Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Stdcall_FuncPtr();
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool DelegateStdcallByVal_LongStructPack16Explicit([In, Out] LongStructPack16Explicit bspe);
INNER2 cloneINNER2 = Helper.NewINNER2(1, 1.0F, "some string");
DelegateStdcallByVal_INNER2 caller_INNER2 = Get_MarshalStructAsParam_AsExpByValINNER2_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValINNER2_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_INNER2(sourceINNER2));
- Assert.IsTrue(Helper.ValidateINNER2(sourceINNER2, cloneINNER2, "Get_MarshalStructAsParam_AsExpByValINNER2_Stdcall_FuncPtr"));
+ Assert.True(caller_INNER2(sourceINNER2));
+ Assert.True(Helper.ValidateINNER2(sourceINNER2, cloneINNER2, "Get_MarshalStructAsParam_AsExpByValINNER2_Stdcall_FuncPtr"));
break;
case StructID.InnerExplicitId:
cloneInnerExplicit.f3 = "some string";
DelegateStdcallByVal_InnerExplicit caller_InnerExplicit = Get_MarshalStructAsParam_AsExpByValInnerExplicit_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValInnerExplicit_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_InnerExplicit(sourceInnerExplicit));
- Assert.IsTrue(Helper.ValidateInnerExplicit(sourceInnerExplicit, cloneInnerExplicit, "Get_MarshalStructAsParam_AsExpByValInnerExplicit_Stdcall_FuncPtr"));
+ Assert.True(caller_InnerExplicit(sourceInnerExplicit));
+ Assert.True(Helper.ValidateInnerExplicit(sourceInnerExplicit, cloneInnerExplicit, "Get_MarshalStructAsParam_AsExpByValInnerExplicit_Stdcall_FuncPtr"));
break;
case StructID.InnerArrayExplicitId:
InnerArrayExplicit cloneInnerArrayExplicit = Helper.NewInnerArrayExplicit(1, 1.0F, "some string1", "some string2");
DelegateStdcallByVal_InnerArrayExplicit caller_InnerArrayExplicit = Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_InnerArrayExplicit(sourceInnerArrayExplicit));
- Assert.IsTrue(Helper.ValidateInnerArrayExplicit(sourceInnerArrayExplicit, cloneInnerArrayExplicit, "Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Stdcall_FuncPtr"));
+ Assert.True(caller_InnerArrayExplicit(sourceInnerArrayExplicit));
+ Assert.True(Helper.ValidateInnerArrayExplicit(sourceInnerArrayExplicit, cloneInnerArrayExplicit, "Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Stdcall_FuncPtr"));
break;
case StructID.OUTER3Id:
OUTER3 cloneOUTER3 = Helper.NewOUTER3(1, 1.0F, "some string", "some string");
DelegateStdcallByVal_OUTER3 caller_OUTER3 = Get_MarshalStructAsParam_AsExpByValOUTER3_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValOUTER3_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_OUTER3(sourceOUTER3));
- Assert.IsTrue(Helper.ValidateOUTER3(sourceOUTER3, cloneOUTER3, "Get_MarshalStructAsParam_AsExpByValOUTER3_Stdcall_FuncPtr"));
+ Assert.True(caller_OUTER3(sourceOUTER3));
+ Assert.True(Helper.ValidateOUTER3(sourceOUTER3, cloneOUTER3, "Get_MarshalStructAsParam_AsExpByValOUTER3_Stdcall_FuncPtr"));
break;
case StructID.UId:
- U sourceU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue,
+ U sourceU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue,
byte.MinValue, sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 3.2);
- U cloneU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue,
+ U cloneU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue,
byte.MinValue, sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 3.2);
DelegateStdcallByVal_U caller_U = Get_MarshalStructAsParam_AsExpByValU_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValU_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_U(sourceU));
- Assert.IsTrue(Helper.ValidateU(sourceU, cloneU, "Get_MarshalStructAsParam_AsExpByValU_Stdcall_FuncPtr"));
+ Assert.True(caller_U(sourceU));
+ Assert.True(Helper.ValidateU(sourceU, cloneU, "Get_MarshalStructAsParam_AsExpByValU_Stdcall_FuncPtr"));
break;
case StructID.ByteStructPack2ExplicitId:
ByteStructPack2Explicit clone_bspe = Helper.NewByteStructPack2Explicit(32, 32);
DelegateStdcallByVal_ByteStructPack2Explicit caller_ByteStructPack2Explicit = Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_ByteStructPack2Explicit(source_bspe));
- Assert.IsTrue(Helper.ValidateByteStructPack2Explicit(source_bspe, clone_bspe, "Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Stdcall_FuncPtr"));
+ Assert.True(caller_ByteStructPack2Explicit(source_bspe));
+ Assert.True(Helper.ValidateByteStructPack2Explicit(source_bspe, clone_bspe, "Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Stdcall_FuncPtr"));
break;
case StructID.ShortStructPack4ExplicitId:
ShortStructPack4Explicit clone_sspe = Helper.NewShortStructPack4Explicit(32, 32);
DelegateStdcallByVal_ShortStructPack4Explicit caller_ShortStructPack4Explicit = Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_ShortStructPack4Explicit(source_sspe));
- Assert.IsTrue(Helper.ValidateShortStructPack4Explicit(source_sspe, clone_sspe, "Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Stdcall_FuncPtr"));
+ Assert.True(caller_ShortStructPack4Explicit(source_sspe));
+ Assert.True(Helper.ValidateShortStructPack4Explicit(source_sspe, clone_sspe, "Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Stdcall_FuncPtr"));
break;
case StructID.IntStructPack8ExplicitId:
IntStructPack8Explicit clone_ispe = Helper.NewIntStructPack8Explicit(32, 32);
DelegateStdcallByVal_IntStructPack8Explicit caller_IntStructPack8Explicit = Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_IntStructPack8Explicit(source_ispe));
- Assert.IsTrue(Helper.ValidateIntStructPack8Explicit(source_ispe, clone_ispe, "Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Stdcall_FuncPtr"));
+ Assert.True(caller_IntStructPack8Explicit(source_ispe));
+ Assert.True(Helper.ValidateIntStructPack8Explicit(source_ispe, clone_ispe, "Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Stdcall_FuncPtr"));
break;
case StructID.LongStructPack16ExplicitId:
LongStructPack16Explicit clone_lspe = Helper.NewLongStructPack16Explicit(32, 32);
DelegateStdcallByVal_LongStructPack16Explicit caller_LongStructPack16Explicit = Get_MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Stdcall_FuncPtr();
Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Stdcall_FuncPtr...");
- Assert.IsTrue(caller_LongStructPack16Explicit(source_lspe));
- Assert.IsTrue(Helper.ValidateLongStructPack16Explicit(source_lspe, clone_lspe, "Get_MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Stdcall_FuncPtr"));
+ Assert.True(caller_LongStructPack16Explicit(source_lspe));
+ Assert.True(Helper.ValidateLongStructPack16Explicit(source_lspe, clone_lspe, "Get_MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Stdcall_FuncPtr"));
break;
default:
- Assert.Fail("TestMethod_DelegatePInvoke_MarshalByRef_Stdcall:The structid (Managed Side) is wrong");
+ Assert.True(false, "TestMethod_DelegatePInvoke_MarshalByRef_Stdcall:The structid (Managed Side) is wrong");
break;
}
}
using System.Text;
using System.Security;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public class Test_ReversePInvokeTest
{
#region Methods implementation
- #region ReversePinvoke, ByRef, Cdel
-
+ #region ReversePinvoke, ByRef, Cdel
+
//ReversePinvoke,Cdel
// 1.1
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Cdecl");
INNER2 sourceINNER2 = Helper.NewINNER2(77, 77.0F, "Native");
- Assert.IsTrue(Helper.ValidateINNER2(sourceINNER2, inner2, "TestMethod_DoCallBack_MarshalStructByRef_INNER2_Cdecl"));
+ Assert.True(Helper.ValidateINNER2(sourceINNER2, inner2, "TestMethod_DoCallBack_MarshalStructByRef_INNER2_Cdecl"));
//changed the value
inner2.f1 = 1;
inner2.f2 = 1.0F;
InnerExplicit source_ie = new InnerExplicit();
source_ie.f1 = 77;
source_ie.f3 = "Native";
- Assert.IsTrue(Helper.ValidateInnerExplicit(source_ie, inner2, "TestMethod_DoCallBack_MarshalStructByRef_InnerExplicit_Cdecl"));
+ Assert.True(Helper.ValidateInnerExplicit(source_ie, inner2, "TestMethod_DoCallBack_MarshalStructByRef_InnerExplicit_Cdecl"));
//changed the value
inner2.f1 = 1;
inner2.f3 = "some string";
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Cdecl");
InnerArrayExplicit source_iae = Helper.NewInnerArrayExplicit(77, 77.0F, "Native", "Native");
- Assert.IsTrue(Helper.ValidateInnerArrayExplicit(source_iae, iae, "TestMethod_DoCallBack_MarshalStructByRef_InnerArrayExplicit_Cdecl"));
+ Assert.True(Helper.ValidateInnerArrayExplicit(source_iae, iae, "TestMethod_DoCallBack_MarshalStructByRef_InnerArrayExplicit_Cdecl"));
//changed the value
for (int i = 0; i < Common.NumArrElements; i++)
{
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Cdecl");
OUTER3 sourceOUTER3 = Helper.NewOUTER3(77, 77.0F, "Native", "Native");
- Assert.IsTrue(Helper.ValidateOUTER3(sourceOUTER3, outer3, "TestMethod_DoCallBack_MarshalStructByRef_OUTER3_Cdecl"));
+ Assert.True(Helper.ValidateOUTER3(sourceOUTER3, outer3, "TestMethod_DoCallBack_MarshalStructByRef_OUTER3_Cdecl"));
//changed the value
for (int i = 0; i < Common.NumArrElements; i++)
{
public static bool TestMethod_DoCallBack_MarshalStructByRef_U_Cdecl(ref U u)
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Cdecl");
- U changeU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue, byte.MinValue,
+ U changeU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue, byte.MinValue,
sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 1.23);
- Assert.IsTrue(Helper.ValidateU(changeU, u, "TestMethod_DoCallBack_MarshalStructByRef_U_Cdecl"));
+ Assert.True(Helper.ValidateU(changeU, u, "TestMethod_DoCallBack_MarshalStructByRef_U_Cdecl"));
//changed the value
u.d = 3.2;
return true;
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Cdecl");
ByteStructPack2Explicit change_bspe = Helper.NewByteStructPack2Explicit(64, 64);
- Assert.IsTrue(Helper.ValidateByteStructPack2Explicit(change_bspe, bspe, "TestMethod_DoCallBack_MarshalStructByRef_ByteStructPack2Explicit_Cdecl"));
+ Assert.True(Helper.ValidateByteStructPack2Explicit(change_bspe, bspe, "TestMethod_DoCallBack_MarshalStructByRef_ByteStructPack2Explicit_Cdecl"));
//changed the value
bspe.b1 = 32;
bspe.b2 = 32;
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Cdecl");
ShortStructPack4Explicit change_sspe = Helper.NewShortStructPack4Explicit(64, 64);
- Assert.IsTrue(Helper.ValidateShortStructPack4Explicit(change_sspe, sspe, "TestMethod_DoCallBack_MarshalStructByRef_ShortStructPack4Explicit_Cdecl"));
+ Assert.True(Helper.ValidateShortStructPack4Explicit(change_sspe, sspe, "TestMethod_DoCallBack_MarshalStructByRef_ShortStructPack4Explicit_Cdecl"));
//changed the value
sspe.s1 = 32;
sspe.s2 = 32;
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Cdecl");
IntStructPack8Explicit change_ispe = Helper.NewIntStructPack8Explicit(64, 64);
- Assert.IsTrue(Helper.ValidateIntStructPack8Explicit(change_ispe, ispe, "TestMethod_DoCallBack_MarshalStructByRef_IntStructPack8Explicit_Cdecl"));
+ Assert.True(Helper.ValidateIntStructPack8Explicit(change_ispe, ispe, "TestMethod_DoCallBack_MarshalStructByRef_IntStructPack8Explicit_Cdecl"));
//changed the value
ispe.i1 = 32;
ispe.i2 = 32;
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Cdecl");
LongStructPack16Explicit change_lspe = Helper.NewLongStructPack16Explicit(64, 64);
- Assert.IsTrue(Helper.ValidateLongStructPack16Explicit(change_lspe, lspe, "TestMethod_DoCallBack_MarshalStructByRef_LongStructPack16Explicit_Cdecl"));
+ Assert.True(Helper.ValidateLongStructPack16Explicit(change_lspe, lspe, "TestMethod_DoCallBack_MarshalStructByRef_LongStructPack16Explicit_Cdecl"));
//changed the value
lspe.l1 = 32;
lspe.l2 = 32;
}
#endregion
-
+
#region ReversePinvoke, ByRef, Stdcall
//ReversePinvoke,Stdcall
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Stdcall");
INNER2 sourceINNER2 = Helper.NewINNER2(77, 77.0F, "Native");
- Assert.IsTrue(Helper.ValidateINNER2(sourceINNER2, inner2, "TestMethod_DoCallBack_MarshalStructByRef_INNER2_Stdcall"));
+ Assert.True(Helper.ValidateINNER2(sourceINNER2, inner2, "TestMethod_DoCallBack_MarshalStructByRef_INNER2_Stdcall"));
//changed the value
inner2.f1 = 1;
inner2.f2 = 1.0F;
InnerExplicit source_ie = new InnerExplicit();
source_ie.f1 = 77;
source_ie.f3 = "Native";
- Assert.IsTrue(Helper.ValidateInnerExplicit(inner2,source_ie, "TestMethod_DoCallBack_MarshalStructByRef_InnerExplicit_Stdcall"));
+ Assert.True(Helper.ValidateInnerExplicit(inner2,source_ie, "TestMethod_DoCallBack_MarshalStructByRef_InnerExplicit_Stdcall"));
//changed the value
inner2.f1 = 1;
inner2.f3 = "some string";
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Stdcall");
InnerArrayExplicit source_iae = Helper.NewInnerArrayExplicit(77, 77.0F, "Native", "Native");
- Assert.IsTrue(Helper.ValidateInnerArrayExplicit(source_iae, iae, "TestMethod_DoCallBack_MarshalStructByRef_InnerArrayExplicit_Stdcall"));
+ Assert.True(Helper.ValidateInnerArrayExplicit(source_iae, iae, "TestMethod_DoCallBack_MarshalStructByRef_InnerArrayExplicit_Stdcall"));
//changed the value
for (int i = 0; i < Common.NumArrElements; i++)
{
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Stdcall");
OUTER3 sourceOUTER3 = Helper.NewOUTER3(77, 77.0F, "Native", "Native");
- Assert.IsTrue(Helper.ValidateOUTER3(sourceOUTER3, outer3, "TestMethod_DoCallBack_MarshalStructByRef_OUTER3_Stdcall"));
+ Assert.True(Helper.ValidateOUTER3(sourceOUTER3, outer3, "TestMethod_DoCallBack_MarshalStructByRef_OUTER3_Stdcall"));
//changed the value
for (int i = 0; i < Common.NumArrElements; i++)
{
public static bool TestMethod_DoCallBack_MarshalStructByRef_U_Stdcall(ref U u)
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Stdcall");
- U changeU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue, byte.MinValue,
+ U changeU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue, byte.MinValue,
sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 1.23);
- Assert.IsTrue(Helper.ValidateU(changeU, u, "TestMethod_DoCallBack_MarshalStructByRef_U_Stdcall"));
+ Assert.True(Helper.ValidateU(changeU, u, "TestMethod_DoCallBack_MarshalStructByRef_U_Stdcall"));
//changed the value
u.d = 3.2;
return true;
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Stdcall");
ByteStructPack2Explicit change_bspe = Helper.NewByteStructPack2Explicit(64, 64);
- Assert.IsTrue(Helper.ValidateByteStructPack2Explicit(change_bspe, bspe, "TestMethod_DoCallBack_MarshalStructByRef_ByteStructPack2Explicit_Stdcall"));
+ Assert.True(Helper.ValidateByteStructPack2Explicit(change_bspe, bspe, "TestMethod_DoCallBack_MarshalStructByRef_ByteStructPack2Explicit_Stdcall"));
//changed the value
bspe.b1 = 32;
bspe.b2 = 32;
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Stdcall");
ShortStructPack4Explicit change_sspe = Helper.NewShortStructPack4Explicit(64, 64);
- Assert.IsTrue(Helper.ValidateShortStructPack4Explicit(change_sspe, sspe, "TestMethod_DoCallBack_MarshalStructByRef_ShortStructPack4Explicit_Stdcall"));
+ Assert.True(Helper.ValidateShortStructPack4Explicit(change_sspe, sspe, "TestMethod_DoCallBack_MarshalStructByRef_ShortStructPack4Explicit_Stdcall"));
//changed the value
sspe.s1 = 32;
sspe.s2 = 32;
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Stdcall");
IntStructPack8Explicit change_ispe = Helper.NewIntStructPack8Explicit(64, 64);
- Assert.IsTrue(Helper.ValidateIntStructPack8Explicit(change_ispe, ispe, "TestMethod_DoCallBack_MarshalStructByRef_IntStructPack8Explicit_Stdcall"));
+ Assert.True(Helper.ValidateIntStructPack8Explicit(change_ispe, ispe, "TestMethod_DoCallBack_MarshalStructByRef_IntStructPack8Explicit_Stdcall"));
//changed the value
ispe.i1 = 32;
ispe.i2 = 32;
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Stdcall");
LongStructPack16Explicit change_lspe = Helper.NewLongStructPack16Explicit(64, 64);
- Assert.IsTrue(Helper.ValidateLongStructPack16Explicit(change_lspe, lspe, "TestMethod_DoCallBack_MarshalStructByRef_LongStructPack16Explicit_Stdcall"));
+ Assert.True(Helper.ValidateLongStructPack16Explicit(change_lspe, lspe, "TestMethod_DoCallBack_MarshalStructByRef_LongStructPack16Explicit_Stdcall"));
//changed the value
lspe.l1 = 32;
lspe.l2 = 32;
}
#endregion
-
+
#region ReversePinvoke, ByVal, Cdel
// 3.1
{
Console.WriteLine("Reverse,Pinvoke,By Ref,Cdecl");
INNER2 sourceINNER2 = Helper.NewINNER2(1, 1.0F, "some string");
- Assert.IsTrue(Helper.ValidateINNER2(sourceINNER2, inner2, "TestMethod_DoCallBack_MarshalStructByVal_INNER2_Cdecl"));
+ Assert.True(Helper.ValidateINNER2(sourceINNER2, inner2, "TestMethod_DoCallBack_MarshalStructByVal_INNER2_Cdecl"));
//changed the value
inner2.f1 = 77;
inner2.f2 = 77.0F;
InnerExplicit source_ie = new InnerExplicit();
source_ie.f1 = 1;
source_ie.f3 = "Native";
- Assert.IsTrue(Helper.ValidateInnerExplicit(source_ie, inner2, "TestMethod_DoCallBack_MarshalStructByVal_InnerExplicit_Cdecl"));
+ Assert.True(Helper.ValidateInnerExplicit(source_ie, inner2, "TestMethod_DoCallBack_MarshalStructByVal_InnerExplicit_Cdecl"));
//changed the value
inner2.f1 = 1;
inner2.f3 = "changed string";
{
Console.WriteLine("Reverse,Pinvoke,By Val,Cdecl");
InnerArrayExplicit source_iae = Helper.NewInnerArrayExplicit(1, 1.0F, "some string", "some string");
- Assert.IsTrue(Helper.ValidateInnerArrayExplicit(source_iae, iae, "TestMethod_DoCallBack_MarshalStructByVal_InnerArrayExplicit_Cdecl"));
+ Assert.True(Helper.ValidateInnerArrayExplicit(source_iae, iae, "TestMethod_DoCallBack_MarshalStructByVal_InnerArrayExplicit_Cdecl"));
//changed the value
for (int i = 0; i < Common.NumArrElements; i++)
{
{
Console.WriteLine("Reverse,Pinvoke,By Val,Cdecl");
OUTER3 sourceOUTER3 = Helper.NewOUTER3(1, 1.0F, "some string", "some string");
- Assert.IsTrue(Helper.ValidateOUTER3(sourceOUTER3, outer3, "TestMethod_DoCallBack_MarshalStructByVal_OUTER3_Cdecl"));
+ Assert.True(Helper.ValidateOUTER3(sourceOUTER3, outer3, "TestMethod_DoCallBack_MarshalStructByVal_OUTER3_Cdecl"));
//changed the value
for (int i = 0; i < Common.NumArrElements; i++)
{
public static bool TestMethod_DoCallBack_MarshalStructByVal_U_Cdecl( U u)
{
Console.WriteLine("Reverse,Pinvoke,By Val,Cdecl");
- U changeU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue, byte.MinValue,
+ U changeU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue, byte.MinValue,
sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 3.2);
- Assert.IsTrue(Helper.ValidateU(changeU, u, "TestMethod_DoCallBack_MarshalStructByVal_U_Cdecl"));
+ Assert.True(Helper.ValidateU(changeU, u, "TestMethod_DoCallBack_MarshalStructByVal_U_Cdecl"));
//changed the value
u.d = 1.23;
return true;
{
Console.WriteLine("Reverse,Pinvoke,By Val,Cdecl");
ByteStructPack2Explicit change_bspe = Helper.NewByteStructPack2Explicit(32, 32);
- Assert.IsTrue(Helper.ValidateByteStructPack2Explicit(change_bspe, bspe, "TestMethod_DoCallBack_MarshalStructByVal_ByteStructPack2Explicit_Cdecl"));
+ Assert.True(Helper.ValidateByteStructPack2Explicit(change_bspe, bspe, "TestMethod_DoCallBack_MarshalStructByVal_ByteStructPack2Explicit_Cdecl"));
//changed the value
bspe.b1 = 64;
bspe.b2 = 64;
{
Console.WriteLine("Reverse,Pinvoke,By Val,Cdecl");
ShortStructPack4Explicit change_sspe = Helper.NewShortStructPack4Explicit(32, 32);
- Assert.IsTrue(Helper.ValidateShortStructPack4Explicit(change_sspe, sspe, "TestMethod_DoCallBack_MarshalStructByVal_ShortStructPack4Explicit_Cdecl"));
+ Assert.True(Helper.ValidateShortStructPack4Explicit(change_sspe, sspe, "TestMethod_DoCallBack_MarshalStructByVal_ShortStructPack4Explicit_Cdecl"));
//changed the value
sspe.s1 = 64;
sspe.s2 = 64;
{
Console.WriteLine("Reverse,Pinvoke,By Val,Cdecl");
IntStructPack8Explicit change_ispe = Helper.NewIntStructPack8Explicit(32, 32);
- Assert.IsTrue(Helper.ValidateIntStructPack8Explicit(change_ispe, ispe, "TestMethod_DoCallBack_MarshalStructByVal_IntStructPack8Explicit_Cdecl"));
+ Assert.True(Helper.ValidateIntStructPack8Explicit(change_ispe, ispe, "TestMethod_DoCallBack_MarshalStructByVal_IntStructPack8Explicit_Cdecl"));
//changed the value
ispe.i1 = 64;
ispe.i2 = 64;
{
Console.WriteLine("Reverse,Pinvoke,By Val,Cdecl");
LongStructPack16Explicit change_lspe = Helper.NewLongStructPack16Explicit(32, 32);
- Assert.IsTrue(Helper.ValidateLongStructPack16Explicit(change_lspe, lspe, "TestMethod_DoCallBack_MarshalStructByVal_LongStructPack16Explicit_Cdecl"));
+ Assert.True(Helper.ValidateLongStructPack16Explicit(change_lspe, lspe, "TestMethod_DoCallBack_MarshalStructByVal_LongStructPack16Explicit_Cdecl"));
//changed the value
lspe.l1 = 64;
lspe.l2 = 64;
}
#endregion
-
+
#region ReversePinvoke, ByVal, Stdcall
-
+
// 4.1
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool ByValStdcallcaller_INNER2([In, Out] INNER2 inner2);
{
Console.WriteLine("Reverse,Pinvoke,By Val,Stdcall");
INNER2 sourceINNER2 = Helper.NewINNER2(1, 1.0F, "some string");
- Assert.IsTrue(Helper.ValidateINNER2(sourceINNER2, inner2, "TestMethod_DoCallBack_MarshalStructByVal_INNER2_Stdcall"));
+ Assert.True(Helper.ValidateINNER2(sourceINNER2, inner2, "TestMethod_DoCallBack_MarshalStructByVal_INNER2_Stdcall"));
//changed the value
inner2.f1 = 77;
inner2.f2 = 77.0F;
inner2.f3 = "changed string";
return true;
}
-
+
// 4.2
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool ByValStdcallcaller_InnerExplicit([In, Out] InnerExplicit inner2);
InnerExplicit source_ie = new InnerExplicit();
source_ie.f1 = 1;
source_ie.f3 = "Native";
- Assert.IsTrue(Helper.ValidateInnerExplicit(source_ie, inner2, "TestMethod_DoCallBack_MarshalStructByVal_InnerExplicit_Stdcall"));
+ Assert.True(Helper.ValidateInnerExplicit(source_ie, inner2, "TestMethod_DoCallBack_MarshalStructByVal_InnerExplicit_Stdcall"));
//changed the value
inner2.f1 = 1;
inner2.f3 = "changed string";
return true;
}
-
+
// 4.3
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool ByValStdcallcaller_InnerArrayExplicit([In, Out] InnerArrayExplicit inner2);
{
Console.WriteLine("Reverse,Pinvoke,By Val,Stdcall");
InnerArrayExplicit source_iae = Helper.NewInnerArrayExplicit(1, 1.0F, "some string", "some string");
- Assert.IsTrue(Helper.ValidateInnerArrayExplicit(source_iae, iae, "TestMethod_DoCallBack_MarshalStructByVal_InnerArrayExplicit_Stdcall"));
+ Assert.True(Helper.ValidateInnerArrayExplicit(source_iae, iae, "TestMethod_DoCallBack_MarshalStructByVal_InnerArrayExplicit_Stdcall"));
//changed the value
for (int i = 0; i < Common.NumArrElements; i++)
{
iae.f4 = "changed string";
return true;
}
-
+
// 4.4
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool ByValStdcallcaller_OUTER3([In, Out] OUTER3 outer3);
{
Console.WriteLine("Reverse,Pinvoke,By Val,Stdcall");
OUTER3 sourceOUTER3 = Helper.NewOUTER3(1, 1.0F, "some string", "some string");
- Assert.IsTrue(Helper.ValidateOUTER3(sourceOUTER3, outer3, "TestMethod_DoCallBack_MarshalStructByVal_OUTER3_Stdcall"));
+ Assert.True(Helper.ValidateOUTER3(sourceOUTER3, outer3, "TestMethod_DoCallBack_MarshalStructByVal_OUTER3_Stdcall"));
//changed the value
for (int i = 0; i < Common.NumArrElements; i++)
{
public static bool TestMethod_DoCallBack_MarshalStructByVal_U_Stdcall(U u)
{
Console.WriteLine("Reverse,Pinvoke,By Val,Stdcall");
- U changeU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue, byte.MinValue,
+ U changeU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue, byte.MinValue,
sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 3.2);
- Assert.IsTrue(Helper.ValidateU(changeU, u, "TestMethod_DoCallBack_MarshalStructByVal_U_Stdcall"));
+ Assert.True(Helper.ValidateU(changeU, u, "TestMethod_DoCallBack_MarshalStructByVal_U_Stdcall"));
//changed the value
u.d = 1.23;
return true;
}
-
+
// 4.6
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool ByValStdcallcaller_ByteStructPack2Explicit([In, Out] ByteStructPack2Explicit bspe);
{
Console.WriteLine("Reverse,Pinvoke,By Val,Stdcall");
ByteStructPack2Explicit change_bspe = Helper.NewByteStructPack2Explicit(32, 32);
- Assert.IsTrue(Helper.ValidateByteStructPack2Explicit(change_bspe, bspe, "TestMethod_DoCallBack_MarshalStructByVal_ByteStructPack2Explicit_Stdcall"));
+ Assert.True(Helper.ValidateByteStructPack2Explicit(change_bspe, bspe, "TestMethod_DoCallBack_MarshalStructByVal_ByteStructPack2Explicit_Stdcall"));
//changed the value
bspe.b1 = 64;
bspe.b2 = 64;
{
Console.WriteLine("Reverse,Pinvoke,By Val,Stdcall");
ShortStructPack4Explicit change_sspe = Helper.NewShortStructPack4Explicit(32, 32);
- Assert.IsTrue(Helper.ValidateShortStructPack4Explicit(change_sspe, sspe, "TestMethod_DoCallBack_MarshalStructByVal_ShortStructPack4Explicit_Stdcall"));
+ Assert.True(Helper.ValidateShortStructPack4Explicit(change_sspe, sspe, "TestMethod_DoCallBack_MarshalStructByVal_ShortStructPack4Explicit_Stdcall"));
//changed the value
sspe.s1 = 64;
sspe.s2 = 64;
{
Console.WriteLine("Reverse,Pinvoke,By Val,Stdcall");
IntStructPack8Explicit change_ispe = Helper.NewIntStructPack8Explicit(32, 32);
- Assert.IsTrue(Helper.ValidateIntStructPack8Explicit(change_ispe, ispe, "TestMethod_DoCallBack_MarshalStructByVal_IntStructPack8Explicit_Stdcall"));
+ Assert.True(Helper.ValidateIntStructPack8Explicit(change_ispe, ispe, "TestMethod_DoCallBack_MarshalStructByVal_IntStructPack8Explicit_Stdcall"));
//changed the value
ispe.i1 = 64;
ispe.i2 = 64;
{
Console.WriteLine("Reverse,Pinvoke,By Val,Stdcall");
LongStructPack16Explicit change_lspe = Helper.NewLongStructPack16Explicit(32, 32);
- Assert.IsTrue(Helper.ValidateLongStructPack16Explicit(change_lspe, lspe, "TestMethod_DoCallBack_MarshalStructByVal_LongStructPack16Explicit_Stdcall"));
+ Assert.True(Helper.ValidateLongStructPack16Explicit(change_lspe, lspe, "TestMethod_DoCallBack_MarshalStructByVal_LongStructPack16Explicit_Stdcall"));
//changed the value
lspe.l1 = 64;
lspe.l2 = 64;
}
#endregion
-
+
#endregion
static int Main()
DoCallBack_MarshalByRefStruct_Cdecl_ShortStructPack4Explicit(new ByRefCdeclcaller_ShortStructPack4Explicit(TestMethod_DoCallBack_MarshalStructByRef_ShortStructPack4Explicit_Cdecl));
DoCallBack_MarshalByRefStruct_Cdecl_IntStructPack8Explicit(new ByRefCdeclcaller_IntStructPack8Explicit(TestMethod_DoCallBack_MarshalStructByRef_IntStructPack8Explicit_Cdecl));
DoCallBack_MarshalByRefStruct_Cdecl_LongStructPack16Explicit(new ByRefCdeclcaller_LongStructPack16Explicit(TestMethod_DoCallBack_MarshalStructByRef_LongStructPack16Explicit_Cdecl));
-
+
////Reverse Pinvoke,ByRef,StdCall
DoCallBack_MarshalByRefStruct_Stdcall_INNER2(new ByRefStdcallcaller_INNER2(TestMethod_DoCallBack_MarshalStructByRef_INNER2_Stdcall));
DoCallBack_MarshalByRefStruct_Stdcall_InnerExplicit(new ByRefStdcallcaller_InnerExplicit(TestMethod_DoCallBack_MarshalStructByRef_InnerExplicit_Stdcall));
DoCallBack_MarshalByValStruct_Stdcall_ShortStructPack4Explicit(new ByValStdcallcaller_ShortStructPack4Explicit(TestMethod_DoCallBack_MarshalStructByVal_ShortStructPack4Explicit_Stdcall));
DoCallBack_MarshalByValStruct_Stdcall_IntStructPack8Explicit(new ByValStdcallcaller_IntStructPack8Explicit(TestMethod_DoCallBack_MarshalStructByVal_IntStructPack8Explicit_Stdcall));
DoCallBack_MarshalByValStruct_Stdcall_LongStructPack16Explicit(new ByValStdcallcaller_LongStructPack16Explicit(TestMethod_DoCallBack_MarshalStructByVal_LongStructPack16Explicit_Stdcall));
-
+
#endregion
return 100;
using System.Text;
using System.Security;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public class MarshalStructTest
{
}
#region Methods for the struct InnerSequential declaration
-
+
#region PassByRef
-
+
//For Delegate Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool InnerSequentialByRefDelegateCdecl([In, Out]ref InnerSequential argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern InnerSequentialByRefDelegateStdCall Get_MarshalStructInnerSequentialByRef_StdCall_FuncPtr();
-
+
#endregion
-
+
#region PassByValue
-
+
//For Delegate Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool InnerSequentialByValDelegateCdecl([In, Out] InnerSequential argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern InnerSequentialByValDelegateStdCall Get_MarshalStructInnerSequentialByVal_StdCall_FuncPtr();
-
+
#endregion
#endregion
#region Methods for the struct InnerArraySequential declaration
-
+
#region PassByRef
-
+
//For Delegate Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool InnerArraySequentialByRefDelegateCdecl([In, Out]ref InnerArraySequential argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern InnerArraySequentialByRefDelegateStdCall Get_MarshalStructInnerArraySequentialByRef_StdCall_FuncPtr();
-
+
#endregion
-
+
#region PassByValue
-
+
//For Delegate Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool InnerArraySequentialByValDelegateCdecl([In, Out] InnerArraySequential argStr);
public static extern InnerArraySequentialByValDelegateStdCall Get_MarshalStructInnerArraySequentialByVal_StdCall_FuncPtr();
#endregion
-
+
#endregion
#region Methods for the struct CharSetAnsiSequential declaration
-
+
#region PassByRef
-
+
//For Delegate Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool CharSetAnsiSequentialByRefDelegateCdecl([In, Out]ref CharSetAnsiSequential argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern CharSetAnsiSequentialByRefDelegateStdCall Get_MarshalStructCharSetAnsiSequentialByRef_StdCall_FuncPtr();
-
+
#endregion
-
+
#region PassByValue
-
+
//For Delegate Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool CharSetAnsiSequentialByValDelegateCdecl([In, Out] CharSetAnsiSequential argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern CharSetAnsiSequentialByValDelegateStdCall Get_MarshalStructCharSetAnsiSequentialByVal_StdCall_FuncPtr();
-
+
#endregion
-
+
#endregion
#region Methods for the struct CharSetUnicodeSequential declaration
-
+
#region PassByRef
-
+
//For Delegate Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool CharSetUnicodeSequentialByRefDelegateCdecl([In, Out]ref CharSetUnicodeSequential argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern CharSetUnicodeSequentialByRefDelegateStdCall Get_MarshalStructCharSetUnicodeSequentialByRef_StdCall_FuncPtr();
-
+
#endregion
-
+
#region PassByValue
-
+
//For Delegate Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool CharSetUnicodeSequentialByValDelegateCdecl([In, Out] CharSetUnicodeSequential argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern CharSetUnicodeSequentialByValDelegateStdCall Get_MarshalStructCharSetUnicodeSequentialByVal_StdCall_FuncPtr();
-
+
#endregion
-
+
#endregion
#region Methods for the struct NumberSequential declaration
#region PassByRef
-
+
//For Delegate Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool NumberSequentialByRefDelegateCdecl([In, Out]ref NumberSequential argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern NumberSequentialByRefDelegateStdCall Get_MarshalStructNumberSequentialByRef_StdCall_FuncPtr();
-
+
#endregion
-
+
#region PassByValue
-
+
//For Delegate Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool NumberSequentialByValDelegateCdecl([In, Out] NumberSequential argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern NumberSequentialByValDelegateStdCall Get_MarshalStructNumberSequentialByVal_StdCall_FuncPtr();
-
+
#endregion
#endregion
#region Methods for the struct S3 declaration
#region PassByRef
-
+
//For Delegate Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S3ByRefDelegateCdecl([In, Out]ref S3 argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern S3ByRefDelegateStdCall Get_MarshalStructS3ByRef_StdCall_FuncPtr();
-
+
#endregion
-
+
#region PassByValue
-
+
//For Delegate Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S3ByValDelegateCdecl([In, Out] S3 argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern S3ByValDelegateStdCall Get_MarshalStructS3ByVal_StdCall_FuncPtr();
-
+
#endregion
#endregion
#region Methods for the struct S5 declaration
#region PassByRef
-
+
//For Delegate Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S5ByRefDelegateCdecl([In, Out]ref S5 argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern S5ByRefDelegateStdCall Get_MarshalStructS5ByRef_StdCall_FuncPtr();
-
+
#endregion
-
+
#region PassByValue
-
+
//For Delegate Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S5ByValDelegateCdecl([In, Out] S5 argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern S5ByValDelegateStdCall Get_MarshalStructS5ByVal_StdCall_FuncPtr();
-
+
#endregion
#endregion
#region Methods for the struct StringStructSequentialAnsi declaration
#region PassByRef
-
+
//For Delegate Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool StringStructSequentialAnsiByRefDelegateCdecl([In, Out]ref StringStructSequentialAnsi argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern StringStructSequentialAnsiByRefDelegateStdCall Get_MarshalStructStringStructSequentialAnsiByRef_StdCall_FuncPtr();
-
+
#endregion
-
+
#region PassByValue
-
+
//For Delegate Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool StringStructSequentialAnsiByValDelegateCdecl([In, Out] StringStructSequentialAnsi argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern StringStructSequentialAnsiByValDelegateStdCall Get_MarshalStructStringStructSequentialAnsiByVal_StdCall_FuncPtr();
-
+
#endregion
#endregion
#region Methods for the struct StringStructSequentialUnicode declaration
#region PassByRef
-
+
//For Delegate Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool StringStructSequentialUnicodeByRefDelegateCdecl([In, Out]ref StringStructSequentialUnicode argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern StringStructSequentialUnicodeByRefDelegateStdCall Get_MarshalStructStringStructSequentialUnicodeByRef_StdCall_FuncPtr();
-
+
#endregion
-
+
#region PassByValue
-
+
//For Delegate Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool StringStructSequentialUnicodeByValDelegateCdecl([In, Out] StringStructSequentialUnicode argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern StringStructSequentialUnicodeByValDelegateStdCall Get_MarshalStructStringStructSequentialUnicodeByVal_StdCall_FuncPtr();
-
+
#endregion
#endregion
#region Methods for the struct S8 declaration
#region PassByRef
-
+
//For Delegate Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S8ByRefDelegateCdecl([In, Out]ref S8 argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern S8ByRefDelegateStdCall Get_MarshalStructS8ByRef_StdCall_FuncPtr();
-
+
#endregion
-
+
#region PassByValue
-
+
//For Delegate Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S8ByValDelegateCdecl([In, Out] S8 argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern S8ByValDelegateStdCall Get_MarshalStructS8ByVal_StdCall_FuncPtr();
-
+
#endregion
#endregion
#region Methods for the struct S9 declaration
#region PassByRef
-
+
//For Delegate Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S9ByRefDelegateCdecl([In, Out]ref S9 argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern S9ByRefDelegateStdCall Get_MarshalStructS9ByRef_StdCall_FuncPtr();
-
+
#endregion
-
+
#region PassByValue
-
+
//For Delegate Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S9ByValDelegateCdecl([In, Out] S9 argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern S9ByValDelegateStdCall Get_MarshalStructS9ByVal_StdCall_FuncPtr();
-
+
#endregion
#endregion
#region Methods for the struct IncludeOuterIntergerStructSequential declaration
#region PassByRef
-
+
//For Delegate Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool IncludeOuterIntergerStructSequentialByRefDelegateCdecl([In, Out]ref IncludeOuterIntergerStructSequential argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern IncludeOuterIntergerStructSequentialByRefDelegateStdCall Get_MarshalStructIncludeOuterIntergerStructSequentialByRef_StdCall_FuncPtr();
-
+
#endregion
-
+
#region PassByValue
-
+
//For Delegate Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool IncludeOuterIntergerStructSequentialByValDelegateCdecl([In, Out] IncludeOuterIntergerStructSequential argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern IncludeOuterIntergerStructSequentialByValDelegateStdCall Get_MarshalStructIncludeOuterIntergerStructSequentialByVal_StdCall_FuncPtr();
-
+
#endregion
#endregion
#region Methods for the struct S11 declaration
#region PassByRef
-
+
//For Delegate Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S11ByRefDelegateCdecl([In, Out]ref S11 argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern S11ByRefDelegateStdCall Get_MarshalStructS11ByRef_StdCall_FuncPtr();
-
+
#endregion
-
+
#region PassByValue
-
+
//For Delegate Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S11ByValDelegateCdecl([In, Out] S11 argStr);
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern S11ByValDelegateStdCall Get_MarshalStructS11ByVal_StdCall_FuncPtr();
-
+
#endregion
#endregion
#region Methods for the struct ComplexStruct declaration
#region PassByRef
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool ComplexStructByRefDelegateCdecl([In, Out]ref ComplexStruct argStr);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
#endregion
#region PassByValue
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool ComplexStructByValDelegateCdecl([In, Out] ComplexStruct argStr);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.FunctionPtr)]
public static extern ComplexStructByValDelegateStdCall Get_MarshalStructComplexStructByVal_StdCall_FuncPtr();
-
+
#endregion
#endregion
#region Methods implementation
-
+
//By Ref
- //Delegate P/Invoke
+ //Delegate P/Invoke
unsafe private static void TestMethod_DelegatePInvoke_MarshalByRef_Cdecl(StructID structid)
{
Console.WriteLine("Delegate PInvoke,By Ref,Cdecl");
cs.type.idata = 123;
cs.type.ptrdata = (IntPtr)0x120000;
ComplexStructByRefDelegateCdecl caller1 = Get_MarshalStructComplexStructByRef_Cdecl_FuncPtr();
- Assert.IsTrue(caller1(ref cs));
- Assert.AreEqual(9999, cs.i);
- Assert.IsFalse(cs.b);
- Assert.AreEqual("Native", cs.str);
- Assert.AreEqual(-1, cs.type.idata);
- Assert.AreEqual(3.14159, cs.type.ddata);
+ Assert.True(caller1(ref cs));
+ Assert.Equal(9999, cs.i);
+ Assert.False(cs.b);
+ Assert.Equal("Native", cs.str);
+ Assert.Equal(-1, cs.type.idata);
+ Assert.Equal(3.14159, cs.type.ddata);
break;
case StructID.InnerSequentialId:
InnerSequential source_is = Helper.NewInnerSequential(1, 1.0F, "some string");
InnerSequential change_is = Helper.NewInnerSequential(77, 77.0F, "changed string");
Console.WriteLine("Calling DelegatePInvoke_MarshalStructInnerSequentialByRef_Cdecl...");
InnerSequentialByRefDelegateCdecl caller2 = Get_MarshalStructInnerSequentialByRef_Cdecl_FuncPtr();
- Assert.IsTrue(caller2(ref source_is));
- Assert.IsTrue(Helper.ValidateInnerSequential(source_is, change_is, "DelegatePInvoke_MarshalStructInnerSequentialByRef_Cdecl"));
+ Assert.True(caller2(ref source_is));
+ Assert.True(Helper.ValidateInnerSequential(source_is, change_is, "DelegatePInvoke_MarshalStructInnerSequentialByRef_Cdecl"));
break;
case StructID.InnerArraySequentialId:
InnerArraySequential source_ias = Helper.NewInnerArraySequential(1, 1.0F, "some string");
InnerArraySequential change_ias = Helper.NewInnerArraySequential(77, 77.0F, "changed string");
Console.WriteLine("Calling DelegatePInvoke_MarshalStructInnerArraySequentialByRef_Cdecl...");
InnerArraySequentialByRefDelegateCdecl caller3 = Get_MarshalStructInnerArraySequentialByRef_Cdecl_FuncPtr();
- Assert.IsTrue(caller3(ref source_ias));
- Assert.IsTrue(Helper.ValidateInnerArraySequential(source_ias, change_ias, "DelegatePInvoke_MarshalStructInnerArraySequentialByRef_Cdecl"));
+ Assert.True(caller3(ref source_ias));
+ Assert.True(Helper.ValidateInnerArraySequential(source_ias, change_ias, "DelegatePInvoke_MarshalStructInnerArraySequentialByRef_Cdecl"));
break;
case StructID.CharSetAnsiSequentialId:
CharSetAnsiSequential source_csas = Helper.NewCharSetAnsiSequential("some string", 'c');
CharSetAnsiSequential change_csas = Helper.NewCharSetAnsiSequential("change string", 'n');
Console.WriteLine("Calling DelegatePInvoke_MarshalStructCharSetAnsiSequentialByRef_Cdecl...");
CharSetAnsiSequentialByRefDelegateCdecl caller4 = Get_MarshalStructCharSetAnsiSequentialByRef_Cdecl_FuncPtr();
- Assert.IsTrue(caller4(ref source_csas));
- Assert.IsTrue(Helper.ValidateCharSetAnsiSequential(source_csas, change_csas, "DelegatePInvoke_MarshalStructCharSetAnsiSequentialByRef_Cdecl"));
+ Assert.True(caller4(ref source_csas));
+ Assert.True(Helper.ValidateCharSetAnsiSequential(source_csas, change_csas, "DelegatePInvoke_MarshalStructCharSetAnsiSequentialByRef_Cdecl"));
break;
case StructID.CharSetUnicodeSequentialId:
CharSetUnicodeSequential source_csus = Helper.NewCharSetUnicodeSequential("some string", 'c');
CharSetUnicodeSequential change_csus = Helper.NewCharSetUnicodeSequential("change string", 'n');
Console.WriteLine("Calling DelegatePInvoke_MarshalStructCharSetUnicodeSequentialByRef_Cdecl...");
CharSetUnicodeSequentialByRefDelegateCdecl caller5 = Get_MarshalStructCharSetUnicodeSequentialByRef_Cdecl_FuncPtr();
- Assert.IsTrue(caller5(ref source_csus));
- Assert.IsTrue(Helper.ValidateCharSetUnicodeSequential(source_csus, change_csus, "DelegatePInvoke_MarshalStructCharSetUnicodeSequentialByRef_Cdecl"));
+ Assert.True(caller5(ref source_csus));
+ Assert.True(Helper.ValidateCharSetUnicodeSequential(source_csus, change_csus, "DelegatePInvoke_MarshalStructCharSetUnicodeSequentialByRef_Cdecl"));
break;
case StructID.NumberSequentialId:
- NumberSequential source_ns = Helper.NewNumberSequential(Int32.MinValue, UInt32.MaxValue, short.MinValue, ushort.MaxValue, byte.MinValue,
+ NumberSequential source_ns = Helper.NewNumberSequential(Int32.MinValue, UInt32.MaxValue, short.MinValue, ushort.MaxValue, byte.MinValue,
sbyte.MaxValue, Int16.MinValue, UInt16.MaxValue, -1234567890, 1234567890, 32.0F, 3.2);
NumberSequential change_ns = Helper.NewNumberSequential(0, 32, 0, 16, 0, 8, 0, 16, 0, 64, 64.0F, 6.4);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructNumberSequentialByRef_Cdecl...");
NumberSequentialByRefDelegateCdecl caller6 = Get_MarshalStructNumberSequentialByRef_Cdecl_FuncPtr();
- Assert.IsTrue(caller6(ref source_ns));
- Assert.IsTrue(Helper.ValidateNumberSequential(source_ns, change_ns, "DelegatePInvoke_MarshalStructNumberSequentialByRef_Cdecl"));
+ Assert.True(caller6(ref source_ns));
+ Assert.True(Helper.ValidateNumberSequential(source_ns, change_ns, "DelegatePInvoke_MarshalStructNumberSequentialByRef_Cdecl"));
break;
case StructID.S3Id:
int[] iarr = new int[256];
S3 changeS3 = Helper.NewS3(false, "change string", icarr);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS3ByRef_Cdecl...");
S3ByRefDelegateCdecl caller7 = Get_MarshalStructS3ByRef_Cdecl_FuncPtr();
- Assert.IsTrue(caller7(ref sourceS3));
- Assert.IsTrue(Helper.ValidateS3(sourceS3, changeS3, "DelegatePInvoke_MarshalStructS3ByRef_Cdecl"));
+ Assert.True(caller7(ref sourceS3));
+ Assert.True(Helper.ValidateS3(sourceS3, changeS3, "DelegatePInvoke_MarshalStructS3ByRef_Cdecl"));
break;
case StructID.S5Id:
Enum1 enums = Enum1.e1;
S5 changeS5 = Helper.NewS5(64, "change string", enumch);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS5ByRef_Cdecl...");
S5ByRefDelegateCdecl caller8 = Get_MarshalStructS5ByRef_Cdecl_FuncPtr();
- Assert.IsTrue(caller8(ref sourceS5));
- Assert.IsTrue(Helper.ValidateS5(sourceS5, changeS5, "DelegatePInvoke_MarshalStructS5ByRef_Cdecl"));
+ Assert.True(caller8(ref sourceS5));
+ Assert.True(Helper.ValidateS5(sourceS5, changeS5, "DelegatePInvoke_MarshalStructS5ByRef_Cdecl"));
break;
case StructID.StringStructSequentialAnsiId:
strOne = new String('a', 512);
StringStructSequentialAnsi change_sssa = Helper.NewStringStructSequentialAnsi(strTwo, strOne);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructStringStructSequentialAnsiByRef_Cdecl...");
StringStructSequentialAnsiByRefDelegateCdecl caller9 = Get_MarshalStructStringStructSequentialAnsiByRef_Cdecl_FuncPtr();
- Assert.IsTrue(caller9(ref source_sssa));
- Assert.IsTrue(Helper.ValidateStringStructSequentialAnsi(source_sssa, change_sssa, "DelegatePInvoke_MarshalStructStringStructSequentialAnsiByRef_Cdecl"));
+ Assert.True(caller9(ref source_sssa));
+ Assert.True(Helper.ValidateStringStructSequentialAnsi(source_sssa, change_sssa, "DelegatePInvoke_MarshalStructStringStructSequentialAnsiByRef_Cdecl"));
break;
case StructID.StringStructSequentialUnicodeId:
strOne = new String('a', 256);
StringStructSequentialUnicode change_sssu = Helper.NewStringStructSequentialUnicode(strTwo, strOne);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructStringStructSequentialUnicodeByRef_Cdecl...");
StringStructSequentialUnicodeByRefDelegateCdecl caller10 = Get_MarshalStructStringStructSequentialUnicodeByRef_Cdecl_FuncPtr();
- Assert.IsTrue(caller10(ref source_sssu));
- Assert.IsTrue(Helper.ValidateStringStructSequentialUnicode(source_sssu, change_sssu, "DelegatePInvoke_MarshalStructStringStructSequentialUnicodeByRef_Cdecl"));
+ Assert.True(caller10(ref source_sssu));
+ Assert.True(Helper.ValidateStringStructSequentialUnicode(source_sssu, change_sssu, "DelegatePInvoke_MarshalStructStringStructSequentialUnicodeByRef_Cdecl"));
break;
case StructID.S8Id:
S8 sourceS8 = Helper.NewS8("hello", true, 10, 128, 128, 32);
S8 changeS8 = Helper.NewS8("world", false, 1, 256, 256, 64);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS8ByRef_Cdecl...");
S8ByRefDelegateCdecl caller11 = Get_MarshalStructS8ByRef_Cdecl_FuncPtr();
- Assert.IsTrue(caller11(ref sourceS8));
- Assert.IsTrue(Helper.ValidateS8(sourceS8, changeS8, "DelegatePInvoke_MarshalStructS8ByRef_Cdecl"));
+ Assert.True(caller11(ref sourceS8));
+ Assert.True(Helper.ValidateS8(sourceS8, changeS8, "DelegatePInvoke_MarshalStructS8ByRef_Cdecl"));
break;
case StructID.S9Id:
S9 sourceS9 = Helper.NewS9(128, new TestDelegate1(testMethod));
S9 changeS9 = Helper.NewS9(256, null);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS9ByRef_Cdecl...");
S9ByRefDelegateCdecl caller12 = Get_MarshalStructS9ByRef_Cdecl_FuncPtr();
- Assert.IsTrue(caller12(ref sourceS9));
- Assert.IsTrue(Helper.ValidateS9(sourceS9, changeS9, "DelegatePInvoke_MarshalStructS9ByRef_Cdecl"));
+ Assert.True(caller12(ref sourceS9));
+ Assert.True(Helper.ValidateS9(sourceS9, changeS9, "DelegatePInvoke_MarshalStructS9ByRef_Cdecl"));
break;
case StructID.IncludeOuterIntergerStructSequentialId:
IncludeOuterIntergerStructSequential sourceIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
IncludeOuterIntergerStructSequential changeIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(64, 64);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructIncludeOuterIntergerStructSequentialByRef_Cdecl...");
IncludeOuterIntergerStructSequentialByRefDelegateCdecl caller13 = Get_MarshalStructIncludeOuterIntergerStructSequentialByRef_Cdecl_FuncPtr();
- Assert.IsTrue(caller13(ref sourceIncludeOuterIntergerStructSequential));
- Assert.IsTrue(Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential,
+ Assert.True(caller13(ref sourceIncludeOuterIntergerStructSequential));
+ Assert.True(Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential,
changeIncludeOuterIntergerStructSequential, "DelegatePInvoke_MarshalStructIncludeOuterIntergerStructSequentialByRef_Cdecl"));
break;
case StructID.S11Id:
S11 changeS11 = Helper.NewS11((int*)(64), 64);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS11ByRef_Cdecl...");
S11ByRefDelegateCdecl caller14 = Get_MarshalStructS11ByRef_Cdecl_FuncPtr();
- Assert.IsTrue(caller14(ref sourceS11));
- Assert.IsTrue(Helper.ValidateS11(sourceS11, changeS11, "DelegatePInvoke_MarshalStructS11ByRef_Cdecl"));
+ Assert.True(caller14(ref sourceS11));
+ Assert.True(Helper.ValidateS11(sourceS11, changeS11, "DelegatePInvoke_MarshalStructS11ByRef_Cdecl"));
break;
default:
- Assert.Fail("TestMethod_DelegatePInvoke_MarshalByRef_Cdecl:The structid (Managed Side) is wrong");
+ Assert.True(false, "TestMethod_DelegatePInvoke_MarshalByRef_Cdecl:The structid (Managed Side) is wrong");
break;
}
}
cs.type.idata = 123;
cs.type.ptrdata = (IntPtr)0x120000;
ComplexStructByRefDelegateStdCall caller1 = Get_MarshalStructComplexStructByRef_StdCall_FuncPtr();
- Assert.IsTrue(caller1(ref cs));
- Assert.AreEqual(9999, cs.i);
- Assert.IsFalse(cs.b);
- Assert.AreEqual("Native", cs.str);
- Assert.AreEqual(-1, cs.type.idata);
- Assert.AreEqual(3.14159, cs.type.ddata);
+ Assert.True(caller1(ref cs));
+ Assert.Equal(9999, cs.i);
+ Assert.False(cs.b);
+ Assert.Equal("Native", cs.str);
+ Assert.Equal(-1, cs.type.idata);
+ Assert.Equal(3.14159, cs.type.ddata);
break;
case StructID.InnerSequentialId:
InnerSequential source_is = Helper.NewInnerSequential(1, 1.0F, "some string");
InnerSequential change_is = Helper.NewInnerSequential(77, 77.0F, "changed string");
Console.WriteLine("Calling DelegatePInvoke_MarshalStructInnerSequentialByRef_StdCall...");
InnerSequentialByRefDelegateStdCall caller2 = Get_MarshalStructInnerSequentialByRef_StdCall_FuncPtr();
- Assert.IsTrue(caller2(ref source_is));
- Assert.IsTrue(Helper.ValidateInnerSequential(source_is, change_is, "DelegatePInvoke_MarshalStructInnerSequentialByRef_StdCall"));
+ Assert.True(caller2(ref source_is));
+ Assert.True(Helper.ValidateInnerSequential(source_is, change_is, "DelegatePInvoke_MarshalStructInnerSequentialByRef_StdCall"));
break;
case StructID.InnerArraySequentialId:
InnerArraySequential source_ias = Helper.NewInnerArraySequential(1, 1.0F, "some string");
InnerArraySequential change_ias = Helper.NewInnerArraySequential(77, 77.0F, "changed string");
Console.WriteLine("Calling DelegatePInvoke_MarshalStructInnerArraySequentialByRef_StdCall...");
InnerArraySequentialByRefDelegateStdCall caller3 = Get_MarshalStructInnerArraySequentialByRef_StdCall_FuncPtr();
- Assert.IsTrue(caller3(ref source_ias));
- Assert.IsTrue(Helper.ValidateInnerArraySequential(source_ias, change_ias, "DelegatePInvoke_MarshalStructInnerArraySequentialByRef_StdCall"));
+ Assert.True(caller3(ref source_ias));
+ Assert.True(Helper.ValidateInnerArraySequential(source_ias, change_ias, "DelegatePInvoke_MarshalStructInnerArraySequentialByRef_StdCall"));
break;
case StructID.CharSetAnsiSequentialId:
CharSetAnsiSequential source_csas = Helper.NewCharSetAnsiSequential("some string", 'c');
CharSetAnsiSequential change_csas = Helper.NewCharSetAnsiSequential("change string", 'n');
Console.WriteLine("Calling DelegatePInvoke_MarshalStructCharSetAnsiSequentialByRef_StdCall...");
CharSetAnsiSequentialByRefDelegateStdCall caller4 = Get_MarshalStructCharSetAnsiSequentialByRef_StdCall_FuncPtr();
- Assert.IsTrue(caller4(ref source_csas));
- Assert.IsTrue(Helper.ValidateCharSetAnsiSequential(source_csas, change_csas, "DelegatePInvoke_MarshalStructCharSetAnsiSequentialByRef_StdCall"));
+ Assert.True(caller4(ref source_csas));
+ Assert.True(Helper.ValidateCharSetAnsiSequential(source_csas, change_csas, "DelegatePInvoke_MarshalStructCharSetAnsiSequentialByRef_StdCall"));
break;
case StructID.CharSetUnicodeSequentialId:
CharSetUnicodeSequential source_csus = Helper.NewCharSetUnicodeSequential("some string", 'c');
CharSetUnicodeSequential change_csus = Helper.NewCharSetUnicodeSequential("change string", 'n');
Console.WriteLine("Calling DelegatePInvoke_MarshalStructCharSetUnicodeSequentialByRef_StdCall...");
CharSetUnicodeSequentialByRefDelegateStdCall caller5 = Get_MarshalStructCharSetUnicodeSequentialByRef_StdCall_FuncPtr();
- Assert.IsTrue(caller5(ref source_csus));
- Assert.IsTrue(Helper.ValidateCharSetUnicodeSequential(source_csus, change_csus, "DelegatePInvoke_MarshalStructCharSetUnicodeSequentialByRef_StdCall"));
+ Assert.True(caller5(ref source_csus));
+ Assert.True(Helper.ValidateCharSetUnicodeSequential(source_csus, change_csus, "DelegatePInvoke_MarshalStructCharSetUnicodeSequentialByRef_StdCall"));
break;
case StructID.NumberSequentialId:
- NumberSequential source_ns = Helper.NewNumberSequential(Int32.MinValue, UInt32.MaxValue, short.MinValue, ushort.MaxValue, byte.MinValue,
+ NumberSequential source_ns = Helper.NewNumberSequential(Int32.MinValue, UInt32.MaxValue, short.MinValue, ushort.MaxValue, byte.MinValue,
sbyte.MaxValue, Int16.MinValue, UInt16.MaxValue, -1234567890, 1234567890, 32.0F, 3.2);
NumberSequential change_ns = Helper.NewNumberSequential(0, 32, 0, 16, 0, 8, 0, 16, 0, 64, 64.0F, 6.4);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructNumberSequentialByRef_StdCall...");
NumberSequentialByRefDelegateStdCall caller6 = Get_MarshalStructNumberSequentialByRef_StdCall_FuncPtr();
- Assert.IsTrue(caller6(ref source_ns));
- Assert.IsTrue(Helper.ValidateNumberSequential(source_ns, change_ns, "DelegatePInvoke_MarshalStructNumberSequentialByRef_StdCall"));
+ Assert.True(caller6(ref source_ns));
+ Assert.True(Helper.ValidateNumberSequential(source_ns, change_ns, "DelegatePInvoke_MarshalStructNumberSequentialByRef_StdCall"));
break;
case StructID.S3Id:
int[] iarr = new int[256];
S3 changeS3 = Helper.NewS3(false, "change string", icarr);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS3ByRef_StdCall...");
S3ByRefDelegateStdCall caller7 = Get_MarshalStructS3ByRef_StdCall_FuncPtr();
- Assert.IsTrue(caller7(ref sourceS3));
- Assert.IsTrue(Helper.ValidateS3(sourceS3, changeS3, "DelegatePInvoke_MarshalStructS3ByRef_StdCall"));
+ Assert.True(caller7(ref sourceS3));
+ Assert.True(Helper.ValidateS3(sourceS3, changeS3, "DelegatePInvoke_MarshalStructS3ByRef_StdCall"));
break;
case StructID.S5Id:
Enum1 enums = Enum1.e1;
S5 changeS5 = Helper.NewS5(64, "change string", enumch);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS5ByRef_StdCall...");
S5ByRefDelegateStdCall caller8 = Get_MarshalStructS5ByRef_StdCall_FuncPtr();
- Assert.IsTrue(caller8(ref sourceS5));
- Assert.IsTrue(Helper.ValidateS5(sourceS5, changeS5, "DelegatePInvoke_MarshalStructS5ByRef_StdCall"));
+ Assert.True(caller8(ref sourceS5));
+ Assert.True(Helper.ValidateS5(sourceS5, changeS5, "DelegatePInvoke_MarshalStructS5ByRef_StdCall"));
break;
case StructID.StringStructSequentialAnsiId:
strOne = new String('a', 512);
StringStructSequentialAnsi change_sssa = Helper.NewStringStructSequentialAnsi(strTwo, strOne);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructStringStructSequentialAnsiByRef_StdCall...");
StringStructSequentialAnsiByRefDelegateStdCall caller9 = Get_MarshalStructStringStructSequentialAnsiByRef_StdCall_FuncPtr();
- Assert.IsTrue(caller9(ref source_sssa));
- Assert.IsTrue(Helper.ValidateStringStructSequentialAnsi(source_sssa, change_sssa, "DelegatePInvoke_MarshalStructStringStructSequentialAnsiByRef_StdCall"));
+ Assert.True(caller9(ref source_sssa));
+ Assert.True(Helper.ValidateStringStructSequentialAnsi(source_sssa, change_sssa, "DelegatePInvoke_MarshalStructStringStructSequentialAnsiByRef_StdCall"));
break;
case StructID.StringStructSequentialUnicodeId:
strOne = new String('a', 256);
StringStructSequentialUnicode change_sssu = Helper.NewStringStructSequentialUnicode(strTwo, strOne);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructStringStructSequentialUnicodeByRef_StdCall...");
StringStructSequentialUnicodeByRefDelegateStdCall caller10 = Get_MarshalStructStringStructSequentialUnicodeByRef_StdCall_FuncPtr();
- Assert.IsTrue(caller10(ref source_sssu));
- Assert.IsTrue(Helper.ValidateStringStructSequentialUnicode(source_sssu, change_sssu, "DelegatePInvoke_MarshalStructStringStructSequentialUnicodeByRef_StdCall"));
+ Assert.True(caller10(ref source_sssu));
+ Assert.True(Helper.ValidateStringStructSequentialUnicode(source_sssu, change_sssu, "DelegatePInvoke_MarshalStructStringStructSequentialUnicodeByRef_StdCall"));
break;
case StructID.S8Id:
S8 sourceS8 = Helper.NewS8("hello", true, 10, 128, 128, 32);
S8 changeS8 = Helper.NewS8("world", false, 1, 256, 256, 64);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS8ByRef_StdCall...");
S8ByRefDelegateStdCall caller11 = Get_MarshalStructS8ByRef_StdCall_FuncPtr();
- Assert.IsTrue(caller11(ref sourceS8));
- Assert.IsTrue(Helper.ValidateS8(sourceS8, changeS8, "DelegatePInvoke_MarshalStructS8ByRef_StdCall"));
+ Assert.True(caller11(ref sourceS8));
+ Assert.True(Helper.ValidateS8(sourceS8, changeS8, "DelegatePInvoke_MarshalStructS8ByRef_StdCall"));
break;
case StructID.S9Id:
S9 sourceS9 = Helper.NewS9(128, new TestDelegate1(testMethod));
S9 changeS9 = Helper.NewS9(256, null);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS9ByRef_StdCall...");
S9ByRefDelegateStdCall caller12 = Get_MarshalStructS9ByRef_StdCall_FuncPtr();
- Assert.IsTrue(caller12(ref sourceS9));
- Assert.IsTrue(Helper.ValidateS9(sourceS9, changeS9, "DelegatePInvoke_MarshalStructS9ByRef_StdCall"));
+ Assert.True(caller12(ref sourceS9));
+ Assert.True(Helper.ValidateS9(sourceS9, changeS9, "DelegatePInvoke_MarshalStructS9ByRef_StdCall"));
break;
case StructID.IncludeOuterIntergerStructSequentialId:
IncludeOuterIntergerStructSequential sourceIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
IncludeOuterIntergerStructSequential changeIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(64, 64);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructIncludeOuterIntergerStructSequentialByRef_StdCall...");
IncludeOuterIntergerStructSequentialByRefDelegateStdCall caller13 = Get_MarshalStructIncludeOuterIntergerStructSequentialByRef_StdCall_FuncPtr();
- Assert.IsTrue(caller13(ref sourceIncludeOuterIntergerStructSequential));
- Assert.IsTrue(Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential,
+ Assert.True(caller13(ref sourceIncludeOuterIntergerStructSequential));
+ Assert.True(Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential,
changeIncludeOuterIntergerStructSequential, "DelegatePInvoke_MarshalStructIncludeOuterIntergerStructSequentialByRef_StdCall"));
break;
case StructID.S11Id:
S11 changeS11 = Helper.NewS11((int*)(64), 64);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS11ByRef_StdCall...");
S11ByRefDelegateStdCall caller14 = Get_MarshalStructS11ByRef_StdCall_FuncPtr();
- Assert.IsTrue(caller14(ref sourceS11));
- Assert.IsTrue(Helper.ValidateS11(sourceS11, changeS11, "DelegatePInvoke_MarshalStructS11ByRef_StdCall"));
+ Assert.True(caller14(ref sourceS11));
+ Assert.True(Helper.ValidateS11(sourceS11, changeS11, "DelegatePInvoke_MarshalStructS11ByRef_StdCall"));
break;
default:
- Assert.Fail("TestMethod_DelegatePInvoke_MarshalByRef_StdCall:The structid (Managed Side) is wrong");
+ Assert.True(false, "TestMethod_DelegatePInvoke_MarshalByRef_StdCall:The structid (Managed Side) is wrong");
break;
}
}
cs.type.idata = 123;
cs.type.ptrdata = (IntPtr)0x120000;
ComplexStructByValDelegateCdecl caller1 = Get_MarshalStructComplexStructByVal_Cdecl_FuncPtr();
- Assert.IsTrue(caller1(cs));
- Assert.AreEqual(321, cs.i);
- Assert.IsTrue(cs.b);
- Assert.AreEqual("Managed", cs.str);
- Assert.AreEqual(123, cs.type.idata);
- Assert.AreEqual(0x120000, (int)cs.type.ptrdata);
+ Assert.True(caller1(cs));
+ Assert.Equal(321, cs.i);
+ Assert.True(cs.b);
+ Assert.Equal("Managed", cs.str);
+ Assert.Equal(123, cs.type.idata);
+ Assert.Equal(0x120000, (int)cs.type.ptrdata);
break;
case StructID.InnerSequentialId:
Console.WriteLine("Calling DelegatePInvoke_MarshalStructInnerSequentialByVal_Cdecl...");
InnerSequential source_is = Helper.NewInnerSequential(1, 1.0F, "some string");
InnerSequential clone_is1 = Helper.NewInnerSequential(1, 1.0F, "some string");
InnerSequentialByValDelegateCdecl caller2 = Get_MarshalStructInnerSequentialByVal_Cdecl_FuncPtr();
- Assert.IsTrue(caller2(source_is));
- Assert.IsTrue(Helper.ValidateInnerSequential(source_is, clone_is1, "DelegatePInvoke_MarshalStructInnerSequentialByVal_Cdecl"));
+ Assert.True(caller2(source_is));
+ Assert.True(Helper.ValidateInnerSequential(source_is, clone_is1, "DelegatePInvoke_MarshalStructInnerSequentialByVal_Cdecl"));
break;
case StructID.InnerArraySequentialId:
Console.WriteLine("Calling DelegatePInvoke_MarshalStructInnerArraySequentialByVal_Cdecl...");
InnerArraySequential source_ias = Helper.NewInnerArraySequential(1, 1.0F, "some string");
InnerArraySequential clone_ias = Helper.NewInnerArraySequential(1, 1.0F, "some string");
InnerArraySequentialByValDelegateCdecl caller3 = Get_MarshalStructInnerArraySequentialByVal_Cdecl_FuncPtr();
- Assert.IsTrue(caller3(source_ias));
- Assert.IsTrue(Helper.ValidateInnerArraySequential(source_ias, clone_ias, "DelegatePInvoke_MarshalStructInnerArraySequentialByVal_Cdecl"));
+ Assert.True(caller3(source_ias));
+ Assert.True(Helper.ValidateInnerArraySequential(source_ias, clone_ias, "DelegatePInvoke_MarshalStructInnerArraySequentialByVal_Cdecl"));
break;
case StructID.CharSetAnsiSequentialId:
Console.WriteLine("Calling DelegatePInvoke_MarshalStructCharSetAnsiSequentialByVal_Cdecl...");
CharSetAnsiSequential source_csas = Helper.NewCharSetAnsiSequential("some string", 'c');
CharSetAnsiSequential clone_csas = Helper.NewCharSetAnsiSequential("some string", 'c');
CharSetAnsiSequentialByValDelegateCdecl caller4 = Get_MarshalStructCharSetAnsiSequentialByVal_Cdecl_FuncPtr();
- Assert.IsTrue(caller4(source_csas));
- Assert.IsTrue(Helper.ValidateCharSetAnsiSequential(source_csas, clone_csas, "DelegatePInvoke_MarshalStructCharSetAnsiSequentialByVal_Cdecl"));
+ Assert.True(caller4(source_csas));
+ Assert.True(Helper.ValidateCharSetAnsiSequential(source_csas, clone_csas, "DelegatePInvoke_MarshalStructCharSetAnsiSequentialByVal_Cdecl"));
break;
case StructID.CharSetUnicodeSequentialId:
Console.WriteLine("Calling DelegatePInvoke_MarshalStructCharSetUnicodeSequentialByVal_Cdecl...");
CharSetUnicodeSequential source_csus = Helper.NewCharSetUnicodeSequential("some string", 'c');
CharSetUnicodeSequential clone_csus = Helper.NewCharSetUnicodeSequential("some string", 'c');
CharSetUnicodeSequentialByValDelegateCdecl caller5 = Get_MarshalStructCharSetUnicodeSequentialByVal_Cdecl_FuncPtr();
- Assert.IsTrue(caller5(source_csus));
- Assert.IsTrue(Helper.ValidateCharSetUnicodeSequential(source_csus, clone_csus, "DelegatePInvoke_MarshalStructCharSetUnicodeSequentialByVal_Cdecl"));
+ Assert.True(caller5(source_csus));
+ Assert.True(Helper.ValidateCharSetUnicodeSequential(source_csus, clone_csus, "DelegatePInvoke_MarshalStructCharSetUnicodeSequentialByVal_Cdecl"));
break;
case StructID.NumberSequentialId:
Console.WriteLine("Calling DelegatePInvoke_MarshalStructNumberSequentialByVal_Cdecl...");
- NumberSequential source_ns = Helper.NewNumberSequential(Int32.MinValue, UInt32.MaxValue, short.MinValue, ushort.MaxValue, byte.MinValue,
+ NumberSequential source_ns = Helper.NewNumberSequential(Int32.MinValue, UInt32.MaxValue, short.MinValue, ushort.MaxValue, byte.MinValue,
sbyte.MaxValue, Int16.MinValue, UInt16.MaxValue, -1234567890, 1234567890, 32.0F, 3.2);
- NumberSequential clone_ns = Helper.NewNumberSequential(Int32.MinValue, UInt32.MaxValue, short.MinValue, ushort.MaxValue, byte.MinValue,
+ NumberSequential clone_ns = Helper.NewNumberSequential(Int32.MinValue, UInt32.MaxValue, short.MinValue, ushort.MaxValue, byte.MinValue,
sbyte.MaxValue, Int16.MinValue, UInt16.MaxValue, -1234567890, 1234567890, 32.0F, 3.2);
NumberSequentialByValDelegateCdecl caller6 = Get_MarshalStructNumberSequentialByVal_Cdecl_FuncPtr();
- Assert.IsTrue(caller6(source_ns));
- Assert.IsTrue(Helper.ValidateNumberSequential(source_ns, clone_ns, "DelegatePInvoke_MarshalStructNumberSequentialByVal_Cdecl"));
+ Assert.True(caller6(source_ns));
+ Assert.True(Helper.ValidateNumberSequential(source_ns, clone_ns, "DelegatePInvoke_MarshalStructNumberSequentialByVal_Cdecl"));
break;
case StructID.S3Id:
int[] iarr = new int[256];
S3 cloneS3 = Helper.NewS3(true, "some string", iarr);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS3ByVal_Cdecl...");
S3ByValDelegateCdecl caller7 = Get_MarshalStructS3ByVal_Cdecl_FuncPtr();
- Assert.IsTrue(caller7(sourceS3));
- Assert.IsTrue(Helper.ValidateS3(sourceS3, cloneS3, "DelegatePInvoke_MarshalStructS3ByVal_Cdecl"));
+ Assert.True(caller7(sourceS3));
+ Assert.True(Helper.ValidateS3(sourceS3, cloneS3, "DelegatePInvoke_MarshalStructS3ByVal_Cdecl"));
break;
case StructID.S5Id:
Enum1 enums = Enum1.e1;
S5 cloneS5 = Helper.NewS5(32, "some string", enums);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS5ByVal_Cdecl...");
S5ByValDelegateCdecl caller8 = Get_MarshalStructS5ByVal_Cdecl_FuncPtr();
- Assert.IsTrue(caller8(sourceS5));
- Assert.IsTrue(Helper.ValidateS5(sourceS5, cloneS5, "DelegatePInvoke_MarshalStructS5ByVal_Cdecl"));
+ Assert.True(caller8(sourceS5));
+ Assert.True(Helper.ValidateS5(sourceS5, cloneS5, "DelegatePInvoke_MarshalStructS5ByVal_Cdecl"));
break;
case StructID.StringStructSequentialAnsiId:
strOne = new String('a', 512);
StringStructSequentialAnsi clone_sssa = Helper.NewStringStructSequentialAnsi(strOne, strTwo);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructStringStructSequentialAnsiByVal_Cdecl...");
StringStructSequentialAnsiByValDelegateCdecl caller9 = Get_MarshalStructStringStructSequentialAnsiByVal_Cdecl_FuncPtr();
- Assert.IsTrue(caller9(source_sssa));
- Assert.IsTrue(Helper.ValidateStringStructSequentialAnsi(source_sssa, clone_sssa, "DelegatePInvoke_MarshalStructStringStructSequentialAnsiByVal_Cdecl"));
+ Assert.True(caller9(source_sssa));
+ Assert.True(Helper.ValidateStringStructSequentialAnsi(source_sssa, clone_sssa, "DelegatePInvoke_MarshalStructStringStructSequentialAnsiByVal_Cdecl"));
break;
case StructID.StringStructSequentialUnicodeId:
strOne = new String('a', 256);
StringStructSequentialUnicode clone_sssu = Helper.NewStringStructSequentialUnicode(strOne, strTwo);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructStringStructSequentialUnicodeByVal_Cdecl...");
StringStructSequentialUnicodeByValDelegateCdecl caller10 = Get_MarshalStructStringStructSequentialUnicodeByVal_Cdecl_FuncPtr();
- Assert.IsTrue(caller10(source_sssu));
- Assert.IsTrue(Helper.ValidateStringStructSequentialUnicode(source_sssu, clone_sssu, "DelegatePInvoke_MarshalStructStringStructSequentialUnicodeByVal_Cdecl"));
+ Assert.True(caller10(source_sssu));
+ Assert.True(Helper.ValidateStringStructSequentialUnicode(source_sssu, clone_sssu, "DelegatePInvoke_MarshalStructStringStructSequentialUnicodeByVal_Cdecl"));
break;
case StructID.S8Id:
S8 sourceS8 = Helper.NewS8("hello", true, 10, 128, 128, 32);
S8 cloneS8 = Helper.NewS8("hello", true, 10, 128, 128, 32);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS8ByVal_Cdecl...");
S8ByValDelegateCdecl caller11 = Get_MarshalStructS8ByVal_Cdecl_FuncPtr();
- Assert.IsTrue(caller11(sourceS8));
- Assert.IsTrue(Helper.ValidateS8(sourceS8, cloneS8, "DelegatePInvoke_MarshalStructS8ByVal_Cdecl"));
+ Assert.True(caller11(sourceS8));
+ Assert.True(Helper.ValidateS8(sourceS8, cloneS8, "DelegatePInvoke_MarshalStructS8ByVal_Cdecl"));
break;
case StructID.S9Id:
S9 sourceS9 = Helper.NewS9(128, new TestDelegate1(testMethod));
S9 cloneS9 = Helper.NewS9(128, new TestDelegate1(testMethod));
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS9ByVal_Cdecl...");
S9ByValDelegateCdecl caller12 = Get_MarshalStructS9ByVal_Cdecl_FuncPtr();
- Assert.IsTrue(caller12(sourceS9));
- Assert.IsTrue(Helper.ValidateS9(sourceS9, cloneS9, "DelegatePInvoke_MarshalStructS9ByVal_Cdecl"));
+ Assert.True(caller12(sourceS9));
+ Assert.True(Helper.ValidateS9(sourceS9, cloneS9, "DelegatePInvoke_MarshalStructS9ByVal_Cdecl"));
break;
case StructID.IncludeOuterIntergerStructSequentialId:
IncludeOuterIntergerStructSequential sourceIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
IncludeOuterIntergerStructSequential cloneIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructIncludeOuterIntergerStructSequentialByVal_Cdecl...");
IncludeOuterIntergerStructSequentialByValDelegateCdecl caller13 = Get_MarshalStructIncludeOuterIntergerStructSequentialByVal_Cdecl_FuncPtr();
- Assert.IsTrue(caller13(sourceIncludeOuterIntergerStructSequential));
- Assert.IsTrue(Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential,
+ Assert.True(caller13(sourceIncludeOuterIntergerStructSequential));
+ Assert.True(Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential,
cloneIncludeOuterIntergerStructSequential, "DelegatePInvoke_MarshalStructIncludeOuterIntergerStructSequentialByVal_Cdecl"));
break;
case StructID.S11Id:
S11 cloneS11 = Helper.NewS11((int*)(32), 32);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS11ByVal_Cdecl...");
S11ByValDelegateCdecl caller14 = Get_MarshalStructS11ByVal_Cdecl_FuncPtr();
- Assert.IsTrue(caller14(sourceS11));
- Assert.IsTrue(Helper.ValidateS11(sourceS11, cloneS11, "DelegatePInvoke_MarshalStructS11ByVal_Cdecl"));
+ Assert.True(caller14(sourceS11));
+ Assert.True(Helper.ValidateS11(sourceS11, cloneS11, "DelegatePInvoke_MarshalStructS11ByVal_Cdecl"));
break;
default:
- Assert.Fail("TestMethod_DelegatePInvoke_MarshalByVal_Cdecl:The structid (Managed Side) is wrong");
+ Assert.True(false, "TestMethod_DelegatePInvoke_MarshalByVal_Cdecl:The structid (Managed Side) is wrong");
break;
}
}
cs.type.idata = 123;
cs.type.ptrdata = (IntPtr)0x120000;
ComplexStructByValDelegateStdCall caller1 = Get_MarshalStructComplexStructByVal_StdCall_FuncPtr();
- Assert.IsTrue(caller1(cs));
- Assert.AreEqual(321, cs.i);
- Assert.IsTrue(cs.b);
- Assert.AreEqual("Managed", cs.str);
- Assert.AreEqual(123, cs.type.idata);
- Assert.AreEqual(0x120000, (int)cs.type.ptrdata);
+ Assert.True(caller1(cs));
+ Assert.Equal(321, cs.i);
+ Assert.True(cs.b);
+ Assert.Equal("Managed", cs.str);
+ Assert.Equal(123, cs.type.idata);
+ Assert.Equal(0x120000, (int)cs.type.ptrdata);
break;
case StructID.InnerSequentialId:
Console.WriteLine("Calling DelegatePInvoke_MarshalStructInnerSequentialByVal_StdCall...");
InnerSequential source_is = Helper.NewInnerSequential(1, 1.0F, "some string");
InnerSequential clone_is1 = Helper.NewInnerSequential(1, 1.0F, "some string");
InnerSequentialByValDelegateStdCall caller2 = Get_MarshalStructInnerSequentialByVal_StdCall_FuncPtr();
- Assert.IsTrue(caller2(source_is));
- Assert.IsTrue(Helper.ValidateInnerSequential(source_is, clone_is1, "DelegatePInvoke_MarshalStructInnerSequentialByVal_StdCall"));
+ Assert.True(caller2(source_is));
+ Assert.True(Helper.ValidateInnerSequential(source_is, clone_is1, "DelegatePInvoke_MarshalStructInnerSequentialByVal_StdCall"));
break;
case StructID.InnerArraySequentialId:
Console.WriteLine("Calling DelegatePInvoke_MarshalStructInnerArraySequentialByVal_StdCall...");
InnerArraySequential source_ias = Helper.NewInnerArraySequential(1, 1.0F, "some string");
InnerArraySequential clone_ias = Helper.NewInnerArraySequential(1, 1.0F, "some string");
InnerArraySequentialByValDelegateStdCall caller3 = Get_MarshalStructInnerArraySequentialByVal_StdCall_FuncPtr();
- Assert.IsTrue(caller3(source_ias));
- Assert.IsTrue(Helper.ValidateInnerArraySequential(source_ias, clone_ias, "DelegatePInvoke_MarshalStructInnerArraySequentialByVal_StdCall"));
+ Assert.True(caller3(source_ias));
+ Assert.True(Helper.ValidateInnerArraySequential(source_ias, clone_ias, "DelegatePInvoke_MarshalStructInnerArraySequentialByVal_StdCall"));
break;
case StructID.CharSetAnsiSequentialId:
Console.WriteLine("Calling DelegatePInvoke_MarshalStructCharSetAnsiSequentialByVal_StdCall...");
CharSetAnsiSequential source_csas = Helper.NewCharSetAnsiSequential("some string", 'c');
CharSetAnsiSequential clone_csas = Helper.NewCharSetAnsiSequential("some string", 'c');
CharSetAnsiSequentialByValDelegateStdCall caller4 = Get_MarshalStructCharSetAnsiSequentialByVal_StdCall_FuncPtr();
- Assert.IsTrue(caller4(source_csas));
- Assert.IsTrue(Helper.ValidateCharSetAnsiSequential(source_csas, clone_csas, "DelegatePInvoke_MarshalStructCharSetAnsiSequentialByVal_StdCall"));
+ Assert.True(caller4(source_csas));
+ Assert.True(Helper.ValidateCharSetAnsiSequential(source_csas, clone_csas, "DelegatePInvoke_MarshalStructCharSetAnsiSequentialByVal_StdCall"));
break;
case StructID.CharSetUnicodeSequentialId:
Console.WriteLine("Calling DelegatePInvoke_MarshalStructCharSetUnicodeSequentialByVal_StdCall...");
CharSetUnicodeSequential source_csus = Helper.NewCharSetUnicodeSequential("some string", 'c');
CharSetUnicodeSequential clone_csus = Helper.NewCharSetUnicodeSequential("some string", 'c');
CharSetUnicodeSequentialByValDelegateStdCall caller5 = Get_MarshalStructCharSetUnicodeSequentialByVal_StdCall_FuncPtr();
- Assert.IsTrue(caller5(source_csus));
- Assert.IsTrue(Helper.ValidateCharSetUnicodeSequential(source_csus, clone_csus, "DelegatePInvoke_MarshalStructCharSetUnicodeSequentialByVal_StdCall"));
+ Assert.True(caller5(source_csus));
+ Assert.True(Helper.ValidateCharSetUnicodeSequential(source_csus, clone_csus, "DelegatePInvoke_MarshalStructCharSetUnicodeSequentialByVal_StdCall"));
break;
case StructID.NumberSequentialId:
Console.WriteLine("Calling DelegatePInvoke_MarshalStructNumberSequentialByVal_StdCall...");
- NumberSequential source_ns = Helper.NewNumberSequential(Int32.MinValue, UInt32.MaxValue, short.MinValue, ushort.MaxValue, byte.MinValue,
+ NumberSequential source_ns = Helper.NewNumberSequential(Int32.MinValue, UInt32.MaxValue, short.MinValue, ushort.MaxValue, byte.MinValue,
sbyte.MaxValue, Int16.MinValue, UInt16.MaxValue, -1234567890, 1234567890, 32.0F, 3.2);
- NumberSequential clone_ns = Helper.NewNumberSequential(Int32.MinValue, UInt32.MaxValue, short.MinValue, ushort.MaxValue, byte.MinValue,
+ NumberSequential clone_ns = Helper.NewNumberSequential(Int32.MinValue, UInt32.MaxValue, short.MinValue, ushort.MaxValue, byte.MinValue,
sbyte.MaxValue, Int16.MinValue, UInt16.MaxValue, -1234567890, 1234567890, 32.0F, 3.2);
NumberSequentialByValDelegateStdCall caller6 = Get_MarshalStructNumberSequentialByVal_StdCall_FuncPtr();
- Assert.IsTrue(caller6(source_ns));
- Assert.IsTrue(Helper.ValidateNumberSequential(source_ns, clone_ns, "DelegatePInvoke_MarshalStructNumberSequentialByVal_StdCall"));
+ Assert.True(caller6(source_ns));
+ Assert.True(Helper.ValidateNumberSequential(source_ns, clone_ns, "DelegatePInvoke_MarshalStructNumberSequentialByVal_StdCall"));
break;
case StructID.S3Id:
int[] iarr = new int[256];
S3 cloneS3 = Helper.NewS3(true, "some string", iarr);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS3ByVal_StdCall...");
S3ByValDelegateStdCall caller7 = Get_MarshalStructS3ByVal_StdCall_FuncPtr();
- Assert.IsTrue(caller7(sourceS3));
- Assert.IsTrue(Helper.ValidateS3(sourceS3, cloneS3, "DelegatePInvoke_MarshalStructS3ByVal_StdCall"));
+ Assert.True(caller7(sourceS3));
+ Assert.True(Helper.ValidateS3(sourceS3, cloneS3, "DelegatePInvoke_MarshalStructS3ByVal_StdCall"));
break;
case StructID.S5Id:
Enum1 enums = Enum1.e1;
S5 cloneS5 = Helper.NewS5(32, "some string", enums);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS5ByVal_StdCall...");
S5ByValDelegateStdCall caller8 = Get_MarshalStructS5ByVal_StdCall_FuncPtr();
- Assert.IsTrue(caller8(sourceS5));
- Assert.IsTrue(Helper.ValidateS5(sourceS5, cloneS5, "DelegatePInvoke_MarshalStructS5ByVal_StdCall"));
+ Assert.True(caller8(sourceS5));
+ Assert.True(Helper.ValidateS5(sourceS5, cloneS5, "DelegatePInvoke_MarshalStructS5ByVal_StdCall"));
break;
case StructID.StringStructSequentialAnsiId:
strOne = new String('a', 512);
StringStructSequentialAnsi clone_sssa = Helper.NewStringStructSequentialAnsi(strOne, strTwo);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructStringStructSequentialAnsiByVal_StdCall...");
StringStructSequentialAnsiByValDelegateStdCall caller9 = Get_MarshalStructStringStructSequentialAnsiByVal_StdCall_FuncPtr();
- Assert.IsTrue(caller9(source_sssa));
- Assert.IsTrue(Helper.ValidateStringStructSequentialAnsi(source_sssa, clone_sssa, "DelegatePInvoke_MarshalStructStringStructSequentialAnsiByVal_StdCall"));
+ Assert.True(caller9(source_sssa));
+ Assert.True(Helper.ValidateStringStructSequentialAnsi(source_sssa, clone_sssa, "DelegatePInvoke_MarshalStructStringStructSequentialAnsiByVal_StdCall"));
break;
case StructID.StringStructSequentialUnicodeId:
strOne = new String('a', 256);
StringStructSequentialUnicode clone_sssu = Helper.NewStringStructSequentialUnicode(strOne, strTwo);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructStringStructSequentialUnicodeByVal_StdCall...");
StringStructSequentialUnicodeByValDelegateStdCall caller10 = Get_MarshalStructStringStructSequentialUnicodeByVal_StdCall_FuncPtr();
- Assert.IsTrue(caller10(source_sssu));
- Assert.IsTrue(Helper.ValidateStringStructSequentialUnicode(source_sssu, clone_sssu, "DelegatePInvoke_MarshalStructStringStructSequentialUnicodeByVal_StdCall"));
+ Assert.True(caller10(source_sssu));
+ Assert.True(Helper.ValidateStringStructSequentialUnicode(source_sssu, clone_sssu, "DelegatePInvoke_MarshalStructStringStructSequentialUnicodeByVal_StdCall"));
break;
case StructID.S8Id:
S8 sourceS8 = Helper.NewS8("hello", true, 10, 128, 128, 32);
S8 cloneS8 = Helper.NewS8("hello", true, 10, 128, 128, 32);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS8ByVal_StdCall...");
S8ByValDelegateStdCall caller11 = Get_MarshalStructS8ByVal_StdCall_FuncPtr();
- Assert.IsTrue(caller11(sourceS8));
- Assert.IsTrue(Helper.ValidateS8(sourceS8, cloneS8, "DelegatePInvoke_MarshalStructS8ByVal_StdCall"));
+ Assert.True(caller11(sourceS8));
+ Assert.True(Helper.ValidateS8(sourceS8, cloneS8, "DelegatePInvoke_MarshalStructS8ByVal_StdCall"));
break;
case StructID.S9Id:
S9 sourceS9 = Helper.NewS9(128, new TestDelegate1(testMethod));
S9 cloneS9 = Helper.NewS9(128, new TestDelegate1(testMethod));
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS9ByVal_StdCall...");
S9ByValDelegateStdCall caller12 = Get_MarshalStructS9ByVal_StdCall_FuncPtr();
- Assert.IsTrue(caller12(sourceS9));
- Assert.IsTrue(Helper.ValidateS9(sourceS9, cloneS9, "DelegatePInvoke_MarshalStructS9ByVal_StdCall"));
+ Assert.True(caller12(sourceS9));
+ Assert.True(Helper.ValidateS9(sourceS9, cloneS9, "DelegatePInvoke_MarshalStructS9ByVal_StdCall"));
break;
case StructID.IncludeOuterIntergerStructSequentialId:
IncludeOuterIntergerStructSequential sourceIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
IncludeOuterIntergerStructSequential cloneIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructIncludeOuterIntergerStructSequentialByVal_StdCall...");
IncludeOuterIntergerStructSequentialByValDelegateStdCall caller13 = Get_MarshalStructIncludeOuterIntergerStructSequentialByVal_StdCall_FuncPtr();
- Assert.IsTrue(caller13(sourceIncludeOuterIntergerStructSequential));
- Assert.IsTrue(Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential,
+ Assert.True(caller13(sourceIncludeOuterIntergerStructSequential));
+ Assert.True(Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential,
cloneIncludeOuterIntergerStructSequential, "DelegatePInvoke_MarshalStructIncludeOuterIntergerStructSequentialByVal_StdCall"));
break;
case StructID.S11Id:
S11 cloneS11 = Helper.NewS11((int*)(32), 32);
Console.WriteLine("Calling DelegatePInvoke_MarshalStructS11ByVal_StdCall...");
S11ByValDelegateStdCall caller14 = Get_MarshalStructS11ByVal_StdCall_FuncPtr();
- Assert.IsTrue(caller14(sourceS11));
+ Assert.True(caller14(sourceS11));
break;
default:
- Assert.Fail("TestMethod_DelegatePInvoke_MarshalByVal_StdCall:The structid (Managed Side) is wrong");
+ Assert.True(false, "TestMethod_DelegatePInvoke_MarshalByVal_StdCall:The structid (Managed Side) is wrong");
break;
}
}
#endregion
#region By Ref
-
+
unsafe private static void Run_TestMethod_DelegatePInvoke_MarshalByRef_Cdecl()
{
TestMethod_DelegatePInvoke_MarshalByRef_Cdecl(StructID.ComplexStructId);
TestMethod_DelegatePInvoke_MarshalByRef_Cdecl(StructID.IncludeOuterIntergerStructSequentialId);
TestMethod_DelegatePInvoke_MarshalByRef_Cdecl(StructID.S11Id);
}
-
+
unsafe private static void Run_TestMethod_DelegatePInvoke_MarshalByRef_StdCall()
{
TestMethod_DelegatePInvoke_MarshalByRef_StdCall(StructID.ComplexStructId);
TestMethod_DelegatePInvoke_MarshalByRef_StdCall(StructID.IncludeOuterIntergerStructSequentialId);
TestMethod_DelegatePInvoke_MarshalByRef_StdCall(StructID.S11Id);
}
-
+
#endregion
#region By Value
-
+
unsafe private static void Run_TestMethod_DelegatePInvoke_MarshalByVal_Cdecl()
{
TestMethod_DelegatePInvoke_MarshalByVal_Cdecl(StructID.ComplexStructId);
TestMethod_DelegatePInvoke_MarshalByVal_Cdecl(StructID.IncludeOuterIntergerStructSequentialId);
TestMethod_DelegatePInvoke_MarshalByVal_Cdecl(StructID.S11Id);
}
-
+
unsafe private static void Run_TestMethod_DelegatePInvoke_MarshalByVal_StdCall()
{
TestMethod_DelegatePInvoke_MarshalByVal_StdCall(StructID.ComplexStructId);
TestMethod_DelegatePInvoke_MarshalByVal_StdCall(StructID.IncludeOuterIntergerStructSequentialId);
TestMethod_DelegatePInvoke_MarshalByVal_StdCall(StructID.S11Id);
}
-
+
#endregion
static int Main()
using System.Text;
using System.Security;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
public class MarshalStructTest
{
Console.WriteLine("ReversePinvoke,By Ref,Cdecl");
InnerSequential change_is = Helper.NewInnerSequential(77, 77.0F, "changed string");
//Check the input
- Assert.IsTrue(Helper.ValidateInnerSequential(argstr, change_is, "TestMethodForStructInnerSequential_ReversePInvokeByRef_Cdecl"));
+ Assert.True(Helper.ValidateInnerSequential(argstr, change_is, "TestMethodForStructInnerSequential_ReversePInvokeByRef_Cdecl"));
//Chanage the value
argstr.f1 = 1;
argstr.f2 = 1.0F;
Console.WriteLine("ReversePinvoke,By Ref,StdCall");
InnerSequential change_is = Helper.NewInnerSequential(77, 77.0F, "changed string");
//Check the input
- Assert.IsTrue(Helper.ValidateInnerSequential(argstr, change_is, "TestMethodForStructInnerSequential_ReversePInvokeByRef_StdCall"));
+ Assert.True(Helper.ValidateInnerSequential(argstr, change_is, "TestMethodForStructInnerSequential_ReversePInvokeByRef_StdCall"));
//Chanage the value
argstr.f1 = 1;
argstr.f2 = 1.0F;
Console.WriteLine("ReversePinvoke,By Value,Cdecl");
InnerSequential change_is = Helper.NewInnerSequential(77, 77.0F, "changed string");
//Check the input
- Assert.IsTrue(Helper.ValidateInnerSequential(argstr, change_is, "TestMethodForStructInnerSequential_ReversePInvokeByVal_Cdecl"));
+ Assert.True(Helper.ValidateInnerSequential(argstr, change_is, "TestMethodForStructInnerSequential_ReversePInvokeByVal_Cdecl"));
//Chanage the value
argstr.f1 = 1;
argstr.f2 = 1.0F;
Console.WriteLine("ReversePinvoke,By Value,StdCall");
InnerSequential change_is = Helper.NewInnerSequential(77, 77.0F, "changed string");
//Check the input
- Assert.IsTrue(Helper.ValidateInnerSequential(argstr, change_is, "TestMethodForStructInnerSequential_ReversePInvokeByVal_StdCall"));
+ Assert.True(Helper.ValidateInnerSequential(argstr, change_is, "TestMethodForStructInnerSequential_ReversePInvokeByVal_StdCall"));
//Chanage the value
argstr.f1 = 1;
argstr.f2 = 1.0F;
Console.WriteLine("ReversePinvoke,By Ref,Cdecl");
InnerArraySequential change_is = Helper.NewInnerArraySequential(77, 77.0F, "changed string");
//Check the input
- Assert.IsTrue(Helper.ValidateInnerArraySequential(argstr, change_is, "TestMethodForStructInnerArraySequential_ReversePInvokeByRef_Cdecl"));
+ Assert.True(Helper.ValidateInnerArraySequential(argstr, change_is, "TestMethodForStructInnerArraySequential_ReversePInvokeByRef_Cdecl"));
//Chanage the value
for (int i = 0; i < Common.NumArrElements; i++)
{
Console.WriteLine("ReversePinvoke,By Ref,StdCall");
InnerArraySequential change_is = Helper.NewInnerArraySequential(77, 77.0F, "changed string");
//Check the input
- Assert.IsTrue(Helper.ValidateInnerArraySequential(argstr, change_is, "TestMethodForStructInnerArraySequential_ReversePInvokeByRef_StdCall"));
+ Assert.True(Helper.ValidateInnerArraySequential(argstr, change_is, "TestMethodForStructInnerArraySequential_ReversePInvokeByRef_StdCall"));
//Chanage the value
for (int i = 0; i < Common.NumArrElements; i++)
{
Console.WriteLine("ReversePinvoke,By Value,Cdecl");
InnerArraySequential change_is = Helper.NewInnerArraySequential(77, 77.0F, "changed string");
//Check the input
- Assert.IsTrue(Helper.ValidateInnerArraySequential(argstr, change_is, "TestMethodForStructInnerArraySequential_ReversePInvokeByVal_Cdecl"));
+ Assert.True(Helper.ValidateInnerArraySequential(argstr, change_is, "TestMethodForStructInnerArraySequential_ReversePInvokeByVal_Cdecl"));
//Chanage the value
for (int i = 0; i < Common.NumArrElements; i++)
{
Console.WriteLine("ReversePinvoke,By Value,StdCall");
InnerArraySequential change_is = Helper.NewInnerArraySequential(77, 77.0F, "changed string");
//Check the input
- Assert.IsTrue(Helper.ValidateInnerArraySequential(argstr, change_is, "TestMethodForStructInnerArraySequential_ReversePInvokeByVal_StdCall"));
+ Assert.True(Helper.ValidateInnerArraySequential(argstr, change_is, "TestMethodForStructInnerArraySequential_ReversePInvokeByVal_StdCall"));
//Chanage the value
for (int i = 0; i < Common.NumArrElements; i++)
{
Console.WriteLine("ReversePinvoke,By Ref,Cdecl");
CharSetAnsiSequential change_is = Helper.NewCharSetAnsiSequential("change string", 'n');
//Check the input
- Assert.IsTrue(Helper.ValidateCharSetAnsiSequential(argstr, change_is, "TestMethodForStructCharSetAnsiSequential_ReversePInvokeByRef_Cdecl"));
+ Assert.True(Helper.ValidateCharSetAnsiSequential(argstr, change_is, "TestMethodForStructCharSetAnsiSequential_ReversePInvokeByRef_Cdecl"));
//Chanage the value
argstr.f1 = "some string";
argstr.f2 = 'c';
Console.WriteLine("ReversePinvoke,By Ref,StdCall");
CharSetAnsiSequential change_is = Helper.NewCharSetAnsiSequential("change string", 'n');
//Check the input
- Assert.IsTrue(Helper.ValidateCharSetAnsiSequential(argstr, change_is, "TestMethodForStructCharSetAnsiSequential_ReversePInvokeByRef_StdCall"));
+ Assert.True(Helper.ValidateCharSetAnsiSequential(argstr, change_is, "TestMethodForStructCharSetAnsiSequential_ReversePInvokeByRef_StdCall"));
//Chanage the value
argstr.f1 = "some string";
argstr.f2 = 'c';
Console.WriteLine("ReversePinvoke,By Value,Cdecl");
CharSetAnsiSequential change_is = Helper.NewCharSetAnsiSequential("change string", 'n');
//Check the input
- Assert.IsTrue(Helper.ValidateCharSetAnsiSequential(argstr, change_is, "TestMethodForStructCharSetAnsiSequential_ReversePInvokeByVal_Cdecl"));
+ Assert.True(Helper.ValidateCharSetAnsiSequential(argstr, change_is, "TestMethodForStructCharSetAnsiSequential_ReversePInvokeByVal_Cdecl"));
//Chanage the value
argstr.f1 = "some string";
argstr.f2 = 'c';
Console.WriteLine("ReversePinvoke,By Value,StdCall");
CharSetAnsiSequential change_is = Helper.NewCharSetAnsiSequential("change string", 'n');
//Check the input
- Assert.IsTrue(Helper.ValidateCharSetAnsiSequential(argstr, change_is, "TestMethodForStructCharSetAnsiSequential_ReversePInvokeByVal_StdCall"));
+ Assert.True(Helper.ValidateCharSetAnsiSequential(argstr, change_is, "TestMethodForStructCharSetAnsiSequential_ReversePInvokeByVal_StdCall"));
//Chanage the value
argstr.f1 = "some string";
argstr.f2 = 'c';
Console.WriteLine("ReversePinvoke,By Ref,Cdecl");
CharSetUnicodeSequential change_is = Helper.NewCharSetUnicodeSequential("change string", 'n');
//Check the input
- Assert.IsTrue(Helper.ValidateCharSetUnicodeSequential(argstr, change_is, "TestMethodForStructCharSetUnicodeSequential_ReversePInvokeByRef_Cdecl"));
+ Assert.True(Helper.ValidateCharSetUnicodeSequential(argstr, change_is, "TestMethodForStructCharSetUnicodeSequential_ReversePInvokeByRef_Cdecl"));
//Chanage the value
argstr.f1 = "some string";
argstr.f2 = 'c';
Console.WriteLine("ReversePinvoke,By Ref,StdCall");
CharSetUnicodeSequential change_is = Helper.NewCharSetUnicodeSequential("change string", 'n');
//Check the input
- Assert.IsTrue(Helper.ValidateCharSetUnicodeSequential(argstr, change_is, "TestMethodForStructCharSetUnicodeSequential_ReversePInvokeByRef_StdCall"));
+ Assert.True(Helper.ValidateCharSetUnicodeSequential(argstr, change_is, "TestMethodForStructCharSetUnicodeSequential_ReversePInvokeByRef_StdCall"));
//Chanage the value
argstr.f1 = "some string";
argstr.f2 = 'c';
Console.WriteLine("ReversePinvoke,By Value,Cdecl");
CharSetUnicodeSequential change_is = Helper.NewCharSetUnicodeSequential("change string", 'n');
//Check the input
- Assert.IsTrue(Helper.ValidateCharSetUnicodeSequential(argstr, change_is, "TestMethodForStructCharSetUnicodeSequential_ReversePInvokeByVal_Cdecl"));
+ Assert.True(Helper.ValidateCharSetUnicodeSequential(argstr, change_is, "TestMethodForStructCharSetUnicodeSequential_ReversePInvokeByVal_Cdecl"));
//Chanage the value
argstr.f1 = "some string";
argstr.f2 = 'c';
Console.WriteLine("ReversePinvoke,By Value,StdCall");
CharSetUnicodeSequential change_is = Helper.NewCharSetUnicodeSequential("change string", 'n');
//Check the input
- Assert.IsTrue(Helper.ValidateCharSetUnicodeSequential(argstr, change_is, "TestMethodForStructCharSetUnicodeSequential_ReversePInvokeByVal_StdCall"));
+ Assert.True(Helper.ValidateCharSetUnicodeSequential(argstr, change_is, "TestMethodForStructCharSetUnicodeSequential_ReversePInvokeByVal_StdCall"));
//Chanage the value
argstr.f1 = "some string";
argstr.f2 = 'c';
Console.WriteLine("ReversePinvoke,By Ref,Cdecl");
NumberSequential change_is = Helper.NewNumberSequential(0, 32, 0, 16, 0, 8, 0, 16, 0, 64, 64.0F, 6.4);
//Check the input
- Assert.IsTrue(Helper.ValidateNumberSequential(argstr, change_is, "TestMethodForStructNumberSequential_ReversePInvokeByRef_Cdecl"));
+ Assert.True(Helper.ValidateNumberSequential(argstr, change_is, "TestMethodForStructNumberSequential_ReversePInvokeByRef_Cdecl"));
//Chanage the value
argstr.i32 = Int32.MinValue;
argstr.ui32 = UInt32.MaxValue;
Console.WriteLine("ReversePinvoke,By Ref,StdCall");
NumberSequential change_is = Helper.NewNumberSequential(0, 32, 0, 16, 0, 8, 0, 16, 0, 64, 64.0F, 6.4);
//Check the input
- Assert.IsTrue(Helper.ValidateNumberSequential(argstr, change_is, "TestMethodForStructNumberSequential_ReversePInvokeByRef_StdCall"));
+ Assert.True(Helper.ValidateNumberSequential(argstr, change_is, "TestMethodForStructNumberSequential_ReversePInvokeByRef_StdCall"));
//Chanage the value
argstr.i32 = Int32.MinValue;
argstr.ui32 = UInt32.MaxValue;
Console.WriteLine("ReversePinvoke,By Value,Cdecl");
NumberSequential change_is = Helper.NewNumberSequential(0, 32, 0, 16, 0, 8, 0, 16, 0, 64, 64.0F, 6.4);
//Check the input
- Assert.IsTrue(Helper.ValidateNumberSequential(argstr, change_is, "TestMethodForStructNumberSequential_ReversePInvokeByVal_Cdecl"));
+ Assert.True(Helper.ValidateNumberSequential(argstr, change_is, "TestMethodForStructNumberSequential_ReversePInvokeByVal_Cdecl"));
//Chanage the value
argstr.i32 = Int32.MinValue;
argstr.ui32 = UInt32.MaxValue;
Console.WriteLine("ReversePinvoke,By Value,StdCall");
NumberSequential change_is = Helper.NewNumberSequential(0, 32, 0, 16, 0, 8, 0, 16, 0, 64, 64.0F, 6.4);
//Check the input
- Assert.IsTrue(Helper.ValidateNumberSequential(argstr, change_is, "TestMethodForStructNumberSequential_ReversePInvokeByVal_StdCall"));
+ Assert.True(Helper.ValidateNumberSequential(argstr, change_is, "TestMethodForStructNumberSequential_ReversePInvokeByVal_StdCall"));
//Chanage the value
argstr.i32 = Int32.MinValue;
argstr.ui32 = UInt32.MaxValue;
Helper.InitialArray(iarr, icarr);
S3 changeS3 = Helper.NewS3(false, "change string", icarr);
//Check the input
- Assert.IsTrue(Helper.ValidateS3(argstr, changeS3, "TestMethodForStructS3_ReversePInvokeByRef_Cdecl"));
+ Assert.True(Helper.ValidateS3(argstr, changeS3, "TestMethodForStructS3_ReversePInvokeByRef_Cdecl"));
//Chanage the value
argstr.flag = true;
argstr.str = "some string";
Helper.InitialArray(iarr, icarr);
S3 changeS3 = Helper.NewS3(false, "change string", icarr);
//Check the input
- Assert.IsTrue(Helper.ValidateS3(argstr, changeS3, "TestMethodForStructS3_ReversePInvokeByRef_Cdecl"));
+ Assert.True(Helper.ValidateS3(argstr, changeS3, "TestMethodForStructS3_ReversePInvokeByRef_Cdecl"));
//Chanage the value
argstr.flag = true;
argstr.str = "some string";
Helper.InitialArray(iarr, icarr);
S3 changeS3 = Helper.NewS3(false, "change string", icarr);
//Check the input
- Assert.IsTrue(Helper.ValidateS3(argstr, changeS3, "TestMethodForStructS3_ReversePInvokeByVal_Cdecl"));
+ Assert.True(Helper.ValidateS3(argstr, changeS3, "TestMethodForStructS3_ReversePInvokeByVal_Cdecl"));
//Chanage the value
argstr.flag = true;
argstr.str = "some string";
Helper.InitialArray(iarr, icarr);
S3 changeS3 = Helper.NewS3(false, "change string", icarr);
//Check the input
- Assert.IsTrue(Helper.ValidateS3(argstr, changeS3, "TestMethodForStructS3_ReversePInvokeByVal_StdCall"));
+ Assert.True(Helper.ValidateS3(argstr, changeS3, "TestMethodForStructS3_ReversePInvokeByVal_StdCall"));
//Chanage the value
argstr.flag = true;
argstr.str = "some string";
#endregion
#region Methods for the struct S5 declaration
-
+
#region PassByRef
-
+
//For Reverse Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S5ByRefCdeclcaller([In, Out]ref S5 argStr);
s4.name = "some string";
S5 changeS5 = Helper.NewS5(64, "change string", enumch);
//Check the input
- Assert.IsTrue(Helper.ValidateS5(argstr, changeS5, "TestMethodForStructS5_ReversePInvokeByRef_Cdecl"));
+ Assert.True(Helper.ValidateS5(argstr, changeS5, "TestMethodForStructS5_ReversePInvokeByRef_Cdecl"));
//Chanage the value
argstr.s4 = s4;
argstr.ef = enums;
return true;
}
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool S5ByRefStdCallcaller([In, Out]ref S5 argStr);
private static bool TestMethodForStructS5_ReversePInvokeByRef_StdCall(ref S5 argstr)
s4.name = "some string";
S5 changeS5 = Helper.NewS5(64, "change string", enumch);
//Check the input
- Assert.IsTrue(Helper.ValidateS5(argstr, changeS5, "TestMethodForStructS5_ReversePInvokeByRef_StdCall"));
+ Assert.True(Helper.ValidateS5(argstr, changeS5, "TestMethodForStructS5_ReversePInvokeByRef_StdCall"));
//Chanage the value
argstr.s4 = s4;
argstr.ef = enums;
//Reverse Pinvoke,stdcall
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
public static extern bool DoCallBack_MarshalStructS5ByRef_StdCall(S5ByRefStdCallcaller caller);
-
+
#endregion
-
+
#region PassByValue
-
+
//For Reverse Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S5ByValCdeclcaller([In, Out] S5 argStr);
s4.name = "some string";
S5 changeS5 = Helper.NewS5(64, "change string", enumch);
//Check the input
- Assert.IsTrue(Helper.ValidateS5(argstr, changeS5, "TestMethodForStructS5_ReversePInvokeByVal_Cdecl"));
+ Assert.True(Helper.ValidateS5(argstr, changeS5, "TestMethodForStructS5_ReversePInvokeByVal_Cdecl"));
//Chanage the value
argstr.s4 = s4;
argstr.ef = enums;
s4.name = "some string";
S5 changeS5 = Helper.NewS5(64, "change string", enumch);
//Check the input
- Assert.IsTrue(Helper.ValidateS5(argstr, changeS5, "TestMethodForStructS5_ReversePInvokeByVal_StdCall"));
+ Assert.True(Helper.ValidateS5(argstr, changeS5, "TestMethodForStructS5_ReversePInvokeByVal_StdCall"));
//Chanage the value
argstr.s4 = s4;
argstr.ef = enums;
//Reverse Pinvoke,stdcall
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
public static extern bool DoCallBack_MarshalStructS5ByVal_StdCall(S5ByValStdCallcaller caller);
-
+
#endregion
-
+
#endregion
#region Methods for the struct StringStructSequentialAnsi declaration
-
+
#region PassByRef
-
+
//For Reverse Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool StringStructSequentialAnsiByRefCdeclcaller([In, Out]ref StringStructSequentialAnsi argStr);
strTwo = new String('b', 512);
StringStructSequentialAnsi change_sssa = Helper.NewStringStructSequentialAnsi(strTwo, strOne);
//Check the input
- Assert.IsTrue(Helper.ValidateStringStructSequentialAnsi(argstr, change_sssa, "TestMethodForStructStringStructSequentialAnsi_ReversePInvokeByRef_Cdecl"));
+ Assert.True(Helper.ValidateStringStructSequentialAnsi(argstr, change_sssa, "TestMethodForStructStringStructSequentialAnsi_ReversePInvokeByRef_Cdecl"));
//Chanage the value
argstr.first = strOne;
argstr.last = strTwo;
return true;
}
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool StringStructSequentialAnsiByRefStdCallcaller([In, Out]ref StringStructSequentialAnsi argStr);
private static bool TestMethodForStructStringStructSequentialAnsi_ReversePInvokeByRef_StdCall(ref StringStructSequentialAnsi argstr)
strTwo = new String('b', 512);
StringStructSequentialAnsi change_sssa = Helper.NewStringStructSequentialAnsi(strTwo, strOne);
//Check the input
- Assert.IsTrue(Helper.ValidateStringStructSequentialAnsi(argstr, change_sssa, "TestMethodForStructStringStructSequentialAnsi_ReversePInvokeByRef_StdCall"));
+ Assert.True(Helper.ValidateStringStructSequentialAnsi(argstr, change_sssa, "TestMethodForStructStringStructSequentialAnsi_ReversePInvokeByRef_StdCall"));
//Chanage the value
argstr.first = strOne;
argstr.last = strTwo;
//Reverse Pinvoke,stdcall
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
public static extern bool DoCallBack_MarshalStructStringStructSequentialAnsiByRef_StdCall(StringStructSequentialAnsiByRefStdCallcaller caller);
-
+
#endregion
-
+
#region PassByValue
-
+
//For Reverse Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool StringStructSequentialAnsiByValCdeclcaller([In, Out] StringStructSequentialAnsi argStr);
strTwo = new String('b', 512);
StringStructSequentialAnsi change_sssa = Helper.NewStringStructSequentialAnsi(strTwo, strOne);
//Check the input
- Assert.IsTrue(Helper.ValidateStringStructSequentialAnsi(argstr, change_sssa, "TestMethodForStructStringStructSequentialAnsi_ReversePInvokeByVal_Cdecl"));
+ Assert.True(Helper.ValidateStringStructSequentialAnsi(argstr, change_sssa, "TestMethodForStructStringStructSequentialAnsi_ReversePInvokeByVal_Cdecl"));
//Chanage the value
argstr.first = strOne;
argstr.last = strTwo;
strTwo = new String('b', 512);
StringStructSequentialAnsi change_sssa = Helper.NewStringStructSequentialAnsi(strTwo, strOne);
//Check the input
- Assert.IsTrue(Helper.ValidateStringStructSequentialAnsi(argstr, change_sssa, "TestMethodForStructStringStructSequentialAnsi_ReversePInvokeByVal_StdCall"));
+ Assert.True(Helper.ValidateStringStructSequentialAnsi(argstr, change_sssa, "TestMethodForStructStringStructSequentialAnsi_ReversePInvokeByVal_StdCall"));
//Chanage the value
argstr.first = strOne;
argstr.last = strTwo;
//Reverse Pinvoke,stdcall
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
public static extern bool DoCallBack_MarshalStructStringStructSequentialAnsiByVal_StdCall(StringStructSequentialAnsiByValStdCallcaller caller);
-
+
#endregion
-
+
#endregion
#region Methods for the struct StringStructSequentialUnicode declaration
-
+
#region PassByRef
-
+
//For Reverse Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool StringStructSequentialUnicodeByRefCdeclcaller([In, Out]ref StringStructSequentialUnicode argStr);
strTwo = new String('b', 256);
StringStructSequentialUnicode change_sssa = Helper.NewStringStructSequentialUnicode(strTwo, strOne);
//Check the input
- Assert.IsTrue(Helper.ValidateStringStructSequentialUnicode(argstr, change_sssa, "TestMethodForStructStringStructSequentialUnicode_ReversePInvokeByRef_Cdecl"));
+ Assert.True(Helper.ValidateStringStructSequentialUnicode(argstr, change_sssa, "TestMethodForStructStringStructSequentialUnicode_ReversePInvokeByRef_Cdecl"));
//Chanage the value
argstr.first = strOne;
argstr.last = strTwo;
return true;
}
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool StringStructSequentialUnicodeByRefStdCallcaller([In, Out]ref StringStructSequentialUnicode argStr);
private static bool TestMethodForStructStringStructSequentialUnicode_ReversePInvokeByRef_StdCall(ref StringStructSequentialUnicode argstr)
strTwo = new String('b', 256);
StringStructSequentialUnicode change_sssa = Helper.NewStringStructSequentialUnicode(strTwo, strOne);
//Check the input
- Assert.IsTrue(Helper.ValidateStringStructSequentialUnicode(argstr, change_sssa, "TestMethodForStructStringStructSequentialUnicode_ReversePInvokeByRef_StdCall"));
+ Assert.True(Helper.ValidateStringStructSequentialUnicode(argstr, change_sssa, "TestMethodForStructStringStructSequentialUnicode_ReversePInvokeByRef_StdCall"));
//Chanage the value
argstr.first = strOne;
argstr.last = strTwo;
//Reverse Pinvoke,stdcall
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
public static extern bool DoCallBack_MarshalStructStringStructSequentialUnicodeByRef_StdCall(StringStructSequentialUnicodeByRefStdCallcaller caller);
-
+
#endregion
-
+
#region PassByValue
//For Reverse Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
strTwo = new String('b', 256);
StringStructSequentialUnicode change_sssa = Helper.NewStringStructSequentialUnicode(strTwo, strOne);
//Check the input
- Assert.IsTrue(Helper.ValidateStringStructSequentialUnicode(argstr, change_sssa, "TestMethodForStructStringStructSequentialUnicode_ReversePInvokeByVal_Cdecl"));
+ Assert.True(Helper.ValidateStringStructSequentialUnicode(argstr, change_sssa, "TestMethodForStructStringStructSequentialUnicode_ReversePInvokeByVal_Cdecl"));
//Chanage the value
argstr.first = strOne;
argstr.last = strTwo;
strTwo = new String('b', 256);
StringStructSequentialUnicode change_sssa = Helper.NewStringStructSequentialUnicode(strTwo, strOne);
//Check the input
- Assert.IsTrue(Helper.ValidateStringStructSequentialUnicode(argstr, change_sssa, "TestMethodForStructStringStructSequentialUnicode_ReversePInvokeByVal_StdCall"));
+ Assert.True(Helper.ValidateStringStructSequentialUnicode(argstr, change_sssa, "TestMethodForStructStringStructSequentialUnicode_ReversePInvokeByVal_StdCall"));
//Chanage the value
argstr.first = strOne;
argstr.last = strTwo;
//Reverse Pinvoke,stdcall
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
public static extern bool DoCallBack_MarshalStructStringStructSequentialUnicodeByVal_StdCall(StringStructSequentialUnicodeByValStdCallcaller caller);
-
+
#endregion
-
+
#endregion
#region Methods for the struct S8 declaration
-
+
#region PassByRef
-
+
//For Reverse Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S8ByRefCdeclcaller([In, Out]ref S8 argStr);
Console.WriteLine("ReversePinvoke,By Ref,Cdecl");
S8 changeS8 = Helper.NewS8("world", false, 1, 256, 256, 64);
//Check the input
- Assert.IsTrue(Helper.ValidateS8(argstr, changeS8, "TestMethodForStructS8_ReversePInvokeByRef_Cdecl"));
+ Assert.True(Helper.ValidateS8(argstr, changeS8, "TestMethodForStructS8_ReversePInvokeByRef_Cdecl"));
//Chanage the value
argstr.name = "hello";
argstr.gender = true;
argstr.mySByte = 32;
return true;
}
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool S8ByRefStdCallcaller([In, Out]ref S8 argStr);
private static bool TestMethodForStructS8_ReversePInvokeByRef_StdCall(ref S8 argstr)
Console.WriteLine("ReversePinvoke,By Ref,StdCall");
S8 changeS8 = Helper.NewS8("world", false, 1, 256, 256, 64);
//Check the input
- Assert.IsTrue(Helper.ValidateS8(argstr, changeS8, "TestMethodForStructS8_ReversePInvokeByRef_Cdecl"));
+ Assert.True(Helper.ValidateS8(argstr, changeS8, "TestMethodForStructS8_ReversePInvokeByRef_Cdecl"));
//Chanage the value
argstr.name = "hello";
argstr.gender = true;
//Reverse Pinvoke,stdcall
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
public static extern bool DoCallBack_MarshalStructS8ByRef_StdCall(S8ByRefStdCallcaller caller);
-
+
#endregion
-
+
#region PassByValue
-
+
//For Reverse Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S8ByValCdeclcaller([In, Out] S8 argStr);
Console.WriteLine("ReversePinvoke,By Value,Cdecl");
S8 changeS8 = Helper.NewS8("world", false, 1, 256, 256, 64);
//Check the input
- Assert.IsTrue(Helper.ValidateS8(argstr, changeS8, "TestMethodForStructS8_ReversePInvokeByVal_Cdecl"));
+ Assert.True(Helper.ValidateS8(argstr, changeS8, "TestMethodForStructS8_ReversePInvokeByVal_Cdecl"));
//Chanage the value
argstr.name = "hello";
argstr.gender = true;
Console.WriteLine("ReversePinvoke,By Value,StdCall");
S8 changeS8 = Helper.NewS8("world", false, 1, 256, 256, 64);
//Check the input
- Assert.IsTrue(Helper.ValidateS8(argstr, changeS8, "TestMethodForStructS8_ReversePInvokeByVal_StdCall"));
+ Assert.True(Helper.ValidateS8(argstr, changeS8, "TestMethodForStructS8_ReversePInvokeByVal_StdCall"));
//Chanage the value
argstr.name = "hello";
argstr.gender = true;
//Reverse Pinvoke,stdcall
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
public static extern bool DoCallBack_MarshalStructS8ByVal_StdCall(S8ByValStdCallcaller caller);
-
+
#endregion
-
+
#endregion
#region Methods for the struct S9 declaration
-
+
#region PassByRef
-
+
//For Reverse Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S9ByRefCdeclcaller([In, Out]ref S9 argStr);
Console.WriteLine("ReversePinvoke,By Ref,Cdecl");
S9 changeS9 = Helper.NewS9(256, null);
//Check the input
- Assert.IsTrue(Helper.ValidateS9(argstr, changeS9, "TestMethodForStructS9_ReversePInvokeByRef_Cdecl"));
+ Assert.True(Helper.ValidateS9(argstr, changeS9, "TestMethodForStructS9_ReversePInvokeByRef_Cdecl"));
//Chanage the value
argstr.i32 = 128;
argstr.myDelegate1 = new TestDelegate1(testMethod);
return true;
}
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool S9ByRefStdCallcaller([In, Out]ref S9 argStr);
private static bool TestMethodForStructS9_ReversePInvokeByRef_StdCall(ref S9 argstr)
Console.WriteLine("ReversePinvoke,By Ref,StdCall");
S9 changeS9 = Helper.NewS9(256, null);
//Check the input
- Assert.IsTrue(Helper.ValidateS9(argstr, changeS9, "TestMethodForStructS9_ReversePInvokeByRef_StdCall"));
+ Assert.True(Helper.ValidateS9(argstr, changeS9, "TestMethodForStructS9_ReversePInvokeByRef_StdCall"));
//Chanage the value
argstr.i32 = 128;
argstr.myDelegate1 = new TestDelegate1(testMethod);
//Reverse Pinvoke,stdcall
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
public static extern bool DoCallBack_MarshalStructS9ByRef_StdCall(S9ByRefStdCallcaller caller);
-
+
#endregion
-
+
#region PassByValue
-
+
//For Reverse Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S9ByValCdeclcaller([In, Out] S9 argStr);
Console.WriteLine("ReversePinvoke,By Value,Cdecl");
S9 changeS9 = Helper.NewS9(256, null);
//Check the input
- Assert.IsTrue(Helper.ValidateS9(argstr, changeS9, "TestMethodForStructS9_ReversePInvokeByVal_Cdecl"));
+ Assert.True(Helper.ValidateS9(argstr, changeS9, "TestMethodForStructS9_ReversePInvokeByVal_Cdecl"));
//Chanage the value
argstr.i32 = 128;
argstr.myDelegate1 = new TestDelegate1(testMethod);
Console.WriteLine("ReversePinvoke,By Value,StdCall");
S9 changeS9 = Helper.NewS9(256, null);
//Check the input
- Assert.IsTrue(Helper.ValidateS9(argstr, changeS9, "TestMethodForStructS9_ReversePInvokeByVal_StdCall"));
+ Assert.True(Helper.ValidateS9(argstr, changeS9, "TestMethodForStructS9_ReversePInvokeByVal_StdCall"));
//Chanage the value
argstr.i32 = 128;
argstr.myDelegate1 = new TestDelegate1(testMethod);
//Reverse Pinvoke,stdcall
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
public static extern bool DoCallBack_MarshalStructS9ByVal_StdCall(S9ByValStdCallcaller caller);
-
+
#endregion
-
+
#endregion
#region Methods for the struct IncludeOuterIntergerStructSequential declaration
-
+
#region PassByRef
-
+
//For Reverse Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool IncludeOuterIntergerStructSequentialByRefCdeclcaller([In, Out]ref IncludeOuterIntergerStructSequential argStr);
Console.WriteLine("ReversePinvoke,By Ref,Cdecl");
IncludeOuterIntergerStructSequential changeIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(64, 64);
//Check the input
- Assert.IsTrue(Helper.ValidateIncludeOuterIntergerStructSequential(argstr,
+ Assert.True(Helper.ValidateIncludeOuterIntergerStructSequential(argstr,
changeIncludeOuterIntergerStructSequential, "TestMethodForStructIncludeOuterIntergerStructSequential_ReversePInvokeByRef_Cdecl"));
//Chanage the value
argstr.s.s_int.i = 32;
argstr.s.i = 32;
return true;
}
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool IncludeOuterIntergerStructSequentialByRefStdCallcaller([In, Out]ref IncludeOuterIntergerStructSequential argStr);
private static bool TestMethodForStructIncludeOuterIntergerStructSequential_ReversePInvokeByRef_StdCall(ref IncludeOuterIntergerStructSequential argstr)
Console.WriteLine("ReversePinvoke,By Ref,StdCall");
IncludeOuterIntergerStructSequential changeIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(64, 64);
//Check the input
- Assert.IsTrue(Helper.ValidateIncludeOuterIntergerStructSequential(argstr,
+ Assert.True(Helper.ValidateIncludeOuterIntergerStructSequential(argstr,
changeIncludeOuterIntergerStructSequential, "TestMethodForStructIncludeOuterIntergerStructSequential_ReversePInvokeByRef_Cdecl"));
//Chanage the value
argstr.s.s_int.i = 32;
//Reverse Pinvoke,stdcall
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
public static extern bool DoCallBack_MarshalStructIncludeOuterIntergerStructSequentialByRef_StdCall(IncludeOuterIntergerStructSequentialByRefStdCallcaller caller);
-
+
#endregion
-
+
#region PassByValue
-
+
//For Reverse Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate IncludeOuterIntergerStructSequential IncludeOuterIntergerStructSequentialByValCdeclcaller([In, Out] IncludeOuterIntergerStructSequential argStr);
Console.WriteLine("ReversePinvoke,By Value,Cdecl");
IncludeOuterIntergerStructSequential changeIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(64, 64);
//Check the input
- Assert.IsTrue(Helper.ValidateIncludeOuterIntergerStructSequential(argstr,
+ Assert.True(Helper.ValidateIncludeOuterIntergerStructSequential(argstr,
changeIncludeOuterIntergerStructSequential, "TestMethodForStructIncludeOuterIntergerStructSequential_ReversePInvokeByVal_Cdecl"));
//Chanage the value
argstr.s.s_int.i = 32;
Console.WriteLine("ReversePinvoke,By Value,StdCall");
IncludeOuterIntergerStructSequential changeIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(64, 64);
//Check the input
- Assert.IsTrue(Helper.ValidateIncludeOuterIntergerStructSequential(argstr,
+ Assert.True(Helper.ValidateIncludeOuterIntergerStructSequential(argstr,
changeIncludeOuterIntergerStructSequential, "TestMethodForStructIncludeOuterIntergerStructSequential_ReversePInvokeByVal_StdCall"));
//Chanage the value
argstr.s.s_int.i = 32;
//Reverse Pinvoke,stdcall
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
public static extern bool DoCallBack_MarshalStructIncludeOuterIntergerStructSequentialByVal_StdCall(IncludeOuterIntergerStructSequentialByValStdCallcaller caller);
-
+
#endregion
-
+
#endregion
#region Methods for the struct S11 declaration
-
+
#region PassByRef
-
+
//For Reverse Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S11ByRefCdeclcaller([In, Out]ref S11 argStr);
Console.WriteLine("ReversePinvoke,By Ref,Cdecl");
S11 changeS11 = Helper.NewS11((int*)(64), 64);
//Check the input
- Assert.IsTrue(Helper.ValidateS11(argstr, changeS11, "TestMethodForStructS11_ReversePInvokeByRef_Cdecl"));
+ Assert.True(Helper.ValidateS11(argstr, changeS11, "TestMethodForStructS11_ReversePInvokeByRef_Cdecl"));
//Chanage the value
argstr.i32 = (int*)(32);
argstr.i = 32;
return true;
}
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate bool S11ByRefStdCallcaller([In, Out]ref S11 argStr);
unsafe private static bool TestMethodForStructS11_ReversePInvokeByRef_StdCall(ref S11 argstr)
Console.WriteLine("ReversePinvoke,By Ref,StdCall");
S11 changeS11 = Helper.NewS11((int*)(64), 64);
//Check the input
- Assert.IsTrue(Helper.ValidateS11(argstr, changeS11, "TestMethodForStructS11_ReversePInvokeByRef_StdCall"));
+ Assert.True(Helper.ValidateS11(argstr, changeS11, "TestMethodForStructS11_ReversePInvokeByRef_StdCall"));
//Chanage the value
argstr.i32 = (int*)(32);
argstr.i = 32;
//Reverse Pinvoke,stdcall
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
public static extern bool DoCallBack_MarshalStructS11ByRef_StdCall(S11ByRefStdCallcaller caller);
-
+
#endregion
-
+
#region PassByValue
-
+
//For Reverse Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool S11ByValCdeclcaller([In, Out] S11 argStr);
Console.WriteLine("ReversePinvoke,By Value,Cdecl");
S11 changeS11 = Helper.NewS11((int*)(64), 64);
//Check the input
- Assert.IsTrue(Helper.ValidateS11(argstr, changeS11, "TestMethodForStructS11_ReversePInvokeByVal_Cdecl"));
+ Assert.True(Helper.ValidateS11(argstr, changeS11, "TestMethodForStructS11_ReversePInvokeByVal_Cdecl"));
//Chanage the value
argstr.i32 = (int*)(32);
argstr.i = 32;
Console.WriteLine("ReversePinvoke,By Value,StdCall");
S11 changeS11 = Helper.NewS11((int*)(64), 64);
//Check the input
- Assert.IsTrue(Helper.ValidateS11(argstr, changeS11, "TestMethodForStructS11_ReversePInvokeByVal_StdCall"));
+ Assert.True(Helper.ValidateS11(argstr, changeS11, "TestMethodForStructS11_ReversePInvokeByVal_StdCall"));
//Chanage the value
argstr.i32 = (int*)(32);
argstr.i = 32;
//Reverse Pinvoke,stdcall
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
public static extern bool DoCallBack_MarshalStructS11ByVal_StdCall(S11ByValStdCallcaller caller);
-
+
#endregion
-
+
#endregion
#region Methods for the struct ComplexStruct declaration
-
+
#region PassByRef
-
+
//For Reverse Pinvoke ByRef
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool ComplexStructByRefCdeclcaller([In, Out]ref ComplexStruct argStr);
{
Console.WriteLine("ReversePinvoke,By Ref,Cdecl");
//Check the input
- Assert.AreEqual(9999, cs.i);
- Assert.IsFalse(cs.b);
- Assert.AreEqual("Native", cs.str);
- Assert.AreEqual(-1, cs.type.idata);
- Assert.AreEqual(3.14159, cs.type.ddata);
+ Assert.Equal(9999, cs.i);
+ Assert.False(cs.b);
+ Assert.Equal("Native", cs.str);
+ Assert.Equal(-1, cs.type.idata);
+ Assert.Equal(3.14159, cs.type.ddata);
//Chanage the value
cs.i = 321;
cs.b = true;
{
Console.WriteLine("ReversePinvoke,By Ref,StdCall");
//Check the input
- Assert.AreEqual(9999, cs.i);
- Assert.IsFalse(cs.b);
- Assert.AreEqual("Native", cs.str);
- Assert.AreEqual(-1, cs.type.idata);
- Assert.AreEqual(3.14159, cs.type.ddata);
+ Assert.Equal(9999, cs.i);
+ Assert.False(cs.b);
+ Assert.Equal("Native", cs.str);
+ Assert.Equal(-1, cs.type.idata);
+ Assert.Equal(3.14159, cs.type.ddata);
//Chanage the value
cs.i = 321;
cs.b = true;
//Reverse Pinvoke,stdcall
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
public static extern bool DoCallBack_MarshalStructComplexStructByRef_StdCall(ComplexStructByRefStdCallcaller caller);
-
+
#endregion
-
+
#region PassByValue
-
+
//For Reverse Pinvoke ByVal
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool ComplexStructByValCdeclcaller([In, Out] ComplexStruct argStr);
{
Console.WriteLine("ReversePinvoke,By Value,Cdecl");
//Check the input
- Assert.AreEqual(9999, cs.i);
- Assert.IsFalse(cs.b);
- Assert.AreEqual("Native", cs.str);
- Assert.AreEqual(-1, cs.type.idata);
- Assert.AreEqual(3.14159, cs.type.ddata);
+ Assert.Equal(9999, cs.i);
+ Assert.False(cs.b);
+ Assert.Equal("Native", cs.str);
+ Assert.Equal(-1, cs.type.idata);
+ Assert.Equal(3.14159, cs.type.ddata);
//Try to Chanage the value
cs.i = 321;
cs.b = true;
{
Console.WriteLine("Reverse Pinvoke,By Value,StdCall");
//Check the input
- Assert.AreEqual(9999, cs.i);
- Assert.IsFalse(cs.b);
- Assert.AreEqual("Native", cs.str);
- Assert.AreEqual(-1, cs.type.idata);
- Assert.AreEqual(3.14159, cs.type.ddata);
+ Assert.Equal(9999, cs.i);
+ Assert.False(cs.b);
+ Assert.Equal("Native", cs.str);
+ Assert.Equal(-1, cs.type.idata);
+ Assert.Equal(3.14159, cs.type.ddata);
//Try to Chanage the value
cs.i = 321;
cs.b = true;
//Reverse Pinvoke,stdcall
[DllImport("SeqPInvokeNative", CallingConvention = CallingConvention.StdCall)]
public static extern bool DoCallBack_MarshalStructComplexStructByVal_StdCall(ComplexStructByValStdCallcaller caller);
-
+
#endregion
#endregion
{
Console.WriteLine("Reverse,Pinvoke,By Val,Cdecl");
ByteStruct3Byte change_bspe = Helper.NewByteStruct3Byte(1, 42, 90);
- Assert.IsTrue(Helper.ValidateByteStruct3Byte(change_bspe, bspe, "TestMethod_DoCallBack_MarshalStructByVal_ByteStruct3Byte_Cdecl"));
+ Assert.True(Helper.ValidateByteStruct3Byte(change_bspe, bspe, "TestMethod_DoCallBack_MarshalStructByVal_ByteStruct3Byte_Cdecl"));
//changed the value
bspe.b1 = 7;
bspe.b2 = 12;
success = true;
return bspe;
}
-
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate ByteStruct3Byte ByValStdCallcaller_ByteStruct3Byte(ByteStruct3Byte bspe, [MarshalAs(UnmanagedType.Bool)] out bool success);
{
Console.WriteLine("Reverse,Pinvoke,By Val,StdCall");
ByteStruct3Byte change_bspe = Helper.NewByteStruct3Byte(1, 42, 90);
- Assert.IsTrue(Helper.ValidateByteStruct3Byte(change_bspe, bspe, "TestMethod_DoCallBack_MarshalStructByVal_ByteStruct3Byte_StdCall"));
+ Assert.True(Helper.ValidateByteStruct3Byte(change_bspe, bspe, "TestMethod_DoCallBack_MarshalStructByVal_ByteStruct3Byte_StdCall"));
//changed the value
bspe.b1 = 7;
bspe.b2 = 12;
Console.WriteLine("ReversePinvoke,By Value,Cdecl");
IntergerStructSequential changeIntergerStructSequential = Helper.NewIntergerStructSequential(64);
//Check the input
- Assert.IsTrue(Helper.ValidateIntergerStructSequential(argstr,
+ Assert.True(Helper.ValidateIntergerStructSequential(argstr,
changeIntergerStructSequential, "TestMethodForStructIntergerStructSequential_ReversePInvokeByVal_Cdecl"));
//Chanage the value
argstr.i = 32;
Console.WriteLine("ReversePinvoke,By Value,StdCall");
IntergerStructSequential changeIntergerStructSequential = Helper.NewIntergerStructSequential(64);
//Check the input
- Assert.IsTrue(Helper.ValidateIntergerStructSequential(argstr,
+ Assert.True(Helper.ValidateIntergerStructSequential(argstr,
changeIntergerStructSequential, "TestMethodForStructIntergerStructSequential_ReversePInvokeByVal_StdCall"));
//Chanage the value
argstr.i = 32;
public static extern bool DoCallBack_MarshalStructIntergerStructSequentialByVal_StdCall(IntergerStructSequentialByValStdCallcaller caller);
#region Methods implementation
-
+
//Reverse P/Invoke By Ref
private static void TestMethod_DoCallBack_MarshalStructByRef_Cdecl(StructID structid)
{
{
case StructID.ComplexStructId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructComplexStructByRef_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructComplexStructByRef_Cdecl(new ComplexStructByRefCdeclcaller(TestMethodForStructComplexStruct_ReversePInvokeByRef_Cdecl)));
+ Assert.True(DoCallBack_MarshalStructComplexStructByRef_Cdecl(new ComplexStructByRefCdeclcaller(TestMethodForStructComplexStruct_ReversePInvokeByRef_Cdecl)));
break;
case StructID.InnerSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructInnerSequentialByRef_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructInnerSequentialByRef_Cdecl(new InnerSequentialByRefCdeclcaller(TestMethodForStructInnerSequential_ReversePInvokeByRef_Cdecl)));
+ Assert.True(DoCallBack_MarshalStructInnerSequentialByRef_Cdecl(new InnerSequentialByRefCdeclcaller(TestMethodForStructInnerSequential_ReversePInvokeByRef_Cdecl)));
break;
case StructID.InnerArraySequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructInnerArraySequentialByRef_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructInnerArraySequentialByRef_Cdecl(
+ Assert.True(DoCallBack_MarshalStructInnerArraySequentialByRef_Cdecl(
new InnerArraySequentialByRefCdeclcaller(TestMethodForStructInnerArraySequential_ReversePInvokeByRef_Cdecl)));
break;
case StructID.CharSetAnsiSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructCharSetAnsiSequentialByRef_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructCharSetAnsiSequentialByRef_Cdecl(
+ Assert.True(DoCallBack_MarshalStructCharSetAnsiSequentialByRef_Cdecl(
new CharSetAnsiSequentialByRefCdeclcaller(TestMethodForStructCharSetAnsiSequential_ReversePInvokeByRef_Cdecl)));
break;
case StructID.CharSetUnicodeSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructCharSetUnicodeSequentialByRef_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructCharSetUnicodeSequentialByRef_Cdecl(
+ Assert.True(DoCallBack_MarshalStructCharSetUnicodeSequentialByRef_Cdecl(
new CharSetUnicodeSequentialByRefCdeclcaller(TestMethodForStructCharSetUnicodeSequential_ReversePInvokeByRef_Cdecl)));
break;
case StructID.NumberSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructNumberSequentialByRef_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructNumberSequentialByRef_Cdecl(new NumberSequentialByRefCdeclcaller(TestMethodForStructNumberSequential_ReversePInvokeByRef_Cdecl)));
+ Assert.True(DoCallBack_MarshalStructNumberSequentialByRef_Cdecl(new NumberSequentialByRefCdeclcaller(TestMethodForStructNumberSequential_ReversePInvokeByRef_Cdecl)));
break;
case StructID.S3Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS3ByRef_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructS3ByRef_Cdecl(new S3ByRefCdeclcaller(TestMethodForStructS3_ReversePInvokeByRef_Cdecl)));
+ Assert.True(DoCallBack_MarshalStructS3ByRef_Cdecl(new S3ByRefCdeclcaller(TestMethodForStructS3_ReversePInvokeByRef_Cdecl)));
break;
case StructID.S5Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS5ByRef_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructS5ByRef_Cdecl(new S5ByRefCdeclcaller(TestMethodForStructS5_ReversePInvokeByRef_Cdecl)));
+ Assert.True(DoCallBack_MarshalStructS5ByRef_Cdecl(new S5ByRefCdeclcaller(TestMethodForStructS5_ReversePInvokeByRef_Cdecl)));
break;
case StructID.StringStructSequentialAnsiId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructStringStructSequentialAnsiByRef_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructStringStructSequentialAnsiByRef_Cdecl(
+ Assert.True(DoCallBack_MarshalStructStringStructSequentialAnsiByRef_Cdecl(
new StringStructSequentialAnsiByRefCdeclcaller(TestMethodForStructStringStructSequentialAnsi_ReversePInvokeByRef_Cdecl)));
break;
case StructID.StringStructSequentialUnicodeId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructStringStructSequentialUnicodeByRef_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructStringStructSequentialUnicodeByRef_Cdecl(
+ Assert.True(DoCallBack_MarshalStructStringStructSequentialUnicodeByRef_Cdecl(
new StringStructSequentialUnicodeByRefCdeclcaller(TestMethodForStructStringStructSequentialUnicode_ReversePInvokeByRef_Cdecl)));
break;
case StructID.S8Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS8ByRef_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructS8ByRef_Cdecl(new S8ByRefCdeclcaller(TestMethodForStructS8_ReversePInvokeByRef_Cdecl)));
+ Assert.True(DoCallBack_MarshalStructS8ByRef_Cdecl(new S8ByRefCdeclcaller(TestMethodForStructS8_ReversePInvokeByRef_Cdecl)));
break;
case StructID.S9Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS9ByRef_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructS9ByRef_Cdecl(new S9ByRefCdeclcaller(TestMethodForStructS9_ReversePInvokeByRef_Cdecl)));
+ Assert.True(DoCallBack_MarshalStructS9ByRef_Cdecl(new S9ByRefCdeclcaller(TestMethodForStructS9_ReversePInvokeByRef_Cdecl)));
break;
case StructID.IncludeOuterIntergerStructSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructIncludeOuterIntergerStructSequentialByRef_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructIncludeOuterIntergerStructSequentialByRef_Cdecl(
+ Assert.True(DoCallBack_MarshalStructIncludeOuterIntergerStructSequentialByRef_Cdecl(
new IncludeOuterIntergerStructSequentialByRefCdeclcaller(TestMethodForStructIncludeOuterIntergerStructSequential_ReversePInvokeByRef_Cdecl)));
break;
case StructID.S11Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS11ByRef_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructS11ByRef_Cdecl(new S11ByRefCdeclcaller(TestMethodForStructS11_ReversePInvokeByRef_Cdecl)));
+ Assert.True(DoCallBack_MarshalStructS11ByRef_Cdecl(new S11ByRefCdeclcaller(TestMethodForStructS11_ReversePInvokeByRef_Cdecl)));
break;
default:
- Assert.Fail("DoCallBack_MarshalStructByRef_Cdecl:The structid (Managed Side) is wrong");
+ Assert.True(false, "DoCallBack_MarshalStructByRef_Cdecl:The structid (Managed Side) is wrong");
break;
}
}
{
case StructID.ComplexStructId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructComplexStructByRef_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructComplexStructByRef_StdCall(new ComplexStructByRefStdCallcaller(TestMethodForStructComplexStruct_ReversePInvokeByRef_StdCall)));
+ Assert.True(DoCallBack_MarshalStructComplexStructByRef_StdCall(new ComplexStructByRefStdCallcaller(TestMethodForStructComplexStruct_ReversePInvokeByRef_StdCall)));
break;
case StructID.InnerSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructInnerSequentialByRef_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructInnerSequentialByRef_StdCall(new InnerSequentialByRefStdCallcaller(TestMethodForStructInnerSequential_ReversePInvokeByRef_StdCall)));
+ Assert.True(DoCallBack_MarshalStructInnerSequentialByRef_StdCall(new InnerSequentialByRefStdCallcaller(TestMethodForStructInnerSequential_ReversePInvokeByRef_StdCall)));
break;
case StructID.InnerArraySequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructInnerArraySequentialByRef_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructInnerArraySequentialByRef_StdCall(
+ Assert.True(DoCallBack_MarshalStructInnerArraySequentialByRef_StdCall(
new InnerArraySequentialByRefStdCallcaller(TestMethodForStructInnerArraySequential_ReversePInvokeByRef_StdCall)));
break;
case StructID.CharSetAnsiSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructCharSetAnsiSequentialByRef_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructCharSetAnsiSequentialByRef_StdCall(
+ Assert.True(DoCallBack_MarshalStructCharSetAnsiSequentialByRef_StdCall(
new CharSetAnsiSequentialByRefStdCallcaller(TestMethodForStructCharSetAnsiSequential_ReversePInvokeByRef_StdCall)));
break;
case StructID.CharSetUnicodeSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructCharSetUnicodeSequentialByRef_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructCharSetUnicodeSequentialByRef_StdCall(
+ Assert.True(DoCallBack_MarshalStructCharSetUnicodeSequentialByRef_StdCall(
new CharSetUnicodeSequentialByRefStdCallcaller(TestMethodForStructCharSetUnicodeSequential_ReversePInvokeByRef_StdCall)));
break;
case StructID.NumberSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructNumberSequentialByRef_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructNumberSequentialByRef_StdCall(new NumberSequentialByRefStdCallcaller(TestMethodForStructNumberSequential_ReversePInvokeByRef_StdCall)));
+ Assert.True(DoCallBack_MarshalStructNumberSequentialByRef_StdCall(new NumberSequentialByRefStdCallcaller(TestMethodForStructNumberSequential_ReversePInvokeByRef_StdCall)));
break;
case StructID.S3Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS3ByRef_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructS3ByRef_StdCall(new S3ByRefStdCallcaller(TestMethodForStructS3_ReversePInvokeByRef_StdCall)));
+ Assert.True(DoCallBack_MarshalStructS3ByRef_StdCall(new S3ByRefStdCallcaller(TestMethodForStructS3_ReversePInvokeByRef_StdCall)));
break;
case StructID.S5Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS5ByRef_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructS5ByRef_StdCall(new S5ByRefStdCallcaller(TestMethodForStructS5_ReversePInvokeByRef_StdCall)));
+ Assert.True(DoCallBack_MarshalStructS5ByRef_StdCall(new S5ByRefStdCallcaller(TestMethodForStructS5_ReversePInvokeByRef_StdCall)));
break;
case StructID.StringStructSequentialAnsiId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructStringStructSequentialAnsiByRef_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructStringStructSequentialAnsiByRef_StdCall(
+ Assert.True(DoCallBack_MarshalStructStringStructSequentialAnsiByRef_StdCall(
new StringStructSequentialAnsiByRefStdCallcaller(TestMethodForStructStringStructSequentialAnsi_ReversePInvokeByRef_StdCall)));
break;
case StructID.StringStructSequentialUnicodeId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructStringStructSequentialUnicodeByRef_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructStringStructSequentialUnicodeByRef_StdCall(
+ Assert.True(DoCallBack_MarshalStructStringStructSequentialUnicodeByRef_StdCall(
new StringStructSequentialUnicodeByRefStdCallcaller(TestMethodForStructStringStructSequentialUnicode_ReversePInvokeByRef_StdCall)));
break;
case StructID.S8Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS8ByRef_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructS8ByRef_StdCall(new S8ByRefStdCallcaller(TestMethodForStructS8_ReversePInvokeByRef_StdCall)));
+ Assert.True(DoCallBack_MarshalStructS8ByRef_StdCall(new S8ByRefStdCallcaller(TestMethodForStructS8_ReversePInvokeByRef_StdCall)));
break;
case StructID.S9Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS9ByRef_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructS9ByRef_StdCall(new S9ByRefStdCallcaller(TestMethodForStructS9_ReversePInvokeByRef_StdCall)));
+ Assert.True(DoCallBack_MarshalStructS9ByRef_StdCall(new S9ByRefStdCallcaller(TestMethodForStructS9_ReversePInvokeByRef_StdCall)));
break;
case StructID.IncludeOuterIntergerStructSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructIncludeOuterIntergerStructSequentialByRef_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructIncludeOuterIntergerStructSequentialByRef_StdCall(
+ Assert.True(DoCallBack_MarshalStructIncludeOuterIntergerStructSequentialByRef_StdCall(
new IncludeOuterIntergerStructSequentialByRefStdCallcaller(TestMethodForStructIncludeOuterIntergerStructSequential_ReversePInvokeByRef_StdCall)));
break;
case StructID.S11Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS11ByRef_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructS11ByRef_StdCall(new S11ByRefStdCallcaller(TestMethodForStructS11_ReversePInvokeByRef_StdCall)));
+ Assert.True(DoCallBack_MarshalStructS11ByRef_StdCall(new S11ByRefStdCallcaller(TestMethodForStructS11_ReversePInvokeByRef_StdCall)));
break;
default:
- Assert.Fail("DoCallBack_MarshalStructByRef_StdCall:The structid (Managed Side) is wrong");
+ Assert.True(false, "DoCallBack_MarshalStructByRef_StdCall:The structid (Managed Side) is wrong");
break;
}
}
{
case StructID.ComplexStructId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructComplexeStructByVal_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructComplexStructByVal_Cdecl(new ComplexStructByValCdeclcaller(TestMethodForStructComplexStruct_ReversePInvokeByVal_Cdecl)));
+ Assert.True(DoCallBack_MarshalStructComplexStructByVal_Cdecl(new ComplexStructByValCdeclcaller(TestMethodForStructComplexStruct_ReversePInvokeByVal_Cdecl)));
break;
case StructID.InnerSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructInnerSequentialByVal_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructInnerSequentialByVal_Cdecl(new InnerSequentialByValCdeclcaller(TestMethodForStructInnerSequential_ReversePInvokeByVal_Cdecl)));
+ Assert.True(DoCallBack_MarshalStructInnerSequentialByVal_Cdecl(new InnerSequentialByValCdeclcaller(TestMethodForStructInnerSequential_ReversePInvokeByVal_Cdecl)));
break;
case StructID.InnerArraySequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructInnerArraySequentialByVal_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructInnerArraySequentialByVal_Cdecl(
+ Assert.True(DoCallBack_MarshalStructInnerArraySequentialByVal_Cdecl(
new InnerArraySequentialByValCdeclcaller(TestMethodForStructInnerArraySequential_ReversePInvokeByVal_Cdecl)));
break;
case StructID.CharSetAnsiSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructCharSetAnsiSequentialByVal_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructCharSetAnsiSequentialByVal_Cdecl
+ Assert.True(DoCallBack_MarshalStructCharSetAnsiSequentialByVal_Cdecl
(new CharSetAnsiSequentialByValCdeclcaller(TestMethodForStructCharSetAnsiSequential_ReversePInvokeByVal_Cdecl)));
break;
case StructID.CharSetUnicodeSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructCharSetUnicodeSequentialByVal_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructCharSetUnicodeSequentialByVal_Cdecl(
+ Assert.True(DoCallBack_MarshalStructCharSetUnicodeSequentialByVal_Cdecl(
new CharSetUnicodeSequentialByValCdeclcaller(TestMethodForStructCharSetUnicodeSequential_ReversePInvokeByVal_Cdecl)));
break;
case StructID.NumberSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructNumberSequentialByVal_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructNumberSequentialByVal_Cdecl(new NumberSequentialByValCdeclcaller(TestMethodForStructNumberSequential_ReversePInvokeByVal_Cdecl)));
+ Assert.True(DoCallBack_MarshalStructNumberSequentialByVal_Cdecl(new NumberSequentialByValCdeclcaller(TestMethodForStructNumberSequential_ReversePInvokeByVal_Cdecl)));
break;
case StructID.S3Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS3ByVal_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructS3ByVal_Cdecl(new S3ByValCdeclcaller(TestMethodForStructS3_ReversePInvokeByVal_Cdecl)));
+ Assert.True(DoCallBack_MarshalStructS3ByVal_Cdecl(new S3ByValCdeclcaller(TestMethodForStructS3_ReversePInvokeByVal_Cdecl)));
break;
case StructID.S5Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS5ByVal_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructS5ByVal_Cdecl(new S5ByValCdeclcaller(TestMethodForStructS5_ReversePInvokeByVal_Cdecl)));
+ Assert.True(DoCallBack_MarshalStructS5ByVal_Cdecl(new S5ByValCdeclcaller(TestMethodForStructS5_ReversePInvokeByVal_Cdecl)));
break;
case StructID.StringStructSequentialAnsiId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructStringStructSequentialAnsiByVal_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructStringStructSequentialAnsiByVal_Cdecl(
+ Assert.True(DoCallBack_MarshalStructStringStructSequentialAnsiByVal_Cdecl(
new StringStructSequentialAnsiByValCdeclcaller(TestMethodForStructStringStructSequentialAnsi_ReversePInvokeByVal_Cdecl)));
break;
case StructID.StringStructSequentialUnicodeId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructStringStructSequentialUnicodeByVal_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructStringStructSequentialUnicodeByVal_Cdecl(
+ Assert.True(DoCallBack_MarshalStructStringStructSequentialUnicodeByVal_Cdecl(
new StringStructSequentialUnicodeByValCdeclcaller(TestMethodForStructStringStructSequentialUnicode_ReversePInvokeByVal_Cdecl)));
break;
case StructID.S8Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS8ByVal_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructS8ByVal_Cdecl(new S8ByValCdeclcaller(TestMethodForStructS8_ReversePInvokeByVal_Cdecl)));
+ Assert.True(DoCallBack_MarshalStructS8ByVal_Cdecl(new S8ByValCdeclcaller(TestMethodForStructS8_ReversePInvokeByVal_Cdecl)));
break;
case StructID.S9Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS9ByVal_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructS9ByVal_Cdecl(new S9ByValCdeclcaller(TestMethodForStructS9_ReversePInvokeByVal_Cdecl)));
+ Assert.True(DoCallBack_MarshalStructS9ByVal_Cdecl(new S9ByValCdeclcaller(TestMethodForStructS9_ReversePInvokeByVal_Cdecl)));
break;
case StructID.IncludeOuterIntergerStructSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructIncludeOuterIntergerStructSequentialByVal_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructIncludeOuterIntergerStructSequentialByVal_Cdecl(
+ Assert.True(DoCallBack_MarshalStructIncludeOuterIntergerStructSequentialByVal_Cdecl(
new IncludeOuterIntergerStructSequentialByValCdeclcaller(TestMethodForStructIncludeOuterIntergerStructSequential_ReversePInvokeByVal_Cdecl)));
break;
case StructID.S11Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS11ByVal_Cdecl...");
- Assert.IsTrue(DoCallBack_MarshalStructS11ByVal_Cdecl(new S11ByValCdeclcaller(TestMethodForStructS11_ReversePInvokeByVal_Cdecl)));
+ Assert.True(DoCallBack_MarshalStructS11ByVal_Cdecl(new S11ByValCdeclcaller(TestMethodForStructS11_ReversePInvokeByVal_Cdecl)));
break;
case StructID.ByteStruct3Byte:
Console.WriteLine("Calling DoCallBack_MarshalStructByVal_Cdecl_ByteStruct3Byte...");
- Assert.IsTrue(DoCallBack_MarshalStructByVal_Cdecl_ByteStruct3Byte(
+ Assert.True(DoCallBack_MarshalStructByVal_Cdecl_ByteStruct3Byte(
new ByValCdeclcaller_ByteStruct3Byte(TestMethod_DoCallBack_MarshalStructByVal_ByteStruct3Byte_Cdecl)));
break;
default:
- Assert.Fail("DoCallBack_MarshalStructByVal_Cdecl:The structid (Managed Side) is wrong");
+ Assert.True(false, "DoCallBack_MarshalStructByVal_Cdecl:The structid (Managed Side) is wrong");
break;
}
}
{
case StructID.ComplexStructId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructComplexStructByVal_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructComplexStructByVal_StdCall(new ComplexStructByValStdCallcaller(TestMethodForStructComplexStruct_ReversePInvokeByVal_StdCall)));
+ Assert.True(DoCallBack_MarshalStructComplexStructByVal_StdCall(new ComplexStructByValStdCallcaller(TestMethodForStructComplexStruct_ReversePInvokeByVal_StdCall)));
break;
case StructID.InnerSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructInnerSequentialByVal_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructInnerSequentialByVal_StdCall(new InnerSequentialByValStdCallcaller(TestMethodForStructInnerSequential_ReversePInvokeByVal_StdCall)));
+ Assert.True(DoCallBack_MarshalStructInnerSequentialByVal_StdCall(new InnerSequentialByValStdCallcaller(TestMethodForStructInnerSequential_ReversePInvokeByVal_StdCall)));
break;
case StructID.InnerArraySequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructInnerArraySequentialByVal_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructInnerArraySequentialByVal_StdCall(
+ Assert.True(DoCallBack_MarshalStructInnerArraySequentialByVal_StdCall(
new InnerArraySequentialByValStdCallcaller(TestMethodForStructInnerArraySequential_ReversePInvokeByVal_StdCall)));
break;
case StructID.CharSetAnsiSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructCharSetAnsiSequentialByVal_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructCharSetAnsiSequentialByVal_StdCall(
+ Assert.True(DoCallBack_MarshalStructCharSetAnsiSequentialByVal_StdCall(
new CharSetAnsiSequentialByValStdCallcaller(TestMethodForStructCharSetAnsiSequential_ReversePInvokeByVal_StdCall)));
break;
case StructID.CharSetUnicodeSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructCharSetUnicodeSequentialByVal_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructCharSetUnicodeSequentialByVal_StdCall(
+ Assert.True(DoCallBack_MarshalStructCharSetUnicodeSequentialByVal_StdCall(
new CharSetUnicodeSequentialByValStdCallcaller(TestMethodForStructCharSetUnicodeSequential_ReversePInvokeByVal_StdCall)));
break;
case StructID.NumberSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructNumberSequentialByVal_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructNumberSequentialByVal_StdCall(new NumberSequentialByValStdCallcaller(TestMethodForStructNumberSequential_ReversePInvokeByVal_StdCall)));
+ Assert.True(DoCallBack_MarshalStructNumberSequentialByVal_StdCall(new NumberSequentialByValStdCallcaller(TestMethodForStructNumberSequential_ReversePInvokeByVal_StdCall)));
break;
case StructID.S3Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS3ByVal_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructS3ByVal_StdCall(new S3ByValStdCallcaller(TestMethodForStructS3_ReversePInvokeByVal_StdCall)));
+ Assert.True(DoCallBack_MarshalStructS3ByVal_StdCall(new S3ByValStdCallcaller(TestMethodForStructS3_ReversePInvokeByVal_StdCall)));
break;
case StructID.S5Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS5ByVal_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructS5ByVal_StdCall(new S5ByValStdCallcaller(TestMethodForStructS5_ReversePInvokeByVal_StdCall)));
+ Assert.True(DoCallBack_MarshalStructS5ByVal_StdCall(new S5ByValStdCallcaller(TestMethodForStructS5_ReversePInvokeByVal_StdCall)));
break;
case StructID.StringStructSequentialAnsiId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructStringStructSequentialAnsiByVal_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructStringStructSequentialAnsiByVal_StdCall(
+ Assert.True(DoCallBack_MarshalStructStringStructSequentialAnsiByVal_StdCall(
new StringStructSequentialAnsiByValStdCallcaller(TestMethodForStructStringStructSequentialAnsi_ReversePInvokeByVal_StdCall)));
break;
case StructID.StringStructSequentialUnicodeId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructStringStructSequentialUnicodeByVal_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructStringStructSequentialUnicodeByVal_StdCall(
+ Assert.True(DoCallBack_MarshalStructStringStructSequentialUnicodeByVal_StdCall(
new StringStructSequentialUnicodeByValStdCallcaller(TestMethodForStructStringStructSequentialUnicode_ReversePInvokeByVal_StdCall)));
break;
case StructID.S8Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS8ByVal_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructS8ByVal_StdCall(new S8ByValStdCallcaller(TestMethodForStructS8_ReversePInvokeByVal_StdCall)));
+ Assert.True(DoCallBack_MarshalStructS8ByVal_StdCall(new S8ByValStdCallcaller(TestMethodForStructS8_ReversePInvokeByVal_StdCall)));
break;
case StructID.S9Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS9ByVal_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructS9ByVal_StdCall(new S9ByValStdCallcaller(TestMethodForStructS9_ReversePInvokeByVal_StdCall)));
+ Assert.True(DoCallBack_MarshalStructS9ByVal_StdCall(new S9ByValStdCallcaller(TestMethodForStructS9_ReversePInvokeByVal_StdCall)));
break;
case StructID.IncludeOuterIntergerStructSequentialId:
Console.WriteLine("Calling ReversePInvoke_MarshalStructIncludeOuterIntergerStructSequentialByVal_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructIncludeOuterIntergerStructSequentialByVal_StdCall(
+ Assert.True(DoCallBack_MarshalStructIncludeOuterIntergerStructSequentialByVal_StdCall(
new IncludeOuterIntergerStructSequentialByValStdCallcaller(TestMethodForStructIncludeOuterIntergerStructSequential_ReversePInvokeByVal_StdCall)));
break;
case StructID.S11Id:
Console.WriteLine("Calling ReversePInvoke_MarshalStructS11ByVal_StdCall...");
- Assert.IsTrue(DoCallBack_MarshalStructS11ByVal_StdCall(new S11ByValStdCallcaller(TestMethodForStructS11_ReversePInvokeByVal_StdCall)));
+ Assert.True(DoCallBack_MarshalStructS11ByVal_StdCall(new S11ByValStdCallcaller(TestMethodForStructS11_ReversePInvokeByVal_StdCall)));
break;
case StructID.ByteStruct3Byte:
Console.WriteLine("Calling DoCallBack_MarshalStructByVal_StdCall_ByteStruct3Byte...");
- Assert.IsTrue(DoCallBack_MarshalStructByVal_StdCall_ByteStruct3Byte(
+ Assert.True(DoCallBack_MarshalStructByVal_StdCall_ByteStruct3Byte(
new ByValStdCallcaller_ByteStruct3Byte(TestMethod_DoCallBack_MarshalStructByVal_ByteStruct3Byte_StdCall)));
break;
default:
- Assert.Fail("DoCallBack_MarshalStructByVal_StdCall:The structid (Managed Side) is wrong");
+ Assert.True(false, "DoCallBack_MarshalStructByVal_StdCall:The structid (Managed Side) is wrong");
break;
}
}
TestMethod_DoCallBack_MarshalStructByVal_StdCall(StructID.ByteStruct3Byte);
}
}
-
+
#endregion
static int Main()
{
try{
-
+
//Reverse Pinvoke,ByRef,cdecl
Console.WriteLine("Run the methods for marshaling struct Reverse P/Invoke ByRef");
Run_TestMethod_DoCallBack_MarshalStructByRef_Cdecl();
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe static class SuppressGCTransitionNative
{
Console.WriteLine($"{nameof(Inline_NoGCTransition)} ({expected}) ...");
int n;
int ret = SuppressGCTransitionNative.NextUInt_Inline_NoGCTransition(&n);
- Assert.AreEqual(expected, n);
+ Assert.Equal(expected, n);
CheckGCMode.Validate(transitionSuppressed: true, ret);
return n + 1;
}
Console.WriteLine($"{nameof(Inline_GCTransition)} ({expected}) ...");
int n;
int ret = SuppressGCTransitionNative.NextUInt_Inline_GCTransition(&n);
- Assert.AreEqual(expected, n);
+ Assert.Equal(expected, n);
CheckGCMode.Validate(transitionSuppressed: false, ret);
return n + 1;
}
Console.WriteLine($"{nameof(NoInline_NoGCTransition)} ({expected}) ...");
int n;
bool ret = SuppressGCTransitionNative.NextUInt_NoInline_NoGCTransition(&n);
- Assert.AreEqual(expected, n);
+ Assert.Equal(expected, n);
CheckGCMode.Validate(transitionSuppressed: true, ret);
return n + 1;
}
Console.WriteLine($"{nameof(NoInline_GCTransition)} ({expected}) ...");
int n;
bool ret = SuppressGCTransitionNative.NextUInt_NoInline_GCTransition(&n);
- Assert.AreEqual(expected, n);
+ Assert.Equal(expected, n);
CheckGCMode.Validate(transitionSuppressed: false, ret);
return n + 1;
}
{
bool ret = SuppressGCTransitionNative.NextUInt_NoInline_GCTransition(&n);
- Assert.AreEqual(expected++, n);
+ Assert.Equal(expected++, n);
CheckGCMode.Validate(transitionSuppressed: false, ret);
ret = SuppressGCTransitionNative.NextUInt_NoInline_NoGCTransition(&n);
- Assert.AreEqual(expected++, n);
+ Assert.Equal(expected++, n);
CheckGCMode.Validate(transitionSuppressed: true, ret);
}
{
int ret = SuppressGCTransitionNative.NextUInt_Inline_GCTransition(&n);
- Assert.AreEqual(expected++, n);
+ Assert.Equal(expected++, n);
CheckGCMode.Validate(transitionSuppressed: false, ret);
ret = SuppressGCTransitionNative.NextUInt_Inline_NoGCTransition(&n);
- Assert.AreEqual(expected++, n);
+ Assert.Equal(expected++, n);
CheckGCMode.Validate(transitionSuppressed: true, ret);
}
return n + 1;
// Use the non-optimized version at the end so a GC poll is not
// inserted here as well.
SuppressGCTransitionNative.NextUInt_NoInline_GCTransition(&n);
- Assert.AreEqual(expected + count, n);
+ Assert.Equal(expected + count, n);
return n + 1;
}
[MethodImpl(MethodImplOptions.NoInlining)]
Console.WriteLine($"{nameof(Inline_NoGCTransition)} ({expected}) ...");
int n;
int ret = SuppressGCTransitionNative.GetNextUIntFunctionPointer_Inline_NoGCTransition()(&n);
- Assert.AreEqual(expected, n);
+ Assert.Equal(expected, n);
CheckGCMode.Validate(transitionSuppressed: true, ret);
return n + 1;
}
Console.WriteLine($"{nameof(Inline_GCTransition)} ({expected}) ...");
int n;
int ret = SuppressGCTransitionNative.GetNextUIntFunctionPointer_Inline_GCTransition()(&n);
- Assert.AreEqual(expected, n);
+ Assert.Equal(expected, n);
CheckGCMode.Validate(transitionSuppressed: false, ret);
return n + 1;
}
Console.WriteLine($"{nameof(NoInline_NoGCTransition)} ({expected}) ...");
int n;
bool ret = SuppressGCTransitionNative.GetNextUIntFunctionPointer_NoInline_NoGCTransition()(&n);
- Assert.AreEqual(expected, n);
+ Assert.Equal(expected, n);
CheckGCMode.Validate(transitionSuppressed: true, ret);
return n + 1;
}
Console.WriteLine($"{nameof(NoInline_GCTransition)} ({expected}) ...");
int n;
bool ret = SuppressGCTransitionNative.GetNextUIntFunctionPointer_NoInline_GCTransition()(&n);
- Assert.AreEqual(expected, n);
+ Assert.Equal(expected, n);
CheckGCMode.Validate(transitionSuppressed: false, ret);
return n + 1;
}
MethodInfo callNextUInt = typeof(FunctionPointer).GetMethod("Call_NextUInt");
int ret = (int)callNextUInt.Invoke(null, new object[] { fptr, boxedN });
- Assert.AreEqual(expected, n);
+ Assert.Equal(expected, n);
CheckGCMode.Validate(transitionSuppressed: false, ret);
return n + 1;
}
// Call function with same (blittable) signature, but without SuppressGCTransition.
// IL stub should not be re-used, GC transition should occur, and callback should be invoked.
SuppressGCTransitionNative.InvokeCallbackFuncPtr_Inline_GCTransition(&ReturnInt, &n);
- Assert.AreEqual(expected++, n);
+ Assert.Equal(expected++, n);
// Call function that has SuppressGCTransition
SuppressGCTransitionNative.InvokeCallbackFuncPtr_NoInline_NoGCTransition(null, null);
// Call function with same (non-blittable) signature, but without SuppressGCTransition
// IL stub should not be re-used, GC transition should occur, and callback should be invoked.
SuppressGCTransitionNative.InvokeCallbackFuncPtr_NoInline_GCTransition(&ReturnInt, &n);
- Assert.AreEqual(expected++, n);
+ Assert.Equal(expected++, n);
return n + 1;
}
// Call function that does not have SuppressGCTransition
SuppressGCTransitionNative.InvokeCallbackVoidPtr_Inline_GCTransition(cb, &n);
- Assert.AreEqual(expected++, n);
+ Assert.Equal(expected++, n);
// Call function with same (blittable) signature, but with SuppressGCTransition.
// IL stub should not be re-used, GC transition not should occur, and callback invocation should fail.
SuppressGCTransitionNative.InvokeCallbackVoidPtr_Inline_NoGCTransition(cb, &n);
- Assert.AreEqual(expected++, n);
+ Assert.Equal(expected++, n);
// Call function that does not have SuppressGCTransition
SuppressGCTransitionNative.InvokeCallbackVoidPtr_NoInline_GCTransition(cb, &n);
- Assert.AreEqual(expected++, n);
+ Assert.Equal(expected++, n);
// Call function with same (non-blittable) signature, but with SuppressGCTransition
// IL stub should not be re-used, GC transition not should occur, and callback invocation should fail.
expected = n + 1;
SuppressGCTransitionNative.InvokeCallbackVoidPtr_NoInline_NoGCTransition(cb, &n);
- Assert.AreEqual(expected++, n);
+ Assert.Equal(expected++, n);
return n + 1;
}
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
-using TestLibrary;
+using Xunit;
public unsafe static class PInvokesCS
{
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
-using TestLibrary;
+using Xunit;
public unsafe class Program
{
Console.WriteLine($" -- default: UnmanagedCallConv()");
int b;
PInvokesCS.DefaultDllImport.Default.Blittable_Double_DefaultUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- cdecl: UnmanagedCallConv(cdecl)");
int b;
PInvokesCS.DefaultDllImport.Cdecl.Blittable_Double_CdeclUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- stdcall: UnmanagedCallConv(stdcall)");
int b;
PInvokesCS.DefaultDllImport.Stdcall.Blittable_Double_StdcallUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
if (ValidateMismatch)
Console.WriteLine($" -- default: UnmanagedCallConv()");
int b;
PInvokesCS.DefaultDllImport.Default.NotBlittable_Double_DefaultUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- cdecl: UnmanagedCallConv(cdecl)");
int b;
PInvokesCS.DefaultDllImport.Cdecl.NotBlittable_Double_CdeclUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- stdcall: UnmanagedCallConv(stdcall)");
int b;
PInvokesCS.DefaultDllImport.Stdcall.NotBlittable_Double_StdcallUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
if (ValidateMismatch)
Console.WriteLine($" -- default: UnmanagedCallConv()");
int b;
PInvokesCS.WinapiDllImport.Default.Blittable_Double_DefaultUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- cdecl: UnmanagedCallConv(cdecl)");
int b;
PInvokesCS.WinapiDllImport.Cdecl.Blittable_Double_CdeclUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- stdcall: UnmanagedCallConv(stdcall)");
int b;
PInvokesCS.WinapiDllImport.Stdcall.Blittable_Double_StdcallUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
if (ValidateMismatch)
Console.WriteLine($" -- default: UnmanagedCallConv()");
int b;
PInvokesCS.WinapiDllImport.Default.NotBlittable_Double_DefaultUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- cdecl: UnmanagedCallConv(cdecl)");
int b;
PInvokesCS.WinapiDllImport.Cdecl.NotBlittable_Double_CdeclUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- stdcall: UnmanagedCallConv(stdcall)");
int b;
PInvokesCS.WinapiDllImport.Stdcall.NotBlittable_Double_StdcallUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
if (ValidateMismatch)
Console.WriteLine($" -- default: UnmanagedCallConv()");
int b;
PInvokesIL.UnsetPInvokeImpl.Default.Blittable_Double_DefaultUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- cdecl: UnmanagedCallConv(cdecl)");
int b;
PInvokesIL.UnsetPInvokeImpl.Cdecl.Blittable_Double_CdeclUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- stdcall: UnmanagedCallConv(stdcall)");
int b;
PInvokesIL.UnsetPInvokeImpl.Stdcall.Blittable_Double_StdcallUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
if (ValidateMismatch)
Console.WriteLine($" -- default: UnmanagedCallConv()");
int b;
PInvokesIL.UnsetPInvokeImpl.Default.NotBlittable_Double_DefaultUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- cdecl: UnmanagedCallConv(cdecl)");
int b;
PInvokesIL.UnsetPInvokeImpl.Cdecl.NotBlittable_Double_CdeclUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- stdcall: UnmanagedCallConv(stdcall)");
int b;
PInvokesIL.UnsetPInvokeImpl.Stdcall.NotBlittable_Double_StdcallUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
if (ValidateMismatch)
Console.WriteLine($" -- default: SuppressGCTransition, UnmanagedCallConv()");
int b;
int ret = PInvokesCS.SuppressGCTransition.Default.Blittable_Double_DefaultUnmanagedCallConv_SuppressGCAttr(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
CheckGCMode.Validate(transitionSuppressed: true, ret);
}
{
Console.WriteLine($" -- default: UnmanagedCallConv(suppressgctransition)");
int b;
int ret = PInvokesCS.SuppressGCTransition.Default.Blittable_Double_DefaultUnmanagedCallConv_SuppressGC(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
CheckGCMode.Validate(transitionSuppressed: true, ret);
}
{
Console.WriteLine($" -- cdecl: SuppressGCTransition, UnmanagedCallConv(cdecl)");
int b;
int ret = PInvokesCS.SuppressGCTransition.Cdecl.Blittable_Double_CdeclUnmanagedCallConv_SuppressGCAttr(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
CheckGCMode.Validate(transitionSuppressed: true, ret);
}
{
Console.WriteLine($" -- cdecl: UnmanagedCallConv(cdecl, suppressgctransition)");
int b;
int ret = PInvokesCS.SuppressGCTransition.Cdecl.Blittable_Double_CdeclUnmanagedCallConv_SuppressGC(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
CheckGCMode.Validate(transitionSuppressed: true, ret);
}
{
Console.WriteLine($" -- stdcall: SuppressGCTransition, UnmanagedCallConv(stdcall)");
int b;
int ret = PInvokesCS.SuppressGCTransition.Stdcall.Blittable_Double_StdcallUnmanagedCallConv_SuppressGCAttr(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
CheckGCMode.Validate(transitionSuppressed: true, ret);
}
{
Console.WriteLine($" -- stdcall: UnmanagedCallConv(stdcall, suppressgctransition)");
int b;
int ret = PInvokesCS.SuppressGCTransition.Stdcall.Blittable_Double_StdcallUnmanagedCallConv_SuppressGC(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
CheckGCMode.Validate(transitionSuppressed: true, ret);
}
}
Console.WriteLine($" -- default: SuppressGCTransition, UnmanagedCallConv()");
int b;
bool ret = PInvokesCS.SuppressGCTransition.Default.NotBlittable_Double_DefaultUnmanagedCallConv_SuppressGCAttr(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
CheckGCMode.Validate(transitionSuppressed: true, ret);
}
{
Console.WriteLine($" -- default: UnmanagedCallConv(suppressgctransition)");
int b;
bool ret = PInvokesCS.SuppressGCTransition.Default.NotBlittable_Double_DefaultUnmanagedCallConv_SuppressGC(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
CheckGCMode.Validate(transitionSuppressed: true, ret);
}
{
Console.WriteLine($" -- cdecl: SuppressGCTransition, UnmanagedCallConv(cdecl)");
int b;
bool ret = PInvokesCS.SuppressGCTransition.Cdecl.NotBlittable_Double_CdeclUnmanagedCallConv_SuppressGCAttr(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
CheckGCMode.Validate(transitionSuppressed: true, ret);
}
{
Console.WriteLine($" -- cdecl: UnmanagedCallConv(cdecl, suppressgctransition)");
int b;
bool ret = PInvokesCS.SuppressGCTransition.Cdecl.NotBlittable_Double_CdeclUnmanagedCallConv_SuppressGC(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
CheckGCMode.Validate(transitionSuppressed: true, ret);
}
{
Console.WriteLine($" -- stdcall: SuppressGCTransition, UnmanagedCallConv(stdcall)");
int b;
bool ret = PInvokesCS.SuppressGCTransition.Stdcall.NotBlittable_Double_StdcallUnmanagedCallConv_SuppressGCAttr(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
CheckGCMode.Validate(transitionSuppressed: true, ret);
}
{
Console.WriteLine($" -- stdcall: UnmanagedCallConv(stdcall, suppressgctransition)");
int b;
bool ret = PInvokesCS.SuppressGCTransition.Stdcall.NotBlittable_Double_StdcallUnmanagedCallConv_SuppressGC(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
CheckGCMode.Validate(transitionSuppressed: true, ret);
}
}
Console.WriteLine($" -- cdecl: UnmanagedCallConv(stdcall)");
int b;
PInvokesCS.MatchingDllImport.Cdecl.Blittable_Double_StdcallUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
// Should not suppress GC transition
Console.WriteLine($" -- cdecl: UnmanagedCallConv(suppressgctransition)");
int b;
int ret = PInvokesCS.MatchingDllImport.Cdecl.Blittable_Double_SuppressGCUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
CheckGCMode.Validate(transitionSuppressed: false, ret);
}
{
Console.WriteLine($" -- stdcall: UnmanagedCallConv(cdecl)");
int b;
PInvokesCS.MatchingDllImport.Stdcall.Blittable_Double_CdeclUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
// Should not suppress GC transition
Console.WriteLine($" -- stdcall: UnmanagedCallConv(suppressgctransition)");
int b;
int ret = PInvokesCS.MatchingDllImport.Stdcall.Blittable_Double_SuppressGCUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
CheckGCMode.Validate(transitionSuppressed: false, ret);
}
}
Console.WriteLine($" -- cdecl: UnmanagedCallConv(stdcall)");
int b;
PInvokesCS.MatchingDllImport.Cdecl.NotBlittable_Double_StdcallUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
// Should not suppress GC transition
Console.WriteLine($" -- cdecl: UnmanagedCallConv(suppressgctransition)");
int b;
bool ret = PInvokesCS.MatchingDllImport.Cdecl.NotBlittable_Double_SuppressGCUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
CheckGCMode.Validate(transitionSuppressed: false, ret);
}
{
Console.WriteLine($" -- stdcall: UnmanagedCallConv(cdecl)");
int b;
PInvokesCS.MatchingDllImport.Stdcall.NotBlittable_Double_CdeclUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
// Should not suppress GC transition
Console.WriteLine($" -- stdcall: UnmanagedCallConv(suppressgctransition)");
int b;
bool ret = PInvokesCS.MatchingDllImport.Stdcall.NotBlittable_Double_SuppressGCUnmanagedCallConv(a, &b);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
CheckGCMode.Validate(transitionSuppressed: false, ret);
}
}
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
-using TestLibrary;
+using Xunit;
using InvalidCSharp;
public unsafe class Program
public static void TestUnmanagedCallersOnlyValid()
{
Console.WriteLine($"Running {nameof(TestUnmanagedCallersOnlyValid)}...");
-
+
int n = 12345;
int expected = DoubleImpl(n);
- Assert.AreEqual(expected, UnmanagedCallersOnlyDll.CallManagedProc((IntPtr)(delegate* unmanaged<int, int>)&ManagedDoubleCallback, n));
+ Assert.Equal(expected, UnmanagedCallersOnlyDll.CallManagedProc((IntPtr)(delegate* unmanaged<int, int>)&ManagedDoubleCallback, n));
}
public static void TestUnmanagedCallersOnlyValid_OnNewNativeThread()
{
Console.WriteLine($"Running {nameof(TestUnmanagedCallersOnlyValid_OnNewNativeThread)}...");
-
+
int n = 12345;
int expected = DoubleImpl(n);
- Assert.AreEqual(expected, UnmanagedCallersOnlyDll.CallManagedProcOnNewThread((IntPtr)(delegate* unmanaged<int, int>)&ManagedDoubleCallback, n));
+ Assert.Equal(expected, UnmanagedCallersOnlyDll.CallManagedProcOnNewThread((IntPtr)(delegate* unmanaged<int, int>)&ManagedDoubleCallback, n));
}
[UnmanagedCallersOnly]
{
expected += DoubleImpl(n);
}
- Assert.AreEqual(expected, UnmanagedCallersOnlyDll.CallManagedProcMultipleTimes(callCount, (IntPtr)(delegate* unmanaged<int, int>)&ManagedDoubleInNativeCallback, n));
+ Assert.Equal(expected, UnmanagedCallersOnlyDll.CallManagedProcMultipleTimes(callCount, (IntPtr)(delegate* unmanaged<int, int>)&ManagedDoubleInNativeCallback, n));
}
private const int CallbackThrowsErrorCode = 27;
int n = 12345;
// Method should have thrown and caught an exception.
- Assert.AreEqual(-1, UnmanagedCallersOnlyDll.CallManagedProcCatchException((IntPtr)(delegate* unmanaged<int, int>)&CallbackThrows, n));
+ Assert.Equal(-1, UnmanagedCallersOnlyDll.CallManagedProcCatchException((IntPtr)(delegate* unmanaged<int, int>)&CallbackThrows, n));
}
public static void NegativeTest_ViaDelegate()
[UnmanagedCallersOnly]
public static int CallbackMethodNonBlittable(bool x1)
{
- Assert.Fail($"Functions with attribute {nameof(UnmanagedCallersOnlyAttribute)} cannot have non-blittable arguments");
+ Assert.True(false, $"Functions with attribute {nameof(UnmanagedCallersOnlyAttribute)} cannot have non-blittable arguments");
return -1;
}
public static void NegativeTest_InstantiatedGenericArguments()
{
Console.WriteLine($"Running {nameof(NegativeTest_InstantiatedGenericArguments)}...");
-
+
int n = 12345;
// Try invoking method
Assert.Throws<InvalidProgramException>(() => { UnmanagedCallersOnlyDll.CallManagedProc((IntPtr)(delegate* unmanaged<int, int>)&Callbacks.CallbackMethodGeneric<int>, n); });
[UnmanagedCallersOnly]
public static void CallbackViaCalli(int val)
{
- Assert.Fail($"Functions with attribute {nameof(UnmanagedCallersOnlyAttribute)} cannot be called via calli");
+ Assert.True(false, $"Functions with attribute {nameof(UnmanagedCallersOnlyAttribute)} cannot be called via calli");
}
public static void NegativeTest_ViaCalli()
int n = 1234;
int expected = DoubleImpl(n);
delegate* unmanaged[Stdcall]<int, int> nativeMethod = &CallbackViaUnmanagedCalli;
- Assert.AreEqual(expected, nativeMethod(n));
+ Assert.Equal(expected, nativeMethod(n));
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })]
try
{
testNativeMethod(n);
- Assert.Fail($"Function {nameof(CallbackViaUnmanagedCalliThrows)} should throw");
+ Assert.True(false, $"Function {nameof(CallbackViaUnmanagedCalliThrows)} should throw");
}
catch (Exception e)
{
- Assert.AreEqual(CallbackThrowsErrorCode, e.HResult);
+ Assert.Equal(CallbackThrowsErrorCode, e.HResult);
}
}
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices.WindowsRuntime;
-using TestLibrary;
+using Xunit;
namespace WinRT
{
using System.Reflection;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe internal class CheckGCMode
{
if (!Enabled)
return;
- Assert.AreEqual(transitionSuppressed, inCooperativeMode, $"GC transition should{(transitionSuppressed ? "" : " not")} have been suppressed");
+ Assert.Equal(transitionSuppressed, inCooperativeMode);
}
internal static void Validate(bool transitionSuppressed, int inCooperativeMode)
using System;
using System.Reflection;
using System.Text;
-using TestLibrary;
+using Xunit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
{
CdeclMemberFunctionNative.SizeF result = instance->vtable->getSize(instance, 1234);
- Assert.AreEqual(instance->width, result.width);
- Assert.AreEqual(instance->height, result.height);
+ Assert.Equal(instance->width, result.width);
+ Assert.Equal(instance->height, result.height);
}
private static void Test4ByteHFA(CdeclMemberFunctionNative.C* instance)
{
CdeclMemberFunctionNative.Width result = instance->vtable->getWidth(instance);
- Assert.AreEqual(instance->width, result.width);
+ Assert.Equal(instance->width, result.width);
}
private static void Test4ByteNonHFA(CdeclMemberFunctionNative.C* instance)
{
CdeclMemberFunctionNative.IntWrapper result = instance->vtable->getHeightAsInt(instance);
- Assert.AreEqual((int)instance->height, result.i);
+ Assert.Equal((int)instance->height, result.i);
}
private static void TestEnum(CdeclMemberFunctionNative.C* instance)
{
CdeclMemberFunctionNative.E result = instance->vtable->getE(instance);
- Assert.AreEqual(instance->dummy, result);
+ Assert.Equal(instance->dummy, result);
}
private static void TestCLong(CdeclMemberFunctionNative.C* instance)
{
CLong result = instance->vtable->getWidthAsLong(instance);
- Assert.AreEqual((nint)instance->width, result.Value);
+ Assert.Equal((nint)instance->width, result.Value);
}
private static void Test8ByteHFAUnmanagedCallersOnly()
CdeclMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
CdeclMemberFunctionNative.SizeF result = CdeclMemberFunctionNative.GetSizeFromManaged(&c);
- Assert.AreEqual(c.width, result.width);
- Assert.AreEqual(c.height, result.height);
+ Assert.Equal(c.width, result.width);
+ Assert.Equal(c.height, result.height);
}
private static void Test4ByteHFAUnmanagedCallersOnly()
CdeclMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
CdeclMemberFunctionNative.Width result = CdeclMemberFunctionNative.GetWidthFromManaged(&c);
- Assert.AreEqual(c.width, result.width);
+ Assert.Equal(c.width, result.width);
}
private static void Test4ByteNonHFAUnmanagedCallersOnly()
CdeclMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
CdeclMemberFunctionNative.IntWrapper result = CdeclMemberFunctionNative.GetHeightAsIntFromManaged(&c);
- Assert.AreEqual((int)c.height, result.i);
+ Assert.Equal((int)c.height, result.i);
}
private static void TestEnumUnmanagedCallersOnly()
CdeclMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
CdeclMemberFunctionNative.E result = CdeclMemberFunctionNative.GetEFromManaged(&c);
- Assert.AreEqual(c.dummy, result);
+ Assert.Equal(c.dummy, result);
}
private static void TestCLongUnmanagedCallersOnly()
CdeclMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
CLong result = CdeclMemberFunctionNative.GetWidthAsLongFromManaged(&c);
- Assert.AreEqual((nint)c.width, result.Value);
+ Assert.Equal((nint)c.width, result.Value);
}
private static CdeclMemberFunctionNative.C CreateCWithUnmanagedCallersOnlyVTable(float width, float height)
using System;
using System.Reflection;
using System.Text;
-using TestLibrary;
+using Xunit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
{
PlatformDefaultMemberFunctionNative.SizeF result = instance->vtable->getSize(instance, 1234);
- Assert.AreEqual(instance->width, result.width);
- Assert.AreEqual(instance->height, result.height);
+ Assert.Equal(instance->width, result.width);
+ Assert.Equal(instance->height, result.height);
}
private static void Test4ByteHFA(PlatformDefaultMemberFunctionNative.C* instance)
{
PlatformDefaultMemberFunctionNative.Width result = instance->vtable->getWidth(instance);
- Assert.AreEqual(instance->width, result.width);
+ Assert.Equal(instance->width, result.width);
}
private static void Test4ByteNonHFA(PlatformDefaultMemberFunctionNative.C* instance)
{
PlatformDefaultMemberFunctionNative.IntWrapper result = instance->vtable->getHeightAsInt(instance);
- Assert.AreEqual((int)instance->height, result.i);
+ Assert.Equal((int)instance->height, result.i);
}
private static void TestEnum(PlatformDefaultMemberFunctionNative.C* instance)
{
PlatformDefaultMemberFunctionNative.E result = instance->vtable->getE(instance);
- Assert.AreEqual(instance->dummy, result);
+ Assert.Equal(instance->dummy, result);
}
private static void TestCLong(PlatformDefaultMemberFunctionNative.C* instance)
{
CLong result = instance->vtable->getWidthAsLong(instance);
- Assert.AreEqual((nint)instance->width, result.Value);
+ Assert.Equal((nint)instance->width, result.Value);
}
private static void Test8ByteHFAUnmanagedCallersOnly()
PlatformDefaultMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
PlatformDefaultMemberFunctionNative.SizeF result = PlatformDefaultMemberFunctionNative.GetSizeFromManaged(&c);
- Assert.AreEqual(c.width, result.width);
- Assert.AreEqual(c.height, result.height);
+ Assert.Equal(c.width, result.width);
+ Assert.Equal(c.height, result.height);
}
private static void Test4ByteHFAUnmanagedCallersOnly()
PlatformDefaultMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
PlatformDefaultMemberFunctionNative.Width result = PlatformDefaultMemberFunctionNative.GetWidthFromManaged(&c);
- Assert.AreEqual(c.width, result.width);
+ Assert.Equal(c.width, result.width);
}
private static void Test4ByteNonHFAUnmanagedCallersOnly()
PlatformDefaultMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
PlatformDefaultMemberFunctionNative.IntWrapper result = PlatformDefaultMemberFunctionNative.GetHeightAsIntFromManaged(&c);
- Assert.AreEqual((int)c.height, result.i);
+ Assert.Equal((int)c.height, result.i);
}
private static void TestEnumUnmanagedCallersOnly()
PlatformDefaultMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
PlatformDefaultMemberFunctionNative.E result = PlatformDefaultMemberFunctionNative.GetEFromManaged(&c);
- Assert.AreEqual(c.dummy, result);
+ Assert.Equal(c.dummy, result);
}
private static void TestCLongUnmanagedCallersOnly()
PlatformDefaultMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
CLong result = PlatformDefaultMemberFunctionNative.GetWidthAsLongFromManaged(&c);
- Assert.AreEqual((nint)c.width, result.Value);
+ Assert.Equal((nint)c.width, result.Value);
}
private static PlatformDefaultMemberFunctionNative.C CreateCWithUnmanagedCallersOnlyVTable(float width, float height)
using System;
using System.Reflection;
using System.Text;
-using TestLibrary;
+using Xunit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
{
StdCallMemberFunctionNative.SizeF result = instance->vtable->getSize(instance, 1234);
- Assert.AreEqual(instance->width, result.width);
- Assert.AreEqual(instance->height, result.height);
+ Assert.Equal(instance->width, result.width);
+ Assert.Equal(instance->height, result.height);
}
private static void Test4ByteHFA(StdCallMemberFunctionNative.C* instance)
{
StdCallMemberFunctionNative.Width result = instance->vtable->getWidth(instance);
- Assert.AreEqual(instance->width, result.width);
+ Assert.Equal(instance->width, result.width);
}
private static void Test4ByteNonHFA(StdCallMemberFunctionNative.C* instance)
{
StdCallMemberFunctionNative.IntWrapper result = instance->vtable->getHeightAsInt(instance);
- Assert.AreEqual((int)instance->height, result.i);
+ Assert.Equal((int)instance->height, result.i);
}
private static void TestEnum(StdCallMemberFunctionNative.C* instance)
{
StdCallMemberFunctionNative.E result = instance->vtable->getE(instance);
- Assert.AreEqual(instance->dummy, result);
+ Assert.Equal(instance->dummy, result);
}
private static void TestCLong(StdCallMemberFunctionNative.C* instance)
{
CLong result = instance->vtable->getWidthAsLong(instance);
- Assert.AreEqual((nint)instance->width, result.Value);
+ Assert.Equal((nint)instance->width, result.Value);
}
private static void Test8ByteHFAUnmanagedCallersOnly()
{
StdCallMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
StdCallMemberFunctionNative.SizeF result = StdCallMemberFunctionNative.GetSizeFromManaged(&c);
- Assert.AreEqual(c.width, result.width);
- Assert.AreEqual(c.height, result.height);
+ Assert.Equal(c.width, result.width);
+ Assert.Equal(c.height, result.height);
}
private static void Test4ByteHFAUnmanagedCallersOnly()
StdCallMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
StdCallMemberFunctionNative.Width result = StdCallMemberFunctionNative.GetWidthFromManaged(&c);
- Assert.AreEqual(c.width, result.width);
+ Assert.Equal(c.width, result.width);
}
private static void Test4ByteNonHFAUnmanagedCallersOnly()
StdCallMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
StdCallMemberFunctionNative.IntWrapper result = StdCallMemberFunctionNative.GetHeightAsIntFromManaged(&c);
- Assert.AreEqual((int)c.height, result.i);
+ Assert.Equal((int)c.height, result.i);
}
private static void TestEnumUnmanagedCallersOnly()
StdCallMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
StdCallMemberFunctionNative.E result = StdCallMemberFunctionNative.GetEFromManaged(&c);
- Assert.AreEqual(c.dummy, result);
+ Assert.Equal(c.dummy, result);
}
private static void TestCLongUnmanagedCallersOnly()
StdCallMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
CLong result = StdCallMemberFunctionNative.GetWidthAsLongFromManaged(&c);
- Assert.AreEqual((nint)c.width, result.Value);
+ Assert.Equal((nint)c.width, result.Value);
}
private static StdCallMemberFunctionNative.C CreateCWithUnmanagedCallersOnlyVTable(float width, float height)
using System;
using System.Reflection;
using System.Text;
-using TestLibrary;
+using Xunit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
ThisCallNative.SizeF result = callback(instance, 1234);
- Assert.AreEqual(instance->width, result.width);
- Assert.AreEqual(instance->height, result.height);
+ Assert.Equal(instance->width, result.width);
+ Assert.Equal(instance->height, result.height);
}
private static void Test4ByteHFA(ThisCallNative.C* instance)
ThisCallNative.Width result = callback(instance);
- Assert.AreEqual(instance->width, result.width);
+ Assert.Equal(instance->width, result.width);
}
private static void Test4ByteNonHFA(ThisCallNative.C* instance)
ThisCallNative.IntWrapper result = callback(instance);
- Assert.AreEqual((int)instance->height, result.i);
+ Assert.Equal((int)instance->height, result.i);
}
private static void TestEnum(ThisCallNative.C* instance)
ThisCallNative.E result = callback(instance);
- Assert.AreEqual(instance->dummy, result);
+ Assert.Equal(instance->dummy, result);
}
private static void TestCLong(ThisCallNative.C* instance)
CLong result = callback(instance);
- Assert.AreEqual((nint)instance->width, result.Value);
+ Assert.Equal((nint)instance->width, result.Value);
}
private static void Test8ByteHFAReverse()
ThisCallNative.C c = CreateCWithManagedVTable(2.0f, 3.0f);
ThisCallNative.SizeF result = ThisCallNative.GetSizeFromManaged(&c);
- Assert.AreEqual(c.width, result.width);
- Assert.AreEqual(c.height, result.height);
+ Assert.Equal(c.width, result.width);
+ Assert.Equal(c.height, result.height);
}
private static void Test4ByteHFAReverse()
ThisCallNative.C c = CreateCWithManagedVTable(2.0f, 3.0f);
ThisCallNative.Width result = ThisCallNative.GetWidthFromManaged(&c);
- Assert.AreEqual(c.width, result.width);
+ Assert.Equal(c.width, result.width);
}
private static void Test4ByteNonHFAReverse()
ThisCallNative.C c = CreateCWithManagedVTable(2.0f, 3.0f);
ThisCallNative.IntWrapper result = ThisCallNative.GetHeightAsIntFromManaged(&c);
- Assert.AreEqual((int)c.height, result.i);
+ Assert.Equal((int)c.height, result.i);
}
private static void TestEnumReverse()
ThisCallNative.C c = CreateCWithManagedVTable(2.0f, 3.0f);
ThisCallNative.E result = ThisCallNative.GetEFromManaged(&c);
- Assert.AreEqual(c.dummy, result);
+ Assert.Equal(c.dummy, result);
}
private static void TestCLongReverse()
ThisCallNative.C c = CreateCWithManagedVTable(2.0f, 3.0f);
CLong result = ThisCallNative.GetWidthAsLongFromManaged(&c);
- Assert.AreEqual((nint)c.width, result.Value);
+ Assert.Equal((nint)c.width, result.Value);
}
private static void Test8ByteHFAUnmanagedCallersOnly()
ThisCallNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
ThisCallNative.SizeF result = ThisCallNative.GetSizeFromManaged(&c);
- Assert.AreEqual(c.width, result.width);
- Assert.AreEqual(c.height, result.height);
+ Assert.Equal(c.width, result.width);
+ Assert.Equal(c.height, result.height);
}
private static void Test4ByteHFAUnmanagedCallersOnly()
ThisCallNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
ThisCallNative.Width result = ThisCallNative.GetWidthFromManaged(&c);
- Assert.AreEqual(c.width, result.width);
+ Assert.Equal(c.width, result.width);
}
private static void Test4ByteNonHFAUnmanagedCallersOnly()
ThisCallNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
ThisCallNative.IntWrapper result = ThisCallNative.GetHeightAsIntFromManaged(&c);
- Assert.AreEqual((int)c.height, result.i);
+ Assert.Equal((int)c.height, result.i);
}
private static void TestEnumUnmanagedCallersOnly()
ThisCallNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
ThisCallNative.E result = ThisCallNative.GetEFromManaged(&c);
- Assert.AreEqual(c.dummy, result);
+ Assert.Equal(c.dummy, result);
}
private static void TestCLongUnmanagedCallersOnly()
ThisCallNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
CLong result = ThisCallNative.GetWidthAsLongFromManaged(&c);
- Assert.AreEqual((nint)c.width, result.Value);
+ Assert.Equal((nint)c.width, result.Value);
}
private static ThisCallNative.C CreateCWithManagedVTable(float width, float height)
using TestLibrary;
using Xunit;
-using Assert = Xunit.Assert;
-
namespace AssemblyDependencyResolverTests
{
class AssemblyDependencyResolverTests : TestBase
const string errorMessageFirstLine = "First line: failure";
const string errorMessageSecondLine = "Second line: value";
- using (HostPolicyMock.MockValues_corehost_set_error_writer errorWriterMock =
+ using (HostPolicyMock.MockValues_corehost_set_error_writer errorWriterMock =
HostPolicyMock.Mock_corehost_set_error_writer())
{
- using (HostPolicyMock.MockValues_corehost_resolve_component_dependencies resolverMock =
+ using (HostPolicyMock.MockValues_corehost_resolve_component_dependencies resolverMock =
HostPolicyMock.Mock_corehost_resolve_component_dependencies(
134,
"",
public void TestComponentLoadFailureWithPreviousErrorWriter()
{
IntPtr previousWriter = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(
- (HostPolicyMock.ErrorWriterDelegate)((string _) => { Assert.True(false, "Should never get here"); }));
+ (HostPolicyMock.ErrorWriterDelegate)((string _) => { Assert.True(false); }));
using (HostPolicyMock.MockValues_corehost_set_error_writer errorWriterMock =
HostPolicyMock.Mock_corehost_set_error_writer(previousWriter))
string assemblyDependencyPath = CreateMockAssembly("AssemblyDependency.dll");
IntPtr previousWriter = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(
- (HostPolicyMock.ErrorWriterDelegate)((string _) => { Assert.True(false, "Should never get here"); }));
+ (HostPolicyMock.ErrorWriterDelegate)((string _) => { Assert.True(false); }));
using (HostPolicyMock.MockValues_corehost_set_error_writer errorWriterMock =
HostPolicyMock.Mock_corehost_set_error_writer(previousWriter))
using TestLibrary;
using Xunit;
-using Assert = Xunit.Assert;
-
namespace AssemblyDependencyResolverTests
{
class NativeDependencyTests : TestBase
using System;
using System.IO;
using System.Runtime.Loader;
-using TestLibrary;
using Xunit;
-using Assert = Xunit.Assert;
-
namespace AssemblyDependencyResolverTests
{
class InvalidHostingTest
- {
+ {
public static int Main(string [] args)
{
try
Directory.CreateDirectory(componentDirectory);
string componentAssemblyPath = Path.Combine(componentDirectory, "InvalidHostingComponent.dll");
File.WriteAllText(componentAssemblyPath, "Mock assembly");
-
+
object innerException = Assert.Throws<InvalidOperationException>(() =>
{
AssemblyDependencyResolver resolver = new AssemblyDependencyResolver(
using System.Runtime.Loader;
using System.Runtime.Remoting;
using System.Threading.Tasks;
-using TestLibrary;
+using Xunit;
namespace ContextualReflectionTest
{
defaultAssembly = Assembly.GetExecutingAssembly();
alcAssembly = alc.LoadFromAssemblyPath(defaultAssembly.Location);
- Assert.AreEqual(alcAssembly, alc.LoadFromAssemblyName(alcAssembly.GetName()));
+ Assert.Equal(alcAssembly, alc.LoadFromAssemblyName(alcAssembly.GetName()));
alcProgramType = alcAssembly.GetType("ContextualReflectionTest.Program");
void VerifyIsolationDefault()
{
VerifyIsolation();
- Assert.AreEqual(defaultAssembly, Assembly.GetExecutingAssembly());
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(Assembly.GetExecutingAssembly()));
- Assert.AreNotEqual(alcProgramType, typeof(Program));
- Assert.AreNotEqual((object)alcProgramInstance, (object)this);
+ Assert.Equal(defaultAssembly, Assembly.GetExecutingAssembly());
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(Assembly.GetExecutingAssembly()));
+ Assert.NotEqual(alcProgramType, typeof(Program));
+ Assert.NotEqual((object)alcProgramInstance, (object)this);
}
void VerifyIsolationAlc()
{
VerifyIsolation();
- Assert.AreEqual(alcAssembly, Assembly.GetExecutingAssembly());
- Assert.AreEqual(alc, AssemblyLoadContext.GetLoadContext(Assembly.GetExecutingAssembly()));
- Assert.AreEqual(alcProgramType, typeof(Program));
- Assert.AreEqual((object)alcProgramInstance, (object)this);
+ Assert.Equal(alcAssembly, Assembly.GetExecutingAssembly());
+ Assert.Equal(alc, AssemblyLoadContext.GetLoadContext(Assembly.GetExecutingAssembly()));
+ Assert.Equal(alcProgramType, typeof(Program));
+ Assert.Equal((object)alcProgramInstance, (object)this);
}
void VerifyIsolation()
{
- Assert.AreEqual("Default", AssemblyLoadContext.Default.Name);
+ Assert.Equal("Default", AssemblyLoadContext.Default.Name);
- Assert.IsNotNull(alc);
- Assert.IsNotNull(alcAssembly);
- Assert.IsNotNull(alcProgramType);
- Assert.IsNotNull(alcProgramInstance);
+ Assert.NotNull(alc);
+ Assert.NotNull(alcAssembly);
+ Assert.NotNull(alcProgramType);
+ Assert.NotNull(alcProgramInstance);
- Assert.AreEqual("Isolated", alc.Name);
+ Assert.Equal("Isolated", alc.Name);
- Assert.AreNotEqual(defaultAssembly, alcAssembly);
- Assert.AreNotEqual(alc, AssemblyLoadContext.Default);
+ Assert.NotEqual(defaultAssembly, alcAssembly);
+ Assert.NotEqual(alc, AssemblyLoadContext.Default);
- Assert.AreEqual(alc, AssemblyLoadContext.GetLoadContext(alcProgramInstance.alcAssembly));
- Assert.AreEqual(alcAssembly, alcProgramInstance.alcAssembly);
- Assert.AreEqual(alcProgramType, alcProgramInstance.alcProgramType);
- Assert.AreEqual(alcProgramInstance, alcProgramInstance.alcProgramInstance);
+ Assert.Equal(alc, AssemblyLoadContext.GetLoadContext(alcProgramInstance.alcAssembly));
+ Assert.Equal(alcAssembly, alcProgramInstance.alcAssembly);
+ Assert.Equal(alcProgramType, alcProgramInstance.alcProgramType);
+ Assert.Equal(alcProgramInstance, alcProgramInstance.alcProgramInstance);
}
void VerifyTestResolve()
void VerifyContextualReflectionProxy()
{
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
using (alc.EnterContextualReflection())
{
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
using (AssemblyLoadContext.Default.EnterContextualReflection())
{
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.CurrentContextualReflectionContext);
using (AssemblyLoadContext.EnterContextualReflection(null))
{
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
using (AssemblyLoadContext.EnterContextualReflection(alcAssembly))
{
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
}
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
}
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.CurrentContextualReflectionContext);
}
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
}
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
}
void VerifyUsingStatementContextualReflectionUsage()
{
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
{
using IDisposable alcScope = alc.EnterContextualReflection();
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
}
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
{
using IDisposable alcScope = alc.EnterContextualReflection();
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
alcScope.Dispose();
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
}
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
{
using IDisposable alcScope = alc.EnterContextualReflection();
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
alcScope.Dispose();
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
alcScope.Dispose();
}
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
{
using IDisposable alcScope = alc.EnterContextualReflection();
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
{
using IDisposable defaultScope = AssemblyLoadContext.Default.EnterContextualReflection();
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.CurrentContextualReflectionContext);
}
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
}
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
{
using IDisposable alcScope = alc.EnterContextualReflection();
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
try
{
using IDisposable defaultScope = AssemblyLoadContext.Default.EnterContextualReflection();
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.CurrentContextualReflectionContext);
throw new InvalidOperationException();
}
catch
{
}
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
}
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
{
using IDisposable alcScope = alc.EnterContextualReflection();
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
using IDisposable defaultScope = AssemblyLoadContext.Default.EnterContextualReflection();
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.CurrentContextualReflectionContext);
defaultScope.Dispose();
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
alcScope.Dispose();
}
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
}
void VerifyBadContextualReflectionUsage()
{
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
{
IDisposable alcScope = alc.EnterContextualReflection();
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
alcScope.Dispose();
}
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
{
IDisposable alcScope = alc.EnterContextualReflection();
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
alcScope.Dispose();
alcScope.Dispose();
}
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
{
IDisposable alcScope = alc.EnterContextualReflection();
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
IDisposable defaultScope = AssemblyLoadContext.Default.EnterContextualReflection();
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.CurrentContextualReflectionContext);
defaultScope.Dispose();
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
alcScope.Dispose();
}
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
{
IDisposable alcScope = alc.EnterContextualReflection();
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
IDisposable defaultScope = AssemblyLoadContext.Default.EnterContextualReflection();
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.CurrentContextualReflectionContext);
alcScope.Dispose();
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
defaultScope.Dispose();
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
alcScope.Dispose();
}
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
{
IDisposable alcScope = alc.EnterContextualReflection();
- Assert.AreEqual(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(alc, AssemblyLoadContext.CurrentContextualReflectionContext);
try
{
IDisposable defaultScope = AssemblyLoadContext.EnterContextualReflection(null);
- Assert.AreEqual(null, AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Equal(null, AssemblyLoadContext.CurrentContextualReflectionContext);
throw new InvalidOperationException();
}
}
}
- Assert.IsNull(AssemblyLoadContext.CurrentContextualReflectionContext);
+ Assert.Null(AssemblyLoadContext.CurrentContextualReflectionContext);
}
void TestResolveMissingAssembly(bool isolated, Action<string> action, bool skipNullIsolated = false)
{
Assembly assembly = assemblyLoad("ContextualReflection");
- Assert.AreEqual(isolated ? alc : AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(assembly));
+ Assert.Equal(isolated ? alc : AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(assembly));
Assembly depends = assemblyLoad("ContextualReflectionDependency");
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(depends));
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(depends));
}
using (AssemblyLoadContext.Default.EnterContextualReflection())
{
Assembly assembly = assemblyLoad("ContextualReflection");
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(assembly));
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(assembly));
Assembly depends = assemblyLoad("ContextualReflectionDependency");
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(depends));
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(depends));
}
using (alc.EnterContextualReflection())
{
Assembly assembly = assemblyLoad("ContextualReflection");
- Assert.AreEqual(alc, AssemblyLoadContext.GetLoadContext(assembly));
+ Assert.Equal(alc, AssemblyLoadContext.GetLoadContext(assembly));
Assembly depends = assemblyLoad("ContextualReflectionDependency");
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(depends));
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(depends));
}
}
Assembly expectedAssembly = Assembly.GetExecutingAssembly();
- Assert.IsNotNull(p);
- Assert.AreEqual(expectedAssembly, p.Assembly);
- Assert.AreEqual(typeof (Program), p);
+ Assert.NotNull(p);
+ Assert.Equal(expectedAssembly, p.Assembly);
+ Assert.Equal(typeof (Program), p);
}
{
Type p = typeGetType("ContextualReflectionTest.Program, ContextualReflection");
Assembly expectedAssembly = Assembly.GetExecutingAssembly();
- Assert.IsNotNull(p);
- Assert.AreEqual(expectedAssembly, p.Assembly);
- Assert.AreEqual(typeof (Program), p);
+ Assert.NotNull(p);
+ Assert.Equal(expectedAssembly, p.Assembly);
+ Assert.Equal(typeof (Program), p);
}
{
Type g = typeGetType("ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program, ContextualReflection]], ContextualReflection");
Assembly expectedAssembly = Assembly.GetExecutingAssembly();
- Assert.IsNotNull(g);
- Assert.AreEqual(expectedAssembly, g.Assembly);
- Assert.AreEqual(expectedAssembly, g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(typeof (Program), g.GenericTypeArguments[0]);
- Assert.AreEqual(isolated ? alc : AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(g.GenericTypeArguments[0].Assembly));
+ Assert.NotNull(g);
+ Assert.Equal(expectedAssembly, g.Assembly);
+ Assert.Equal(expectedAssembly, g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(typeof (Program), g.GenericTypeArguments[0]);
+ Assert.Equal(isolated ? alc : AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(g.GenericTypeArguments[0].Assembly));
}
}
using (AssemblyLoadContext.Default.EnterContextualReflection())
Assembly expectedAssembly = Assembly.GetExecutingAssembly();
- Assert.IsNotNull(p);
- Assert.AreEqual(expectedAssembly, p.Assembly);
- Assert.AreEqual(typeof (Program), p);
+ Assert.NotNull(p);
+ Assert.Equal(expectedAssembly, p.Assembly);
+ Assert.Equal(typeof (Program), p);
}
{
Type p = typeGetType("ContextualReflectionTest.Program, ContextualReflection");
Assembly expectedAssembly = defaultAssembly;
- Assert.IsNotNull(p);
- Assert.AreEqual(expectedAssembly, p.Assembly);
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(p.Assembly));
+ Assert.NotNull(p);
+ Assert.Equal(expectedAssembly, p.Assembly);
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(p.Assembly));
}
{
Type g = typeGetType("ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program, ContextualReflection]], ContextualReflection");
Assembly expectedAssembly = defaultAssembly;
- Assert.IsNotNull(g);
- Assert.AreEqual(expectedAssembly, g.Assembly);
- Assert.AreEqual(expectedAssembly, g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(g.Assembly));
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(g.GenericTypeArguments[0].Assembly));
+ Assert.NotNull(g);
+ Assert.Equal(expectedAssembly, g.Assembly);
+ Assert.Equal(expectedAssembly, g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(g.Assembly));
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(g.GenericTypeArguments[0].Assembly));
}
}
using (alc.EnterContextualReflection())
Assembly expectedAssembly = Assembly.GetExecutingAssembly();
- Assert.IsNotNull(p);
- Assert.AreEqual(expectedAssembly, p.Assembly);
- Assert.AreEqual(typeof (Program), p);
+ Assert.NotNull(p);
+ Assert.Equal(expectedAssembly, p.Assembly);
+ Assert.Equal(typeof (Program), p);
}
{
Type p = typeGetType("ContextualReflectionTest.Program, ContextualReflection");
Assembly expectedAssembly = alcAssembly;
- Assert.IsNotNull(p);
- Assert.AreEqual(expectedAssembly, p.Assembly);
- Assert.AreEqual(alc, AssemblyLoadContext.GetLoadContext(p.Assembly));
+ Assert.NotNull(p);
+ Assert.Equal(expectedAssembly, p.Assembly);
+ Assert.Equal(alc, AssemblyLoadContext.GetLoadContext(p.Assembly));
}
{
Type g = typeGetType("ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program, ContextualReflection]], ContextualReflection");
Assembly expectedAssembly = alcAssembly;
- Assert.IsNotNull(g);
- Assert.AreEqual(expectedAssembly, g.Assembly);
- Assert.AreEqual(expectedAssembly, g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(alc, AssemblyLoadContext.GetLoadContext(g.Assembly));
- Assert.AreEqual(alc, AssemblyLoadContext.GetLoadContext(g.GenericTypeArguments[0].Assembly));
+ Assert.NotNull(g);
+ Assert.Equal(expectedAssembly, g.Assembly);
+ Assert.Equal(expectedAssembly, g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(alc, AssemblyLoadContext.GetLoadContext(g.Assembly));
+ Assert.Equal(alc, AssemblyLoadContext.GetLoadContext(g.GenericTypeArguments[0].Assembly));
}
}
}
{
Type g = assembly.GetType("ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program]]", throwOnError : false);
- Assert.IsNotNull(g);
- Assert.AreEqual(assembly, g.Assembly);
- Assert.AreEqual(assembly, g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(Assembly.GetExecutingAssembly(), g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(typeof (Program), g.GenericTypeArguments[0]);
+ Assert.NotNull(g);
+ Assert.Equal(assembly, g.Assembly);
+ Assert.Equal(assembly, g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(Assembly.GetExecutingAssembly(), g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(typeof (Program), g.GenericTypeArguments[0]);
}
{
Type g = assembly.GetType("ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program, ContextualReflection]]", throwOnError : false);
- Assert.IsNotNull(g);
- Assert.AreEqual(assembly, g.Assembly);
- Assert.AreEqual(assembly, g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(Assembly.GetExecutingAssembly(), g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(typeof (Program), g.GenericTypeArguments[0]);
+ Assert.NotNull(g);
+ Assert.Equal(assembly, g.Assembly);
+ Assert.Equal(assembly, g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(Assembly.GetExecutingAssembly(), g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(typeof (Program), g.GenericTypeArguments[0]);
}
{
Assembly mscorlib = typeof (System.Collections.Generic.List<string>).Assembly;
Assembly expectedAssembly = mscorlib;
- Assert.IsNotNull(m);
- Assert.AreEqual(expectedAssembly, m.Assembly);
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(m.GenericTypeArguments[0].Assembly));
+ Assert.NotNull(m);
+ Assert.Equal(expectedAssembly, m.Assembly);
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(m.GenericTypeArguments[0].Assembly));
}
}
using (AssemblyLoadContext.Default.EnterContextualReflection())
{
Type g = assembly.GetType("ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program]]", throwOnError : false);
- Assert.IsNotNull(g);
- Assert.AreEqual(assembly, g.Assembly);
- Assert.AreEqual(assembly, g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(Assembly.GetExecutingAssembly(), g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(typeof (Program), g.GenericTypeArguments[0]);
+ Assert.NotNull(g);
+ Assert.Equal(assembly, g.Assembly);
+ Assert.Equal(assembly, g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(Assembly.GetExecutingAssembly(), g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(typeof (Program), g.GenericTypeArguments[0]);
}
{
Type g = assembly.GetType("ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program, ContextualReflection]]", throwOnError : false);
Assembly expectedAssembly = defaultAssembly;
- Assert.IsNotNull(g);
- Assert.AreEqual(assembly, g.Assembly);
- Assert.AreEqual(expectedAssembly, g.GenericTypeArguments[0].Assembly);
+ Assert.NotNull(g);
+ Assert.Equal(assembly, g.Assembly);
+ Assert.Equal(expectedAssembly, g.GenericTypeArguments[0].Assembly);
}
{
Assembly mscorlib = typeof (System.Collections.Generic.List<string>).Assembly;
Assembly expectedAssembly = mscorlib;
- Assert.IsNotNull(m);
- Assert.AreEqual(expectedAssembly, m.Assembly);
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(m.GenericTypeArguments[0].Assembly));
+ Assert.NotNull(m);
+ Assert.Equal(expectedAssembly, m.Assembly);
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(m.GenericTypeArguments[0].Assembly));
}
}
using (alc.EnterContextualReflection())
{
Type g = assembly.GetType("ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program]]", throwOnError : false);
- Assert.IsNotNull(g);
- Assert.AreEqual(assembly, g.Assembly);
- Assert.AreEqual(assembly, g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(Assembly.GetExecutingAssembly(), g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(typeof (Program), g.GenericTypeArguments[0]);
+ Assert.NotNull(g);
+ Assert.Equal(assembly, g.Assembly);
+ Assert.Equal(assembly, g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(Assembly.GetExecutingAssembly(), g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(typeof (Program), g.GenericTypeArguments[0]);
}
{
Type g = assembly.GetType("ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program, ContextualReflection]]", throwOnError : false);
Assembly expectedAssembly = alcAssembly;
- Assert.IsNotNull(g);
- Assert.AreEqual(assembly, g.Assembly);
- Assert.AreEqual(expectedAssembly, g.GenericTypeArguments[0].Assembly);
+ Assert.NotNull(g);
+ Assert.Equal(assembly, g.Assembly);
+ Assert.Equal(expectedAssembly, g.GenericTypeArguments[0].Assembly);
}
{
Assembly mscorlib = typeof (System.Collections.Generic.List<string>).Assembly;
Assembly expectedAssembly = mscorlib;
- Assert.IsNotNull(m);
- Assert.AreEqual(expectedAssembly, m.Assembly);
- Assert.AreEqual(alc, AssemblyLoadContext.GetLoadContext(m.GenericTypeArguments[0].Assembly));
+ Assert.NotNull(m);
+ Assert.Equal(expectedAssembly, m.Assembly);
+ Assert.Equal(alc, AssemblyLoadContext.GetLoadContext(m.GenericTypeArguments[0].Assembly));
}
}
}
ObjectHandle objectHandle = Activator.CreateInstance(null, "ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program]]");
Type g = objectHandle.Unwrap().GetType();
- Assert.IsNotNull(g);
- Assert.AreEqual(assembly, g.Assembly);
- Assert.AreEqual(assembly, g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(Assembly.GetExecutingAssembly(), g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(typeof (Program), g.GenericTypeArguments[0]);
+ Assert.NotNull(g);
+ Assert.Equal(assembly, g.Assembly);
+ Assert.Equal(assembly, g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(Assembly.GetExecutingAssembly(), g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(typeof (Program), g.GenericTypeArguments[0]);
}
{
ObjectHandle objectHandle = Activator.CreateInstance(null, "ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program, ContextualReflection]]");
Type g = objectHandle.Unwrap().GetType();
- Assert.IsNotNull(g);
- Assert.AreEqual(assembly, g.Assembly);
- Assert.AreEqual(assembly, g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(Assembly.GetExecutingAssembly(), g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(typeof (Program), g.GenericTypeArguments[0]);
+ Assert.NotNull(g);
+ Assert.Equal(assembly, g.Assembly);
+ Assert.Equal(assembly, g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(Assembly.GetExecutingAssembly(), g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(typeof (Program), g.GenericTypeArguments[0]);
}
{
ObjectHandle objectHandle = Activator.CreateInstance("ContextualReflection" , "ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program, ContextualReflection]]");
Assembly expectedAssembly = assembly;
- Assert.IsNotNull(g);
- Assert.AreEqual(expectedAssembly, g.Assembly);
- Assert.AreEqual(expectedAssembly, g.GenericTypeArguments[0].Assembly);
+ Assert.NotNull(g);
+ Assert.Equal(expectedAssembly, g.Assembly);
+ Assert.Equal(expectedAssembly, g.GenericTypeArguments[0].Assembly);
}
{
Assembly expectedAssembly = alcAssembly;
ObjectHandle objectHandle = Activator.CreateInstance(mscorlib.GetName().Name, "System.Collections.Generic.List`1[[ContextualReflectionTest.Program, ContextualReflection]]");
Type m = objectHandle.Unwrap().GetType();
- Assert.IsNotNull(m);
- Assert.AreEqual(mscorlib, m.Assembly);
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(m.GenericTypeArguments[0].Assembly));
+ Assert.NotNull(m);
+ Assert.Equal(mscorlib, m.Assembly);
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(m.GenericTypeArguments[0].Assembly));
}
}
using (AssemblyLoadContext.Default.EnterContextualReflection())
ObjectHandle objectHandle = Activator.CreateInstance(null, "ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program]]");
Type g = objectHandle.Unwrap().GetType();
- Assert.IsNotNull(g);
- Assert.AreEqual(assembly, g.Assembly);
- Assert.AreEqual(assembly, g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(Assembly.GetExecutingAssembly(), g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(typeof (Program), g.GenericTypeArguments[0]);
+ Assert.NotNull(g);
+ Assert.Equal(assembly, g.Assembly);
+ Assert.Equal(assembly, g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(Assembly.GetExecutingAssembly(), g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(typeof (Program), g.GenericTypeArguments[0]);
}
{
ObjectHandle objectHandle = Activator.CreateInstance(null, "ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program, ContextualReflection]]");
Assembly expectedAssembly = defaultAssembly;
- Assert.IsNotNull(g);
- Assert.AreEqual(assembly, g.Assembly);
- Assert.AreEqual(expectedAssembly, g.GenericTypeArguments[0].Assembly);
+ Assert.NotNull(g);
+ Assert.Equal(assembly, g.Assembly);
+ Assert.Equal(expectedAssembly, g.GenericTypeArguments[0].Assembly);
}
{
ObjectHandle objectHandle = Activator.CreateInstance("ContextualReflection" , "ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program, ContextualReflection]]");
Assembly expectedAssembly = defaultAssembly;
- Assert.IsNotNull(g);
- Assert.AreEqual(expectedAssembly, g.Assembly);
- Assert.AreEqual(expectedAssembly, g.GenericTypeArguments[0].Assembly);
+ Assert.NotNull(g);
+ Assert.Equal(expectedAssembly, g.Assembly);
+ Assert.Equal(expectedAssembly, g.GenericTypeArguments[0].Assembly);
}
{
Assembly mscorlib = typeof (System.Collections.Generic.List<string>).Assembly;
Assembly expectedAssembly = mscorlib;
- Assert.IsNotNull(m);
- Assert.AreEqual(expectedAssembly, m.Assembly);
- Assert.AreEqual(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(m.GenericTypeArguments[0].Assembly));
+ Assert.NotNull(m);
+ Assert.Equal(expectedAssembly, m.Assembly);
+ Assert.Equal(AssemblyLoadContext.Default, AssemblyLoadContext.GetLoadContext(m.GenericTypeArguments[0].Assembly));
}
}
using (alc.EnterContextualReflection())
ObjectHandle objectHandle = Activator.CreateInstance(null, "ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program]]");
Type g = objectHandle.Unwrap().GetType();
- Assert.IsNotNull(g);
- Assert.AreEqual(assembly, g.Assembly);
- Assert.AreEqual(assembly, g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(Assembly.GetExecutingAssembly(), g.GenericTypeArguments[0].Assembly);
- Assert.AreEqual(typeof (Program), g.GenericTypeArguments[0]);
+ Assert.NotNull(g);
+ Assert.Equal(assembly, g.Assembly);
+ Assert.Equal(assembly, g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(Assembly.GetExecutingAssembly(), g.GenericTypeArguments[0].Assembly);
+ Assert.Equal(typeof (Program), g.GenericTypeArguments[0]);
}
{
ObjectHandle objectHandle = Activator.CreateInstance(null, "ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program, ContextualReflection]]");
Assembly expectedAssembly = alcAssembly;
- Assert.IsNotNull(g);
- Assert.AreEqual(assembly, g.Assembly);
- Assert.AreEqual(expectedAssembly, g.GenericTypeArguments[0].Assembly);
+ Assert.NotNull(g);
+ Assert.Equal(assembly, g.Assembly);
+ Assert.Equal(expectedAssembly, g.GenericTypeArguments[0].Assembly);
}
{
ObjectHandle objectHandle = Activator.CreateInstance("ContextualReflection" , "ContextualReflectionTest.AGenericClass`1[[ContextualReflectionTest.Program, ContextualReflection]]");
Assembly expectedAssembly = alcAssembly;
- Assert.IsNotNull(g);
- Assert.AreEqual(expectedAssembly, g.Assembly);
- Assert.AreEqual(expectedAssembly, g.GenericTypeArguments[0].Assembly);
+ Assert.NotNull(g);
+ Assert.Equal(expectedAssembly, g.Assembly);
+ Assert.Equal(expectedAssembly, g.GenericTypeArguments[0].Assembly);
}
{
Assembly mscorlib = typeof (System.Collections.Generic.List<string>).Assembly;
ObjectHandle objectHandle = Activator.CreateInstance(mscorlib.GetName().Name, "System.Collections.Generic.List`1[[ContextualReflectionTest.Program, ContextualReflection]]");
Type m = objectHandle.Unwrap().GetType();
- Assert.IsNotNull(m);
- Assert.AreEqual(mscorlib, m.Assembly);
- Assert.AreEqual(alc, AssemblyLoadContext.GetLoadContext(m.GenericTypeArguments[0].Assembly));
+ Assert.NotNull(m);
+ Assert.Equal(mscorlib, m.Assembly);
+ Assert.Equal(alc, AssemblyLoadContext.GetLoadContext(m.GenericTypeArguments[0].Assembly));
}
}
}
}
AssemblyLoadContext context = AssemblyLoadContext.GetLoadContext(assemblyBuilder);
- Assert.AreEqual(assemblyLoadContext, context);
- Assert.IsTrue(assemblyLoadContext.Assemblies.Any(a => AssemblyName.ReferenceMatchesDefinition(a.GetName(), assemblyBuilder.GetName())));
+ Assert.Equal(assemblyLoadContext, context);
+ Assert.True(assemblyLoadContext.Assemblies.Any(a => AssemblyName.ReferenceMatchesDefinition(a.GetName(), assemblyBuilder.GetName())));
}
void TestMockAssemblyThrows()
{
- Exception e = Assert.ThrowsArgumentException("activating", () => AssemblyLoadContext.EnterContextualReflection(new MockAssembly()));
+ Exception e = AssertExtensions.ThrowsArgumentException("activating", () => AssemblyLoadContext.EnterContextualReflection(new MockAssembly()));
}
public void RunTests()
}
finally
{
- TestLibrary.Assert.AreEqual(expected, ResolveEvent);
+ Xunit.Assert.Equal(expected, ResolveEvent);
}
}
}
using System.Threading;
using System.Reflection;
-using TestLibrary;
+using Xunit;
namespace BinderTracingTests
{
public BindOperation[] WaitAndGetEventsForAssembly(AssemblyName assemblyName)
{
- Assert.IsTrue(IsLoadToTrack(assemblyName.Name), $"Waiting for load for untracked name: {assemblyName.Name}. Tracking loads for: {string.Join(", ", loadsToTrack)}");
+ Assert.True(IsLoadToTrack(assemblyName.Name), $"Waiting for load for untracked name: {assemblyName.Name}. Tracking loads for: {string.Join(", ", loadsToTrack)}");
const int waitIntervalInMs = 50;
int waitTimeoutInMs = Environment.GetEnvironmentVariable("COMPlus_GCStress") == null
lock (eventsLock)
{
- Assert.IsTrue(!bindOperations.ContainsKey(data.ActivityId), "AssemblyLoadStart should not exist for same activity ID ");
+ Assert.True(!bindOperations.ContainsKey(data.ActivityId), "AssemblyLoadStart should not exist for same activity ID ");
bindOperation.Nested = bindOperations.ContainsKey(data.RelatedActivityId);
bindOperations.Add(data.ActivityId, bindOperation);
if (bindOperation.Nested)
lock (eventsLock)
{
if (!bindOperations.ContainsKey(data.ActivityId))
- Assert.Fail(GetMissingAssemblyBindStartMessage(data, $"Success={success}, Name={resultName}"));
+ Assert.True(false, GetMissingAssemblyBindStartMessage(data, $"Success={success}, Name={resultName}"));
BindOperation bind = bindOperations[data.ActivityId];
bind.Success = success;
lock (eventsLock)
{
if (!bindOperations.ContainsKey(data.ActivityId))
- Assert.Fail(GetMissingAssemblyBindStartMessage(data, attempt.ToString()));
+ Assert.True(false, GetMissingAssemblyBindStartMessage(data, attempt.ToString()));
BindOperation bind = bindOperations[data.ActivityId];
bind.ResolutionAttempts.Add(attempt);
lock (eventsLock)
{
if (!bindOperations.ContainsKey(data.ActivityId))
- Assert.Fail(GetMissingAssemblyBindStartMessage(data, handlerInvocation.ToString()));
+ Assert.True(false, GetMissingAssemblyBindStartMessage(data, handlerInvocation.ToString()));
BindOperation bind = bindOperations[data.ActivityId];
bind.AssemblyLoadContextResolvingHandlers.Add(handlerInvocation);
lock (eventsLock)
{
if (!bindOperations.ContainsKey(data.ActivityId))
- Assert.Fail(GetMissingAssemblyBindStartMessage(data, handlerInvocation.ToString()));
+ Assert.True(false, GetMissingAssemblyBindStartMessage(data, handlerInvocation.ToString()));
BindOperation bind = bindOperations[data.ActivityId];
bind.AppDomainAssemblyResolveHandlers.Add(handlerInvocation);
lock (eventsLock)
{
if (!bindOperations.ContainsKey(data.ActivityId))
- Assert.Fail(GetMissingAssemblyBindStartMessage(data, loadFrom.ToString()));
+ Assert.True(false, GetMissingAssemblyBindStartMessage(data, loadFrom.ToString()));
BindOperation bind = bindOperations[data.ActivityId];
bind.AssemblyLoadFromHandler = loadFrom;
lock (eventsLock)
{
if (!bindOperations.ContainsKey(data.ActivityId))
- Assert.Fail(GetMissingAssemblyBindStartMessage(data, probedPath.ToString()));
+ Assert.True(false, GetMissingAssemblyBindStartMessage(data, probedPath.ToString()));
BindOperation bind = bindOperations[data.ActivityId];
bind.ProbedPaths.Add(probedPath);
using System.Reflection;
using System.Runtime.Loader;
-using TestLibrary;
+using Xunit;
namespace BinderTracingTests
{
using System.Runtime.Loader;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
namespace BinderTracingTests
{
using System.Reflection;
using System.Runtime.Loader;
-using TestLibrary;
+using Xunit;
namespace BinderTracingTests
{
}
catch { }
- Assert.AreEqual(1, handlers.Invocations.Count);
- Assert.AreEqual(0, handlers.Binds.Count);
+ Assert.Equal(1, handlers.Invocations.Count);
+ Assert.Equal(0, handlers.Binds.Count);
return new BindOperation()
{
AssemblyName = assemblyName,
{
Assembly asm = alc.LoadFromAssemblyName(assemblyName);
- Assert.AreEqual(1, handlers.Invocations.Count);
- Assert.AreEqual(1, handlers.Binds.Count);
+ Assert.Equal(1, handlers.Invocations.Count);
+ Assert.Equal(1, handlers.Binds.Count);
return new BindOperation()
{
AssemblyName = assemblyName,
{
Assert.Throws<FileLoadException>(() => alc.LoadFromAssemblyName(assemblyName));
- Assert.AreEqual(1, handlers.Invocations.Count);
- Assert.AreEqual(1, handlers.Binds.Count);
+ Assert.Equal(1, handlers.Invocations.Count);
+ Assert.Equal(1, handlers.Binds.Count);
return new BindOperation()
{
AssemblyName = assemblyName,
{
Assembly asm = alc.LoadFromAssemblyName(assemblyName);
- Assert.AreEqual(1, handlerNull.Invocations.Count);
- Assert.AreEqual(0, handlerNull.Binds.Count);
- Assert.AreEqual(1, handlerLoad.Invocations.Count);
- Assert.AreEqual(1, handlerLoad.Binds.Count);
+ Assert.Equal(1, handlerNull.Invocations.Count);
+ Assert.Equal(0, handlerNull.Binds.Count);
+ Assert.Equal(1, handlerLoad.Invocations.Count);
+ Assert.Equal(1, handlerLoad.Binds.Count);
return new BindOperation()
{
AssemblyName = assemblyName,
}
catch { }
- Assert.AreEqual(1, handlers.Invocations.Count);
- Assert.AreEqual(0, handlers.Binds.Count);
+ Assert.Equal(1, handlers.Invocations.Count);
+ Assert.Equal(0, handlers.Binds.Count);
return new BindOperation()
{
AssemblyName = assemblyName,
{
Assembly asm = alc.LoadFromAssemblyName(assemblyName);
- Assert.AreEqual(1, handlers.Invocations.Count);
- Assert.AreEqual(1, handlers.Binds.Count);
+ Assert.Equal(1, handlers.Invocations.Count);
+ Assert.Equal(1, handlers.Binds.Count);
return new BindOperation()
{
AssemblyName = assemblyName,
// Result of AssemblyResolve event does not get checked for name mismatch
Assembly asm = alc.LoadFromAssemblyName(assemblyName);
- Assert.AreEqual(1, handlers.Invocations.Count);
- Assert.AreEqual(1, handlers.Binds.Count);
+ Assert.Equal(1, handlers.Invocations.Count);
+ Assert.Equal(1, handlers.Binds.Count);
return new BindOperation()
{
AssemblyName = assemblyName,
{
Assembly asm = alc.LoadFromAssemblyName(assemblyName);
- Assert.AreEqual(1, handlerNull.Invocations.Count);
- Assert.AreEqual(0, handlerNull.Binds.Count);
- Assert.AreEqual(1, handlerLoad.Invocations.Count);
- Assert.AreEqual(1, handlerLoad.Binds.Count);
+ Assert.Equal(1, handlerNull.Invocations.Count);
+ Assert.Equal(0, handlerNull.Binds.Count);
+ Assert.Equal(1, handlerLoad.Invocations.Count);
+ Assert.Equal(1, handlerLoad.Binds.Count);
return new BindOperation()
{
AssemblyName = assemblyName,
Assembly asm = Assembly.LoadFrom(assemblyPath);
Type t = asm.GetType(DependentAssemblyTypeName);
MethodInfo method = t.GetMethod("UseDependentAssembly", BindingFlags.Public | BindingFlags.Static);
- Assert.Throws<TargetInvocationException, FileNotFoundException>(() => method.Invoke(null, new object[0]));
+ AssertExtensions.ThrowsWithInnerException<TargetInvocationException, FileNotFoundException>(() => method.Invoke(null, new object[0]));
var assemblyName = new AssemblyName(asm.FullName);
assemblyName.Name = "AssemblyToLoadDependency";
using System.Reflection;
using System.Runtime.Loader;
-using TestLibrary;
+using Xunit;
using ResolutionStage = BinderTracingTests.ResolutionAttempt.ResolutionStage;
using ResolutionResult = BinderTracingTests.ResolutionAttempt.ResolutionResult;
var assemblyPath = Helpers.GetAssemblyInSubdirectoryPath(assemblyName.Name);
CustomALC alc = new CustomALC(nameof(AssemblyLoadContextLoad), true /*throwOnLoad*/);
- Assert.Throws<FileLoadException, Exception>(() => alc.LoadFromAssemblyName(assemblyName));
+ AssertExtensions.ThrowsWithInnerException<FileLoadException, Exception>(() => alc.LoadFromAssemblyName(assemblyName));
return new BindOperation()
{
CustomALC alc = new CustomALC(nameof(AssemblyLoadContextResolvingEvent_CustomALC_Exception));
using (var handlers = new Handlers(HandlerReturn.Exception, alc))
{
- Assert.Throws<FileLoadException, BinderTestException>(() => alc.LoadFromAssemblyName(assemblyName));
+ AssertExtensions.ThrowsWithInnerException<FileLoadException, BinderTestException>(() => alc.LoadFromAssemblyName(assemblyName));
return new BindOperation()
{
var assemblyName = new AssemblyName(SubdirectoryAssemblyName);
using (var handlers = new Handlers(HandlerReturn.Exception, AssemblyLoadContext.Default))
{
- Assert.Throws<FileLoadException, BinderTestException>(() => AssemblyLoadContext.Default.LoadFromAssemblyName(assemblyName));
+ AssertExtensions.ThrowsWithInnerException<FileLoadException, BinderTestException>(() => AssemblyLoadContext.Default.LoadFromAssemblyName(assemblyName));
return new BindOperation()
{
CustomALC alc = new CustomALC(nameof(AppDomainAssemblyResolveEvent_Exception));
using (var handlers = new Handlers(HandlerReturn.Exception))
{
- Assert.Throws<FileLoadException, BinderTestException>(() => alc.LoadFromAssemblyName(assemblyName));
+ AssertExtensions.ThrowsWithInnerException<FileLoadException, BinderTestException>(() => alc.LoadFromAssemblyName(assemblyName));
return new BindOperation()
{
Assembly asm = AssemblyLoadContext.Default.LoadFromAssemblyPath(assemblyPath);
- Assert.AreNotEqual(assemblyPath, asm.Location);
+ Assert.NotEqual(assemblyPath, asm.Location);
return new BindOperation()
{
AssemblyName = asm.GetName(),
using System.Reflection;
using System.Runtime.Loader;
-using TestLibrary;
+using Xunit;
namespace BinderTracingTests
{
// Run specific test - first argument should be the test method name
MethodInfo method = typeof(BinderTracingTest)
.GetMethod(args[0], BindingFlags.Public | BindingFlags.Static);
- Assert.IsTrue(method != null && method.GetCustomAttribute<BinderTestAttribute>() != null && method.ReturnType == typeof(BindOperation), "Invalid test method specified");
+ Assert.True(method != null && method.GetCustomAttribute<BinderTestAttribute>() != null && method.ReturnType == typeof(BindOperation));
success = RunSingleTest(method);
}
}
{
MethodInfo setupMethod = method.DeclaringType
.GetMethod(attribute.TestSetup, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- Assert.IsTrue(setupMethod != null);
+ Assert.True(setupMethod != null);
setupMethod.Invoke(null, new object[0]);
}
private static void ValidateSingleBind(BinderEventListener listener, AssemblyName assemblyName, BindOperation expected)
{
BindOperation[] binds = listener.WaitAndGetEventsForAssembly(assemblyName);
- Assert.IsTrue(binds.Length == 1, $"Bind event count for {assemblyName} - expected: 1, actual: {binds.Length}");
+ Assert.True(binds.Length == 1, $"Bind event count for {assemblyName} - expected: 1, actual: {binds.Length}");
BindOperation actual = binds[0];
Helpers.ValidateBindOperation(expected, actual);
using System.Reflection;
using System.Runtime.Loader;
-using TestLibrary;
+using Xunit;
namespace BinderTracingTests
{
public static void ValidateBindOperation(BindOperation expected, BindOperation actual)
{
ValidateAssemblyName(expected.AssemblyName, actual.AssemblyName, nameof(BindOperation.AssemblyName));
- Assert.AreEqual(expected.AssemblyPath ?? string.Empty, actual.AssemblyPath, $"Unexpected value for {nameof(BindOperation.AssemblyPath)} on event");
- Assert.AreEqual(expected.AssemblyLoadContext, actual.AssemblyLoadContext, $"Unexpected value for {nameof(BindOperation.AssemblyLoadContext)} on event");
- Assert.AreEqual(expected.RequestingAssemblyLoadContext ?? string.Empty, actual.RequestingAssemblyLoadContext, $"Unexpected value for {nameof(BindOperation.RequestingAssemblyLoadContext)} on event");
+ Assert.Equal(expected.AssemblyPath ?? string.Empty, actual.AssemblyPath);
+ Assert.Equal(expected.AssemblyLoadContext, actual.AssemblyLoadContext);
+ Assert.Equal(expected.RequestingAssemblyLoadContext ?? string.Empty, actual.RequestingAssemblyLoadContext);
ValidateAssemblyName(expected.RequestingAssembly, actual.RequestingAssembly, nameof(BindOperation.RequestingAssembly));
- Assert.AreEqual(expected.Success, actual.Success, $"Unexpected value for {nameof(BindOperation.Success)} on event");
- Assert.AreEqual(expected.ResultAssemblyPath ?? string.Empty, actual.ResultAssemblyPath, $"Unexpected value for {nameof(BindOperation.ResultAssemblyPath)} on event");
- Assert.AreEqual(expected.Cached, actual.Cached, $"Unexpected value for {nameof(BindOperation.Cached)} on event");
+ Assert.Equal(expected.Success, actual.Success);
+ Assert.Equal(expected.ResultAssemblyPath ?? string.Empty, actual.ResultAssemblyPath);
+ Assert.Equal(expected.Cached, actual.Cached);
ValidateAssemblyName(expected.ResultAssemblyName, actual.ResultAssemblyName, nameof(BindOperation.ResultAssemblyName));
ValidateResolutionAttempts(expected.ResolutionAttempts, actual.ResolutionAttempts);
private static void ValidateAssemblyName(AssemblyName expected, AssemblyName actual, string propertyName)
{
- Assert.IsTrue(AssemblyNamesMatch(expected, actual), $"Unexpected value for {propertyName} on event - expected: {expected}, actual: {actual}");
+ Assert.True(AssemblyNamesMatch(expected, actual), $"Unexpected value for {propertyName} on event - expected: {expected}, actual: {actual}");
}
private static void ValidateResolutionAttempts(List<ResolutionAttempt> expected, List<ResolutionAttempt> actual)
{
if (expected.Count > 0)
- Assert.AreEqual(expected.Count, actual.Count,
- $"Unexpected resolution attempt count. Actual events:{Environment.NewLine}{string.Join(Environment.NewLine, actual.Select(a => a.ToString()))}");
+ Assert.Equal(expected.Count, actual.Count);
for (var i = 0; i < expected.Count; i++)
{
string expectedActualMessage = $"{Environment.NewLine}Expected resolution attempt:{Environment.NewLine}{e.ToString()}{Environment.NewLine}Actual resolution attempt:{Environment.NewLine}{a.ToString()}";
ValidateAssemblyName(e.AssemblyName, a.AssemblyName, nameof(ResolutionAttempt.AssemblyName));
- Assert.AreEqual(e.Stage, a.Stage, $"Unexpected value for {nameof(ResolutionAttempt.Stage)} {expectedActualMessage}");
- Assert.AreEqual(e.AssemblyLoadContext, a.AssemblyLoadContext, $"Unexpected value for {nameof(ResolutionAttempt.AssemblyLoadContext)} {expectedActualMessage}");
- Assert.AreEqual(e.Result, a.Result, $"Unexpected value for {nameof(ResolutionAttempt.Result)} {expectedActualMessage}");
+ Assert.Equal(e.Stage, a.Stage);
+ Assert.Equal(e.AssemblyLoadContext, a.AssemblyLoadContext);
+ Assert.Equal(e.Result, a.Result);
ValidateAssemblyName(e.ResultAssemblyName, a.ResultAssemblyName, nameof(ResolutionAttempt.ResultAssemblyName));
- Assert.AreEqual(e.ResultAssemblyPath ?? string.Empty, a.ResultAssemblyPath, $"Unexpected value for {nameof(ResolutionAttempt.ResultAssemblyPath)} {expectedActualMessage}");
- Assert.AreEqual(e.ErrorMessage ?? string.Empty, a.ErrorMessage, $"Unexpected value for {nameof(ResolutionAttempt.ErrorMessage)} {expectedActualMessage}");
+ Assert.Equal(e.ResultAssemblyPath ?? string.Empty, a.ResultAssemblyPath);
+ Assert.Equal(e.ErrorMessage ?? string.Empty, a.ErrorMessage);
}
}
private static void ValidateHandlerInvocations(List<HandlerInvocation> expected, List<HandlerInvocation> actual, string eventName)
{
- Assert.AreEqual(expected.Count, actual.Count, $"Unexpected handler invocation count for {eventName}");
+ Assert.Equal(expected.Count, actual.Count);
foreach (var match in expected)
{
&& h.AssemblyLoadContext == match.AssemblyLoadContext
&& AssemblyNamesMatch(h.ResultAssemblyName, match.ResultAssemblyName)
&& (h.ResultAssemblyPath == match.ResultAssemblyPath || h.ResultAssemblyPath == "NULL" && match.ResultAssemblyPath == null);
- Assert.IsTrue(actual.Exists(pred), $"Handler invocation not found: {match.ToString()}");
+ Assert.True(actual.Exists(pred), $"Handler invocation not found: {match.ToString()}");
}
}
{
if (expected == null || actual == null)
{
- Assert.IsNull(expected);
- Assert.IsNull(actual);
+ Assert.Null(expected);
+ Assert.Null(actual);
return;
}
ValidateAssemblyName(expected.AssemblyName, actual.AssemblyName, nameof(LoadFromHandlerInvocation.AssemblyName));
- Assert.AreEqual(expected.IsTrackedLoad, actual.IsTrackedLoad, $"Unexpected value for {nameof(LoadFromHandlerInvocation.IsTrackedLoad)} on event");
- Assert.AreEqual(expected.RequestingAssemblyPath, actual.RequestingAssemblyPath, $"Unexpected value for {nameof(LoadFromHandlerInvocation.RequestingAssemblyPath)} on event");
+ Assert.Equal(expected.IsTrackedLoad, actual.IsTrackedLoad);
+ Assert.Equal(expected.RequestingAssemblyPath, actual.RequestingAssemblyPath);
if (expected.ComputedRequestedAssemblyPath == null)
{
- Assert.AreEqual("NULL", actual.ComputedRequestedAssemblyPath, $"Unexpected value for {nameof(LoadFromHandlerInvocation.ComputedRequestedAssemblyPath)} on event");
+ Assert.Equal("NULL", actual.ComputedRequestedAssemblyPath);
}
else
{
- Assert.AreEqual(expected.ComputedRequestedAssemblyPath, actual.ComputedRequestedAssemblyPath, $"Unexpected value for {nameof(LoadFromHandlerInvocation.ComputedRequestedAssemblyPath)} on event");
+ Assert.Equal(expected.ComputedRequestedAssemblyPath, actual.ComputedRequestedAssemblyPath);
}
}
Predicate<ProbedPath> pred = p => p.FilePath == match.FilePath
&& p.Source == match.Source
&& p.Result == match.Result;
- Assert.IsTrue(actual.Exists(pred), $"Probed path not found: {match.ToString()}");
+ Assert.True(actual.Exists(pred), $"Probed path not found: {match.ToString()}");
}
}
{
ValidateBindOperation(bind1, bind2);
}
- catch (AssertTestException e)
+ catch (Xunit.Sdk.XunitException e)
{
return false;
}
foreach (var match in expected)
{
Predicate<BindOperation> pred = b => BindOperationsMatch(match, b);
- Assert.IsTrue(actual.Exists(pred), $"Nested bind operation not found: {match.ToString()}");
+ Assert.True(actual.Exists(pred), $"Nested bind operation not found: {match.ToString()}");
}
}
}
using System.Collections.Generic;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
-using TestLibrary;
+using Xunit;
class TestType1<T> { }
class TestType2<T> { }
{
Console.WriteLine("TEST: FuncOnGenClass<{0}>", typeof(T1).Name);
for (int i = 0; i < max; i++)
- Assert.AreEqual(o1.FuncOnGenClass(i).ToString(), i == 0 ? $"{typeof(T1)}" : $"TestType{i}`1[{typeof(T1)}]");
+ Assert.Equal(o1.FuncOnGenClass(i).ToString(), i == 0 ? $"{typeof(T1)}" : $"TestType{i}`1[{typeof(T1)}]");
Console.WriteLine("TEST: FuncOnGenClass<{0}>", typeof(T2).Name);
for (int i = 0; i < max; i++)
- Assert.AreEqual(o2.FuncOnGenClass(i).ToString(), i == 0 ? $"{typeof(T2)}" : $"TestType{i}`1[{typeof(T2)}]");
+ Assert.Equal(o2.FuncOnGenClass(i).ToString(), i == 0 ? $"{typeof(T2)}" : $"TestType{i}`1[{typeof(T2)}]");
Console.WriteLine("TEST: FuncOnGenClass2<{0}>", typeof(T2).Name);
for (int i = 0; i < max; i++)
- Assert.AreEqual(o2.FuncOnGenClass2(i).ToString(), i == 0 ? $"{typeof(T2)}" : $"TestType{i}`1[{typeof(T2)}]");
+ Assert.Equal(o2.FuncOnGenClass2(i).ToString(), i == 0 ? $"{typeof(T2)}" : $"TestType{i}`1[{typeof(T2)}]");
Console.WriteLine("TEST: FuncOnGenClass<{0}>", typeof(T3).Name);
for (int i = 0; i < max; i++)
- Assert.AreEqual(o3.FuncOnGenClass(i).ToString(), i == 0 ? $"{typeof(T3)}" : $"TestType{i}`1[{typeof(T3)}]");
+ Assert.Equal(o3.FuncOnGenClass(i).ToString(), i == 0 ? $"{typeof(T3)}" : $"TestType{i}`1[{typeof(T3)}]");
}
public static void DoTest_GenClass(int max)
[MethodImpl(MethodImplOptions.NoInlining)]
public override void VFunc()
{
- Assert.AreEqual(typeof(KeyValuePair<T, string>).ToString(), "System.Collections.Generic.KeyValuePair`2[System.Object,System.String]");
- Assert.AreEqual(typeof(KeyValuePair<T, string>).ToString(), "System.Collections.Generic.KeyValuePair`2[System.Object,System.String]");
+ Assert.Equal(typeof(KeyValuePair<T, string>).ToString(), "System.Collections.Generic.KeyValuePair`2[System.Object,System.String]");
+ Assert.Equal(typeof(KeyValuePair<T, string>).ToString(), "System.Collections.Generic.KeyValuePair`2[System.Object,System.String]");
}
}
case 25: default: return typeof(TestType25<T>);
}
}
-
+
[MethodImpl(MethodImplOptions.NoInlining)]
public static Type GFunc2<T>(int level)
{
{
Console.WriteLine("TEST: GFunc<string>");
for(int i = 0; i < max; i++)
- Assert.AreEqual(GFunc<string>(i).ToString(), i == 0 ? "System.String" : $"TestType{i}`1[System.String]");
+ Assert.Equal(GFunc<string>(i).ToString(), i == 0 ? "System.String" : $"TestType{i}`1[System.String]");
Console.WriteLine("TEST: GFunc<object>(i)");
for (int i = 0; i < max; i++)
- Assert.AreEqual(GFunc<object>(i).ToString(), i == 0 ? "System.Object" : $"TestType{i}`1[System.Object]");
+ Assert.Equal(GFunc<object>(i).ToString(), i == 0 ? "System.Object" : $"TestType{i}`1[System.Object]");
Console.WriteLine("TEST: GFunc2<object>(i)");
for (int i = 0; i < max; i++)
- Assert.AreEqual(GFunc2<object>(i).ToString(), i == 0 ? "System.Object" : $"TestType{i}`1[System.Object]");
+ Assert.Equal(GFunc2<object>(i).ToString(), i == 0 ? "System.Object" : $"TestType{i}`1[System.Object]");
Console.WriteLine("TEST: GFunc<Test_DictionaryExpansion>(i)");
for (int i = 0; i < max; i++)
- Assert.AreEqual(GFunc<Test_DictionaryExpansion>(i).ToString(), i == 0 ? "Test_DictionaryExpansion" : $"TestType{i}`1[Test_DictionaryExpansion]");
+ Assert.Equal(GFunc<Test_DictionaryExpansion>(i).ToString(), i == 0 ? "Test_DictionaryExpansion" : $"TestType{i}`1[Test_DictionaryExpansion]");
}
-
+
public static int Main()
{
GenBase deriv4 = new GenDerived4();
-
+
for(int i = 5; i <= 25; i += 5)
{
// Test for generic classes
// Test for generic methods
DoTest(i);
-
+
{
AssemblyBuilder ab = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("CollectibleAsm"+i), AssemblyBuilderAccess.RunAndCollect);
var tb = ab.DefineDynamicModule("CollectibleMod" + i).DefineType("CollectibleGenDerived"+i, TypeAttributes.Public, typeof(GenDerived2));
}
}
}
-
+
// After all expansions to existing dictionaries, use GenDerived4. GenDerived4 was allocated before any of its
// base type dictionaries were expanded.
for(int i = 0; i < 5; i++)
using System.Reflection;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
unsafe class Program
{
// No modopt
Console.WriteLine($" -- unmanaged");
int b = CallFunctionPointers.CallUnmanagedIntInt(cbDefault, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- unmanaged cdecl");
int b = CallFunctionPointers.CallUnmanagedCdeclIntInt(cbCdecl, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- unmanaged stdcall");
int b = CallFunctionPointers.CallUnmanagedStdcallIntInt(cbStdcall, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- unmanaged modopt(cdecl)");
int b = CallFunctionPointers.CallUnmanagedIntInt_ModOptCdecl(cbCdecl, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- unmanaged modopt(stdcall)");
int b = CallFunctionPointers.CallUnmanagedIntInt_ModOptStdcall(cbStdcall, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
// Value in modopt is not a recognized calling convention
Console.WriteLine($" -- unmanaged modopt unrecognized");
int b = CallFunctionPointers.CallUnmanagedIntInt_ModOptUnknown(cbDefault, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
// Multiple modopts with calling conventions
Console.WriteLine($" -- unmanaged modopt(stdcall) modopt(cdecl)");
var ex = Assert.Throws<InvalidProgramException>(
- () => CallFunctionPointers.CallUnmanagedIntInt_ModOptStdcall_ModOptCdecl(cbCdecl, a),
- "Multiple modopts with calling conventions should fail");
- Assert.AreEqual("Multiple unmanaged calling conventions are specified. Only a single calling convention is supported.", ex.Message);
+ () => CallFunctionPointers.CallUnmanagedIntInt_ModOptStdcall_ModOptCdecl(cbCdecl, a));
+ Assert.Equal("Multiple unmanaged calling conventions are specified. Only a single calling convention is supported.", ex.Message);
}
{
Console.WriteLine($" -- unmanaged modopt(stdcall) modopt(unrecognized)");
int b = CallFunctionPointers.CallUnmanagedIntInt_ModOptStdcall_ModOptUnknown(cbStdcall, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- unmanaged cdecl modopt(stdcall)");
int b = CallFunctionPointers.CallUnmanagedCdeclIntInt_ModOptStdcall(cbCdecl, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- unmanaged stdcall modopt(cdecl)");
int b = CallFunctionPointers.CallUnmanagedStdcallIntInt_ModOptCdecl(cbStdcall, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
}
// No modopt
Console.WriteLine($" -- unmanaged");
var b = CallFunctionPointers.CallUnmanagedCharChar(cbDefault, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- unmanaged cdecl");
var b = CallFunctionPointers.CallUnmanagedCdeclCharChar(cbCdecl, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- unmanaged stdcall");
var b = CallFunctionPointers.CallUnmanagedStdcallCharChar(cbStdcall, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- unmanaged modopt(cdecl)");
var b = CallFunctionPointers.CallUnmanagedCharChar_ModOptCdecl(cbCdecl, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- unmanaged modopt(stdcall)");
var b = CallFunctionPointers.CallUnmanagedCharChar_ModOptStdcall(cbStdcall, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
// Value in modopt is not a recognized calling convention
Console.WriteLine($" -- unmanaged modopt(unrecognized)");
var b = CallFunctionPointers.CallUnmanagedCharChar_ModOptUnknown(cbDefault, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
// Multiple modopts with calling conventions
Console.WriteLine($" -- unmanaged modopt(stdcall) modopt(cdecl)");
var ex = Assert.Throws<InvalidProgramException>(
- () => CallFunctionPointers.CallUnmanagedCharChar_ModOptStdcall_ModOptCdecl(cbCdecl, a),
- "Multiple modopts with calling conventions should fail");
- Assert.AreEqual("Multiple unmanaged calling conventions are specified. Only a single calling convention is supported.", ex.Message);
+ () => CallFunctionPointers.CallUnmanagedCharChar_ModOptStdcall_ModOptCdecl(cbCdecl, a));
+ Assert.Equal("Multiple unmanaged calling conventions are specified. Only a single calling convention is supported.", ex.Message);
}
{
Console.WriteLine($" -- unmanaged modopt(stdcall) modopt(unrecognized)");
var b = CallFunctionPointers.CallUnmanagedCharChar_ModOptStdcall_ModOptUnknown(cbStdcall, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- unmanaged cdecl modopt(stdcall)");
var b = CallFunctionPointers.CallUnmanagedCdeclCharChar_ModOptStdcall(cbCdecl, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
{
Console.WriteLine($" -- unmanaged stdcall modopt(cdecl)");
var b = CallFunctionPointers.CallUnmanagedStdcallCharChar_ModOptCdecl(cbStdcall, a);
- Assert.AreEqual(expected, b);
+ Assert.Equal(expected, b);
}
}
using System.Reflection;
using System.Runtime.InteropServices;
-using TestLibrary;
+using Xunit;
using TypeEquivalenceTypes;
public class Simple
void AreNotSameObject(IEmptyType a, IEmptyType b)
{
- Assert.AreNotEqual(a, b);
+ Assert.NotEqual(a, b);
}
}
Type otherAsmInterfaceType = otherAsm.GetType().GetInterface(nameof(IEmptyType));
// Sanity checks
- Assert.IsTrue(inAsmInterfaceType == inAsmInterfaceType);
- Assert.IsTrue(inAsmInterfaceType.IsEquivalentTo(inAsmInterfaceType));
- Assert.IsFalse(inAsmInterfaceType.IsEquivalentTo(inAsm.GetType()));
- Assert.IsTrue(otherAsmInterfaceType == otherAsmInterfaceType);
- Assert.IsTrue(otherAsmInterfaceType.IsEquivalentTo(otherAsmInterfaceType));
- Assert.IsFalse(otherAsmInterfaceType.IsEquivalentTo(otherAsm.GetType()));
+ Assert.True(inAsmInterfaceType == inAsmInterfaceType);
+ Assert.True(inAsmInterfaceType.IsEquivalentTo(inAsmInterfaceType));
+ Assert.False(inAsmInterfaceType.IsEquivalentTo(inAsm.GetType()));
+ Assert.True(otherAsmInterfaceType == otherAsmInterfaceType);
+ Assert.True(otherAsmInterfaceType.IsEquivalentTo(otherAsmInterfaceType));
+ Assert.False(otherAsmInterfaceType.IsEquivalentTo(otherAsm.GetType()));
// The intrinsic equality operations should fail
- Assert.IsFalse(inAsmInterfaceType == otherAsmInterfaceType);
- Assert.IsFalse(inAsmInterfaceType.Equals(otherAsmInterfaceType));
- Assert.IsFalse(otherAsmInterfaceType == inAsmInterfaceType);
- Assert.IsFalse(otherAsmInterfaceType.Equals(inAsmInterfaceType));
+ Assert.False(inAsmInterfaceType == otherAsmInterfaceType);
+ Assert.False(inAsmInterfaceType.Equals(otherAsmInterfaceType));
+ Assert.False(otherAsmInterfaceType == inAsmInterfaceType);
+ Assert.False(otherAsmInterfaceType.Equals(inAsmInterfaceType));
// Determination of equal types requires API call
- Assert.IsTrue(inAsmInterfaceType.IsEquivalentTo(otherAsmInterfaceType));
- Assert.IsTrue(otherAsmInterfaceType.IsEquivalentTo(inAsmInterfaceType));
+ Assert.True(inAsmInterfaceType.IsEquivalentTo(otherAsmInterfaceType));
+ Assert.True(otherAsmInterfaceType.IsEquivalentTo(inAsmInterfaceType));
}
private class MethodTestDerived : MethodTestBase
int expectedBaseValue = input * baseScale;
int expectedDerivedValue = expectedBaseValue * derivedScale;
- Assert.AreEqual(expectedBaseValue, baseInterface.ScaleInt(input));
- Assert.AreEqual(expectedDerivedValue, derivedBase.ScaleInt(input));
+ Assert.Equal(expectedBaseValue, baseInterface.ScaleInt(input));
+ Assert.Equal(expectedDerivedValue, derivedBase.ScaleInt(input));
}
{
string expectedBaseValue = string.Concat(Enumerable.Repeat(input, baseScale));
string expectedDerivedValue = string.Concat(Enumerable.Repeat(expectedBaseValue, derivedScale));
- Assert.AreEqual(expectedBaseValue, baseInterface.ScaleString(input));
- Assert.AreEqual(expectedDerivedValue, derivedBase.ScaleString(input));
+ Assert.Equal(expectedBaseValue, baseInterface.ScaleString(input));
+ Assert.Equal(expectedDerivedValue, derivedBase.ScaleString(input));
}
}
Console.WriteLine($"{nameof(CallSparseInterface)}");
int sparseTypeMethodCount = typeof(ISparseType).GetMethods(BindingFlags.Public | BindingFlags.Instance).Length;
- Assert.AreEqual(2, sparseTypeMethodCount, "Should have limited method metadata");
+ Assert.Equal(2, sparseTypeMethodCount);
var sparseType = (ISparseType)SparseTest.Create();
- Assert.AreEqual(20, SparseTest.GetSparseInterfaceMethodCount(), "Should have all method metadata");
+ Assert.Equal(20, SparseTest.GetSparseInterfaceMethodCount());
int input = 63;
- Assert.AreEqual(input * 7, sparseType.MultiplyBy7(input));
- Assert.AreEqual(input * 18, sparseType.MultiplyBy18(input));
+ Assert.Equal(input * 7, sparseType.MultiplyBy7(input));
+ Assert.Equal(input * 18, sparseType.MultiplyBy18(input));
}
private static void TestArrayEquivalence()
Type inAsmInterfaceType = inAsm.GetType().GetInterface(nameof(IEmptyType));
Type otherAsmInterfaceType = otherAsm.GetType().GetInterface(nameof(IEmptyType));
- Assert.IsTrue(inAsmInterfaceType.MakeArrayType().IsEquivalentTo(otherAsmInterfaceType.MakeArrayType()));
- Assert.IsTrue(inAsmInterfaceType.MakeArrayType(1).IsEquivalentTo(otherAsmInterfaceType.MakeArrayType(1)));
- Assert.IsTrue(inAsmInterfaceType.MakeArrayType(2).IsEquivalentTo(otherAsmInterfaceType.MakeArrayType(2)));
+ Assert.True(inAsmInterfaceType.MakeArrayType().IsEquivalentTo(otherAsmInterfaceType.MakeArrayType()));
+ Assert.True(inAsmInterfaceType.MakeArrayType(1).IsEquivalentTo(otherAsmInterfaceType.MakeArrayType(1)));
+ Assert.True(inAsmInterfaceType.MakeArrayType(2).IsEquivalentTo(otherAsmInterfaceType.MakeArrayType(2)));
- Assert.IsFalse(inAsmInterfaceType.MakeArrayType().IsEquivalentTo(otherAsmInterfaceType.MakeArrayType(1)));
- Assert.IsFalse(inAsmInterfaceType.MakeArrayType(1).IsEquivalentTo(otherAsmInterfaceType.MakeArrayType(2)));
+ Assert.False(inAsmInterfaceType.MakeArrayType().IsEquivalentTo(otherAsmInterfaceType.MakeArrayType(1)));
+ Assert.False(inAsmInterfaceType.MakeArrayType(1).IsEquivalentTo(otherAsmInterfaceType.MakeArrayType(2)));
}
private static void TestByRefEquivalence()
Type inAsmInterfaceType = inAsm.GetType().GetInterface(nameof(IEmptyType));
Type otherAsmInterfaceType = otherAsm.GetType().GetInterface(nameof(IEmptyType));
- Assert.IsTrue(inAsmInterfaceType.MakeByRefType().IsEquivalentTo(otherAsmInterfaceType.MakeByRefType()));
+ Assert.True(inAsmInterfaceType.MakeByRefType().IsEquivalentTo(otherAsmInterfaceType.MakeByRefType()));
}
interface IGeneric<in T>
Type inAsmInterfaceType = inAsm.GetType().GetInterface(nameof(IEmptyType));
Type otherAsmInterfaceType = otherAsm.GetType().GetInterface(nameof(IEmptyType));
- Assert.IsFalse(typeof(Generic<>).MakeGenericType(inAsmInterfaceType).IsEquivalentTo(typeof(Generic<>).MakeGenericType(otherAsmInterfaceType)));
+ Assert.False(typeof(Generic<>).MakeGenericType(inAsmInterfaceType).IsEquivalentTo(typeof(Generic<>).MakeGenericType(otherAsmInterfaceType)));
}
private static void TestGenericInterfaceEquivalence()
Type inAsmInterfaceType = inAsm.GetType().GetInterface(nameof(IEmptyType));
Type otherAsmInterfaceType = otherAsm.GetType().GetInterface(nameof(IEmptyType));
- Assert.IsTrue(typeof(IGeneric<>).MakeGenericType(inAsmInterfaceType).IsEquivalentTo(typeof(IGeneric<>).MakeGenericType(otherAsmInterfaceType)));
+ Assert.True(typeof(IGeneric<>).MakeGenericType(inAsmInterfaceType).IsEquivalentTo(typeof(IGeneric<>).MakeGenericType(otherAsmInterfaceType)));
}
public static int Main(string[] noArgs)