diff options
author | Marek Safar <marek.safar@gmail.com> | 2014-12-04 17:16:31 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2014-12-04 17:16:31 +0300 |
commit | a1aced8ab22c1dabd25542fe808459f332039ee9 (patch) | |
tree | edc815c58e3da7337a937cc454546af09b9530d7 /mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/AssumesTests.cs | |
parent | 336755ca9edfbb0dd5c395f59a398c76449f7fdc (diff) |
Remove 4.0 profile
Diffstat (limited to 'mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/AssumesTests.cs')
-rw-r--r-- | mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/AssumesTests.cs | 301 |
1 files changed, 0 insertions, 301 deletions
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/AssumesTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/AssumesTests.cs deleted file mode 100644 index 6286722b4db..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/AssumesTests.cs +++ /dev/null @@ -1,301 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using System.Collections.Generic;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-#if !SILVERLIGHT
-using System.Runtime.Serialization;
-#endif
-
-namespace Microsoft.Internal
-{
- [TestClass]
- public class AssumesTests
- {
- [TestMethod]
- public void NotNullOfT_NullAsValueArgument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string>((string)null);
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2_NullAsValue1Argument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string>((string)null, "Value");
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2_NullAsValue2Argument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string>("Value", (string)null);
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2_NullAsValue1ArgumentAndValue2Argument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string>((string)null, (string)null);
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2T3_NullAsValue1Argument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string, string>((string)null, "Value", "Value");
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2T3_NullAsValue2Argument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string, string>("Value", (string)null, "Value");
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2T3_NullAsValue3Argument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string, string>("Value", "Value", (string)null);
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2T3_NullAsValue1ArgumentAndValue2Argument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string, string>((string)null, (string)null, "Value");
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2T3_NullAsValue1ArgumentAnd3_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string, string>((string)null, "Value", (string)null);
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2T3_NullAsValue2ArgumentAndValue3Argument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string, string>("Value", (string)null, (string)null);
- });
- }
-
- [TestMethod]
- public void NotNullOfT_ValueAsValueArgument_ShouldNotThrow()
- {
- Assumes.NotNull<string>("Value");
- }
-
- [TestMethod]
- public void NotNullOfT1T2_ValueAsValue1ArgumentAndValue2Argument_ShouldNotThrow()
- {
- Assumes.NotNull<string, string>("Value", "Value");
- }
-
- [TestMethod]
- public void NotNullOfT1T2T3_ValueAsValue1ArgumentAndValue2ArgumentAndValue3Argument_ShouldNotThrow()
- {
- Assumes.NotNull<string, string, string>("Value", "Value", "Value");
- }
-
- [TestMethod]
- public void NullOfT_NullAsValueArgument_ShouldNotThrow()
- {
- Assumes.Null<string>((string)null);
- }
-
- [TestMethod]
- public void NullOfT_ValueAsValueArgument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.Null<string>("Value");
- });
- }
-
- [TestMethod]
- public void NotNullOrEmpty_NullAsValueArgument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNullOrEmpty((string)null);
- });
- }
-
- [TestMethod]
- public void NotNullOrEmpty_EmptyAsValueArgument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNullOrEmpty("");
- });
- }
-
- [TestMethod]
- public void NotNullOrEmpty_ValueAsValueArgument_ShouldNotThrow()
- {
- var expectations = new List<string>();
- expectations.Add(" ");
- expectations.Add(" ");
- expectations.Add(" ");
- expectations.Add("Value");
-
- foreach (var e in expectations)
- {
- Assumes.NotNullOrEmpty(e);
- }
- }
-
- [TestMethod]
- public void IsTrue1_FalseAsConditionArgument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.IsTrue(false);
- });
- }
-
- [TestMethod]
- public void IsTrue2_FalseAsConditionArgument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.IsTrue(false, "Message");
- });
- }
-
- [TestMethod]
- public void IsTrue1_TrueAsConditionArgument_ShouldNotThrow()
- {
- Assumes.IsTrue(true);
- }
-
- [TestMethod]
- public void IsTrue2_TrueAsConditionArgument_ShouldNotThrow()
- {
- Assumes.IsTrue(true, "Message");
- }
-
- [TestMethod]
- public void IsFalse1_TrueAsConditionArgument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.IsFalse(true);
- });
- }
-
- [TestMethod]
- public void IsFalse1_FalseAsConditionArgument_ShouldNotThrow()
- {
- Assumes.IsFalse(false);
- }
-
- [TestMethod]
- public void NotReachable_ShouldAlwaysThrow()
- {
- Throws(() =>
- {
- Assumes.NotReachable<object>();
- });
- }
-
- [TestMethod]
- public void Fail_ShouldThrowInternalErrorException()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- Throws(() =>
- {
- Assumes.Fail(e);
- });
- }
- }
-
- private static void Throws(Action action)
- {
- try
- {
- action();
- Assert.Fail();
- }
- catch (Exception ex)
- {
- Type exceptionType = ex.GetType();
-
- // The exception should not be a
- // publicily catchable exception
- Assert.IsFalse(exceptionType.IsVisible);
- }
- }
-
-#if !SILVERLIGHT
-
- [TestMethod]
- public void Message_CanBeSerialized()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = CreateInternalErrorException(e);
-
- var result = SerializationTestServices.RoundTrip(exception);
-
- Assert.AreEqual(exception.Message, result.Message);
- }
- }
-
-#endif
-
- private static Exception CreateInternalErrorException()
- {
- return CreateInternalErrorException((string)null);
- }
-
- private static Exception CreateInternalErrorException(string message)
- {
- Exception exception = null;
-
- try
- {
- Assumes.Fail(message);
- }
- catch (Exception ex)
- {
- exception = ex;
- }
-
- Assert.IsNotNull(exception);
- return exception;
- }
- }
-}
|