Repository: reef Updated Branches: refs/heads/master 13e45727a -> 9c36dba55
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestInjectionFuture.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestInjectionFuture.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestInjectionFuture.cs index b079af1..3b6e245 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestInjectionFuture.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestInjectionFuture.cs @@ -17,12 +17,12 @@ * under the License. */ -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Annotations; using Org.Apache.REEF.Tang.Implementations.InjectionPlan; using Org.Apache.REEF.Tang.Implementations.Tang; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Util; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.Injection { @@ -35,19 +35,18 @@ namespace Org.Apache.REEF.Tang.Tests.Injection { } - [TestClass] public class TestInjectionFuture { - [TestMethod] + [Fact] public void TestProactiveFutures() { IInjector i = TangFactory.GetTang().NewInjector(); IsFuture.Instantiated = false; i.GetInstance(typeof(NeedsFuture)); - Assert.IsTrue(IsFuture.Instantiated); + Assert.True(IsFuture.Instantiated); } - [TestMethod] + [Fact] public void testFutures() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -55,18 +54,18 @@ namespace Org.Apache.REEF.Tang.Tests.Injection IInjector i2 = TangFactory.GetTang().NewInjector(cb.Build()); Futurist f = (Futurist)i.GetInstance(typeof(Futurist)); - Assert.IsTrue(f == f.getMyCar().getDriver()); - Assert.IsTrue(f.getMyCar() == f.getMyCar().getDriver().getMyCar()); + Assert.True(f == f.getMyCar().getDriver()); + Assert.True(f.getMyCar() == f.getMyCar().getDriver().getMyCar()); Futurist f2 = (Futurist)i2.GetInstance(typeof(Futurist)); - Assert.IsTrue(f2 == f2.getMyCar().getDriver()); - Assert.IsTrue(f2.getMyCar() == f2.getMyCar().getDriver().getMyCar()); + Assert.True(f2 == f2.getMyCar().getDriver()); + Assert.True(f2.getMyCar() == f2.getMyCar().getDriver().getMyCar()); - Assert.IsTrue(f != f2.getMyCar().getDriver()); - Assert.IsTrue(f.getMyCar() != f2.getMyCar().getDriver().getMyCar()); + Assert.True(f != f2.getMyCar().getDriver()); + Assert.True(f.getMyCar() != f2.getMyCar().getDriver().getMyCar()); } - [TestMethod] + [Fact] public void testFutures2() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -74,37 +73,37 @@ namespace Org.Apache.REEF.Tang.Tests.Injection IInjector i2 = i.ForkInjector(new IConfiguration[] { }); FlyingCar c = (FlyingCar)i.GetInstance(typeof(FlyingCar)); - Assert.IsTrue(c == c.getDriver().getMyCar()); - Assert.IsTrue(c.getDriver() == c.getDriver().getMyCar().getDriver()); + Assert.True(c == c.getDriver().getMyCar()); + Assert.True(c.getDriver() == c.getDriver().getMyCar().getDriver()); FlyingCar c2 = (FlyingCar)i2.GetInstance(typeof(FlyingCar)); - Assert.IsTrue(c2 == c2.getDriver().getMyCar()); - Assert.IsTrue(c2.getDriver() == c2.getDriver().getMyCar().getDriver()); + Assert.True(c2 == c2.getDriver().getMyCar()); + Assert.True(c2.getDriver() == c2.getDriver().getMyCar().getDriver()); - Assert.IsTrue(c2 != c.getDriver().getMyCar()); - Assert.IsTrue(c2.getDriver() != c.getDriver().getMyCar().getDriver()); + Assert.True(c2 != c.getDriver().getMyCar()); + Assert.True(c2.getDriver() != c.getDriver().getMyCar().getDriver()); } - [TestMethod] + [Fact] public void TestNamedParameterInjectionFuture() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); cb.BindImplementation(GenericType<FlyingCar>.Class, GenericType<FlyingCar>.Class); IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); PickyFuturist f = (PickyFuturist)i.GetInstance(typeof(PickyFuturist)); - Assert.IsNotNull(f.getMyCar()); + Assert.NotNull(f.getMyCar()); } - [TestMethod] + [Fact] public void TestNamedParameterInjectionFutureDefaultImpl() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); PickyFuturist f = (PickyFuturist)i.GetInstance(typeof(PickyFuturist)); - Assert.IsNotNull(f.getMyCar()); + Assert.NotNull(f.getMyCar()); } - [TestMethod] + [Fact] public void TestNamedParameterInjectionFutureBindImpl() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -112,23 +111,23 @@ namespace Org.Apache.REEF.Tang.Tests.Injection cb.BindNamedParameter<MyFlyingCar, BigFlyingCar, FlyingCar>(GenericType<MyFlyingCar>.Class, GenericType<BigFlyingCar>.Class); IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); PickyFuturist f = (PickyFuturist)i.GetInstance(typeof(PickyFuturist)); - Assert.IsNotNull((BigFlyingCar)f.getMyCar()); + Assert.NotNull((BigFlyingCar)f.getMyCar()); } - [TestMethod] + [Fact] public void TestNamedParameterBoundToDelegatingInterface() { IInjector i = TangFactory.GetTang().NewInjector(); C c = (C)i.GetNamedInstance(typeof(AName)); - Assert.IsNotNull(c); + Assert.NotNull(c); } - [TestMethod] + [Fact] public void TestBoundToDelegatingInterface() { IInjector i = TangFactory.GetTang().NewInjector(); C c = (C)i.GetInstance(typeof(IBinj)); - Assert.IsNotNull(c); + Assert.NotNull(c); } [DefaultImplementation(typeof(Futurist), "Futurist")] http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestListInjection.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestListInjection.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestListInjection.cs index 4d4115e..632a487 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestListInjection.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestListInjection.cs @@ -19,55 +19,54 @@ using System; using System.Collections.Generic; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Annotations; using Org.Apache.REEF.Tang.Implementations.Tang; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Types; using Org.Apache.REEF.Tang.Util; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.Injection { /// <summary> /// Test injection with a List /// </summary> - [TestClass] public class TestListInjection { /// <summary> /// Tests the string inject default. /// </summary> - [TestMethod] + [Fact] public void TestStringInjectDefault() { StringClass b = TangFactory.GetTang().NewInjector().GetInstance<StringClass>(); IList<string> actual = b.StringList; - Assert.IsTrue(actual.Contains("one")); - Assert.IsTrue(actual.Contains("two")); - Assert.IsTrue(actual.Contains("three")); + Assert.True(actual.Contains("one")); + Assert.True(actual.Contains("two")); + Assert.True(actual.Contains("three")); } /// <summary> /// Tests the int inject default. /// </summary> - [TestMethod] + [Fact] public void TestIntInjectDefault() { IntClass b = TangFactory.GetTang().NewInjector().GetInstance<IntClass>(); IList<int> actual = b.IntList; - Assert.IsTrue(actual.Contains(1)); - Assert.IsTrue(actual.Contains(2)); - Assert.IsTrue(actual.Contains(3)); + Assert.True(actual.Contains(1)); + Assert.True(actual.Contains(2)); + Assert.True(actual.Contains(3)); } /// <summary> /// Tests the string inject configuration builder. /// </summary> - [TestMethod] + [Fact] public void TestStringInjectConfigurationBuilder() { ICsClassHierarchy classH = TangFactory.GetTang().GetDefaultClassHierarchy(); @@ -83,16 +82,16 @@ namespace Org.Apache.REEF.Tang.Tests.Injection IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); IList<string> actual = ((StringClass)i.GetInstance(typeof(StringClass))).StringList; - Assert.IsTrue(actual.Contains("hi")); - Assert.IsTrue(actual.Contains("hello")); - Assert.IsTrue(actual.Contains("bye")); - Assert.AreEqual(actual.Count, 3); + Assert.True(actual.Contains("hi")); + Assert.True(actual.Contains("hello")); + Assert.True(actual.Contains("bye")); + Assert.Equal(actual.Count, 3); } /// <summary> /// Tests the bool list with named parameter. /// </summary> - [TestMethod] + [Fact] public void TestBoolListWithNamedParameter() { ICsClassHierarchy classH = TangFactory.GetTang().GetDefaultClassHierarchy(); @@ -118,7 +117,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection /// <summary> /// Tests the type of the bool list with generic. /// </summary> - [TestMethod] + [Fact] public void TestBoolListWithGenericType() { IList<string> injected = new List<string>(); @@ -142,7 +141,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection /// <summary> /// Tests the int list with named parameter. /// </summary> - [TestMethod] + [Fact] public void TestIntListWithNamedParameter() { ICsClassHierarchy classH = TangFactory.GetTang().GetDefaultClassHierarchy(); @@ -168,7 +167,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection /// <summary> /// Tests the type of the int list with generic. /// </summary> - [TestMethod] + [Fact] public void TestIntListWithGenericType() { IList<string> injected = new List<string>(); @@ -192,7 +191,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection /// <summary> /// Tests the string inject. /// </summary> - [TestMethod] + [Fact] public void TestStringInject() { IList<string> injected = new List<string>(); @@ -206,16 +205,16 @@ namespace Org.Apache.REEF.Tang.Tests.Injection IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); IList<string> actual = ((StringClass)i.GetInstance(typeof(StringClass))).StringList; - Assert.IsTrue(actual.Contains("hi")); - Assert.IsTrue(actual.Contains("hello")); - Assert.IsTrue(actual.Contains("bye")); - Assert.AreEqual(actual.Count, 3); + Assert.True(actual.Contains("hi")); + Assert.True(actual.Contains("hello")); + Assert.True(actual.Contains("bye")); + Assert.Equal(actual.Count, 3); } /// <summary> /// Tests the node inject and bind volatile instance. /// </summary> - [TestMethod] + [Fact] public void TestNodeInjectAndBindVolatileInstance() { ICsClassHierarchy classH = TangFactory.GetTang().GetDefaultClassHierarchy(); @@ -232,14 +231,14 @@ namespace Org.Apache.REEF.Tang.Tests.Injection i.BindVolatileInstance(GenericType<TestSetInjection.Float>.Class, new TestSetInjection.Float(42.0001f)); IList<INumber> actual = ((PoolListClass)i.GetInstance(typeof(PoolListClass))).Numbers; - Assert.IsTrue(actual.Contains(new TestSetInjection.Integer(42))); - Assert.IsTrue(actual.Contains(new TestSetInjection.Float(42.0001f))); + Assert.True(actual.Contains(new TestSetInjection.Integer(42))); + Assert.True(actual.Contains(new TestSetInjection.Float(42.0001f))); } /// <summary> /// Tests the class name inject with named parameter node. /// </summary> - [TestMethod] + [Fact] public void TestClassNameInjectWithNamedParameterNode() { ICsClassHierarchy classH = TangFactory.GetTang().GetDefaultClassHierarchy(); @@ -257,14 +256,14 @@ namespace Org.Apache.REEF.Tang.Tests.Injection i.BindVolatileInstance(GenericType<TestSetInjection.Float>.Class, new TestSetInjection.Float(42.0001f)); IList<INumber> actual = ((PoolListClass)i.GetInstance(typeof(PoolListClass))).Numbers; - Assert.IsTrue(actual.Contains(new TestSetInjection.Integer(42))); - Assert.IsTrue(actual.Contains(new TestSetInjection.Float(42.0001f))); + Assert.True(actual.Contains(new TestSetInjection.Integer(42))); + Assert.True(actual.Contains(new TestSetInjection.Float(42.0001f))); } /// <summary> /// Tests the name of the class name inject with named parameter. /// </summary> - [TestMethod] + [Fact] public void TestClassNameInjectWithNamedParameterName() { IList<string> injected = new List<string>(); @@ -279,14 +278,14 @@ namespace Org.Apache.REEF.Tang.Tests.Injection i.BindVolatileInstance(GenericType<TestSetInjection.Float>.Class, new TestSetInjection.Float(42.0001f)); IList<INumber> actual = ((PoolListClass)i.GetInstance(typeof(PoolListClass))).Numbers; - Assert.IsTrue(actual.Contains(new TestSetInjection.Integer(42))); - Assert.IsTrue(actual.Contains(new TestSetInjection.Float(42.0001f))); + Assert.True(actual.Contains(new TestSetInjection.Integer(42))); + Assert.True(actual.Contains(new TestSetInjection.Float(42.0001f))); } /// <summary> /// Tests the object inject with injectable subclasses. /// </summary> - [TestMethod] + [Fact] public void TestObjectInjectWithInjectableSubclasses() { IList<string> injected = new List<string>(); @@ -303,16 +302,16 @@ namespace Org.Apache.REEF.Tang.Tests.Injection IList<INumber> actual = ((PoolListClass)i.GetInstance(typeof(PoolListClass))).Numbers; - Assert.IsTrue(actual.Count == 3); - Assert.IsTrue(actual.Contains(new TestSetInjection.Integer1(5))); - Assert.IsTrue(actual.Contains(new TestSetInjection.Integer2())); - Assert.IsTrue(actual.Contains(new TestSetInjection.Integer3(10))); + Assert.True(actual.Count == 3); + Assert.True(actual.Contains(new TestSetInjection.Integer1(5))); + Assert.True(actual.Contains(new TestSetInjection.Integer2())); + Assert.True(actual.Contains(new TestSetInjection.Integer3(10))); } /// <summary> /// Tests the object inject with injectable subclasses multiple instances. /// </summary> - [TestMethod] + [Fact] public void TestObjectInjectWithInjectableSubclassesMultipleInstances() { IList<string> injected = new List<string>(); @@ -329,16 +328,16 @@ namespace Org.Apache.REEF.Tang.Tests.Injection IList<INumber> actual = ((PoolListClass)i.GetInstance(typeof(PoolListClass))).Numbers; - Assert.IsTrue(actual.Count == 3); - Assert.IsTrue(actual.Contains(new TestSetInjection.Integer1(5))); - Assert.IsTrue(actual.Contains(new TestSetInjection.Integer1(5))); - Assert.IsTrue(actual.Contains(new TestSetInjection.Float1(12.5f))); + Assert.True(actual.Count == 3); + Assert.True(actual.Contains(new TestSetInjection.Integer1(5))); + Assert.True(actual.Contains(new TestSetInjection.Integer1(5))); + Assert.True(actual.Contains(new TestSetInjection.Float1(12.5f))); } /// <summary> /// Tests the object inject with injectable subclasses and typeof named parameter. /// </summary> - [TestMethod] + [Fact] public void TestObjectInjectWithInjectableSubclassesAndTypeofNamedParameter() { IList<string> injected = new List<string>(); @@ -355,16 +354,16 @@ namespace Org.Apache.REEF.Tang.Tests.Injection IList<INumber> actual = ((PoolListClass)i.GetInstance(typeof(PoolListClass))).Numbers; - Assert.IsTrue(actual.Count == 3); - Assert.IsTrue(actual.Contains(new TestSetInjection.Integer1(5))); - Assert.IsTrue(actual.Contains(new TestSetInjection.Integer2())); - Assert.IsTrue(actual.Contains(new TestSetInjection.Integer3(10))); + Assert.True(actual.Count == 3); + Assert.True(actual.Contains(new TestSetInjection.Integer1(5))); + Assert.True(actual.Contains(new TestSetInjection.Integer2())); + Assert.True(actual.Contains(new TestSetInjection.Integer3(10))); } /// <summary> /// Tests the object inject with names configuration builder. /// </summary> - [TestMethod] + [Fact] public void TestObjectInjectWithNames() { ICsClassHierarchy classH = TangFactory.GetTang().GetDefaultClassHierarchy(); @@ -380,14 +379,14 @@ namespace Org.Apache.REEF.Tang.Tests.Injection i.BindVolatileInstance(GenericType<TestSetInjection.Float>.Class, new TestSetInjection.Float(42.0001f)); IList<INumber> actual = ((PoolListClass)i.GetInstance(typeof(PoolListClass))).Numbers; - Assert.IsTrue(actual.Contains(new TestSetInjection.Integer(42))); - Assert.IsTrue(actual.Contains(new TestSetInjection.Float(42.0001f))); + Assert.True(actual.Contains(new TestSetInjection.Integer(42))); + Assert.True(actual.Contains(new TestSetInjection.Float(42.0001f))); } /// <summary> /// Tests the object inject with type type cs configuration builder. /// </summary> - [TestMethod] + [Fact] public void TestObjectInjectWithTypeType() { IList<Type> injected = new List<Type>(); @@ -402,14 +401,14 @@ namespace Org.Apache.REEF.Tang.Tests.Injection i.BindVolatileInstance(GenericType<TestSetInjection.Float>.Class, new TestSetInjection.Float(42.0001f)); IList<INumber> actual = ((PoolListClass)i.GetInstance(typeof(PoolListClass))).Numbers; - Assert.IsTrue(actual.Contains(new TestSetInjection.Integer(42))); - Assert.IsTrue(actual.Contains(new TestSetInjection.Float(42.0001f))); + Assert.True(actual.Contains(new TestSetInjection.Integer(42))); + Assert.True(actual.Contains(new TestSetInjection.Float(42.0001f))); } ////<summary> ////Tests the subclass inject with multiple instances. ////</summary> - ////[TestMethod] + ////[Fact] ////public void TestSubclassInjectWithMultipleInstances() ////{ //// ICsConfigurationBuilder cb1 = TangFactory.GetTang().NewConfigurationBuilder() @@ -434,14 +433,14 @@ namespace Org.Apache.REEF.Tang.Tests.Injection //// IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); //// IList<INumber> actual = ((PoolListClass)i.GetInstance(typeof(PoolListClass))).Numbers; - //// Assert.IsTrue(actual.Count == 7); - //// Assert.IsTrue(actual.Contains(new TestSetInjection.Integer1(42))); - //// Assert.IsTrue(actual.Contains(new TestSetInjection.Integer1(30))); - //// Assert.IsTrue(actual.Contains(new TestSetInjection.Float1(42.0001f))); - //// Assert.IsTrue(actual.Contains(new TestSetInjection.Float1(12.5f))); - //// Assert.IsTrue(actual.Contains(new TestSetInjection.Integer1(5))); - //// Assert.IsTrue(actual.Contains(new TestSetInjection.Integer2())); - //// Assert.IsTrue(actual.Contains(new TestSetInjection.Integer3(10))); + //// Assert.True(actual.Count == 7); + //// Assert.True(actual.Contains(new TestSetInjection.Integer1(42))); + //// Assert.True(actual.Contains(new TestSetInjection.Integer1(30))); + //// Assert.True(actual.Contains(new TestSetInjection.Float1(42.0001f))); + //// Assert.True(actual.Contains(new TestSetInjection.Float1(12.5f))); + //// Assert.True(actual.Contains(new TestSetInjection.Integer1(5))); + //// Assert.True(actual.Contains(new TestSetInjection.Integer2())); + //// Assert.True(actual.Contains(new TestSetInjection.Integer3(10))); ////} } @@ -521,10 +520,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection public void Verify(IList<bool> v) { - Assert.AreEqual(v.Count, b.Count); + Assert.Equal(v.Count, b.Count); foreach (bool bv in v) { - Assert.IsTrue(b.Contains(bv)); + Assert.True(b.Contains(bv)); } } @@ -546,10 +545,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection public void Verify(IList<int> v) { - Assert.AreEqual(v.Count, l.Count); + Assert.Equal(v.Count, l.Count); foreach (int iv in v) { - Assert.IsTrue(l.Contains(iv)); + Assert.True(l.Contains(iv)); } } http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestMissingParameters.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestMissingParameters.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestMissingParameters.cs index faaa785..ff37106 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestMissingParameters.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestMissingParameters.cs @@ -17,19 +17,18 @@ * under the License. */ -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Annotations; using Org.Apache.REEF.Tang.Exceptions; using Org.Apache.REEF.Tang.Implementations.Tang; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Util; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.Injection { - [TestClass] public class TestMissingParameters { - [TestMethod] + [Fact] public void MultipleParameterTest() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -41,7 +40,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection o.Verify("foo", 8, true); } - [TestMethod] + [Fact] public void MissingAllParameterTest() { // Org.Apache.REEF.Tang.Tests.Injection.MultiParameterConstructor, Org.Apache.REEF.Tang.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null @@ -61,10 +60,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection { System.Diagnostics.Debug.WriteLine(e); } - Assert.IsNull(obj); + Assert.Null(obj); } - [TestMethod] + [Fact] public void MissingTwoParameterTest() { // Cannot inject Org.Apache.REEF.Tang.Tests.Injection.MultiParameterConstructor, Org.Apache.REEF.Tang.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: @@ -85,10 +84,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection { System.Diagnostics.Debug.WriteLine(e); } - Assert.IsNull(obj); + Assert.Null(obj); } - [TestMethod] + [Fact] public void MissingOneParameterTest() { // Cannot inject Org.Apache.REEF.Tang.Tests.Injection.MultiParameterConstructor, Org.Apache.REEF.Tang.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: @@ -107,7 +106,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection { System.Diagnostics.Debug.WriteLine(e); } - Assert.IsNull(obj); + Assert.Null(obj); } } @@ -127,9 +126,9 @@ namespace Org.Apache.REEF.Tang.Tests.Injection public void Verify(string s, int i, bool b) { - Assert.AreEqual(str, s); - Assert.AreEqual(iVal, i); - Assert.AreEqual(bVal, b); + Assert.Equal(str, s); + Assert.Equal(iVal, i); + Assert.Equal(bVal, b); } [NamedParameter] http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestMissingParamtersInNested.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestMissingParamtersInNested.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestMissingParamtersInNested.cs index 69eed2e..30b2b57 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestMissingParamtersInNested.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestMissingParamtersInNested.cs @@ -17,29 +17,28 @@ * under the License. */ -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Annotations; using Org.Apache.REEF.Tang.Exceptions; using Org.Apache.REEF.Tang.Implementations.Tang; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Util; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.Injection { - [TestClass] public class TestMissingParamtersInNested { - [TestMethod] + [Fact] public void InnerParameterTest() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); cb.BindNamedParameter<ReferencedClass.NamedInt, int>(GenericType<ReferencedClass.NamedInt>.Class, "8"); IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); var o = i.GetInstance<ReferencedClass>(); - Assert.IsNotNull(o); + Assert.NotNull(o); } - [TestMethod] + [Fact] public void NestedParameterTest() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -47,10 +46,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection cb.BindNamedParameter<ReferencedClass.NamedInt, int>(GenericType<ReferencedClass.NamedInt>.Class, "8"); IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); var o = i.GetInstance<OuterClass>(); - Assert.IsNotNull(o); + Assert.NotNull(o); } - [TestMethod] + [Fact] public void MissingAllParameterTest() { // Cannot inject Org.Apache.REEF.Tang.Tests.Injection.OuterClass, Org.Apache.REEF.Tang.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: @@ -67,10 +66,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection { System.Diagnostics.Debug.WriteLine(e); } - Assert.IsNull(obj); + Assert.Null(obj); } - [TestMethod] + [Fact] public void MissingInnerParameterTest() { // Cannot inject Org.Apache.REEF.Tang.Tests.Injection.OuterClass, Org.Apache.REEF.Tang.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: @@ -88,10 +87,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection { System.Diagnostics.Debug.WriteLine(e); } - Assert.IsNull(obj); + Assert.Null(obj); } - [TestMethod] + [Fact] public void MissingOuterParameterTest() { // Cannot inject Org.Apache.REEF.Tang.Tests.Injection.OuterClass, Org.Apache.REEF.Tang.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: @@ -109,7 +108,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection { System.Diagnostics.Debug.WriteLine(e); } - Assert.IsNull(obj); + Assert.Null(obj); } } http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestMultipleConstructors.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestMultipleConstructors.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestMultipleConstructors.cs index 3f1b093..e970636 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestMultipleConstructors.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestMultipleConstructors.cs @@ -18,12 +18,12 @@ */ using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Annotations; using Org.Apache.REEF.Tang.Exceptions; using Org.Apache.REEF.Tang.Implementations.Tang; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Util; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.Injection { @@ -31,10 +31,9 @@ namespace Org.Apache.REEF.Tang.Tests.Injection { } - [TestClass] public class TestMultipleConstructors { - [TestMethod] + [Fact] public void TestMissingAllParameters() { // Multiple infeasible plans: Org.Apache.REEF.Tang.Tests.Injection.MultiConstructorTest @@ -66,10 +65,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection catch (InjectionException) { } - Assert.IsNull(obj); + Assert.Null(obj); } - [TestMethod] + [Fact] public void TestMissingIntParameter() { // Multiple infeasible plans: Org.Apache.REEF.Tang.Tests.Injection.MultiConstructorTest @@ -103,10 +102,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection catch (InjectionException) { } - Assert.IsNull(obj); + Assert.Null(obj); } - [TestMethod] + [Fact] public void TestOnlyBoolParameter() { // Multiple infeasible plans: Org.Apache.REEF.Tang.Tests.Injection.MultiConstructorTest @@ -139,10 +138,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection catch (InjectionException) { } - Assert.IsNull(obj); + Assert.Null(obj); } - [TestMethod] + [Fact] public void TestOnlyIntParameter() { // Multiple infeasible plans: Org.Apache.REEF.Tang.Tests.Injection.MultiConstructorTest @@ -175,10 +174,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection catch (InjectionException) { } - Assert.IsNull(obj); + Assert.Null(obj); } - [TestMethod] + [Fact] public void TestMultipleConstructor() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -190,7 +189,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection o.Verify("foo", 8, true); } - [TestMethod] + [Fact] public void TestMultiLayersWithMiddleLayerFirst() { TangImpl.Reset(); @@ -198,16 +197,16 @@ namespace Org.Apache.REEF.Tang.Tests.Injection cb2.BindImplementation(typeof(IH), typeof(M)); IInjector i2 = TangFactory.GetTang().NewInjector(cb2.Build()); var o2 = i2.GetInstance<IH>(); - Assert.IsTrue(o2 is M); + Assert.True(o2 is M); ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); cb.BindImplementation(typeof(IH), typeof(L)); IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); var o = i.GetInstance<IH>(); - Assert.IsTrue(o is L); + Assert.True(o is L); } - [TestMethod] + [Fact] public void TestMultiLayersWithLowerLayerFirst() { TangImpl.Reset(); @@ -215,16 +214,16 @@ namespace Org.Apache.REEF.Tang.Tests.Injection cb.BindImplementation(typeof(IH), typeof(L)); IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); var o = i.GetInstance<IH>(); - Assert.IsTrue(o is L); + Assert.True(o is L); ICsConfigurationBuilder cb2 = TangFactory.GetTang().NewConfigurationBuilder(); cb2.BindImplementation(typeof(IH), typeof(M)); IInjector i2 = TangFactory.GetTang().NewInjector(cb2.Build()); var o2 = i2.GetInstance<IH>(); - Assert.IsTrue(o2 is M); + Assert.True(o2 is M); } - [TestMethod] + [Fact] public void TestMultiLayersWithBindImpl() { TangImpl.Reset(); @@ -233,17 +232,17 @@ namespace Org.Apache.REEF.Tang.Tests.Injection cb.BindImplementation(typeof(IH), typeof(L)); IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); var o = i.GetInstance<IH>(); - Assert.IsTrue(o is L); + Assert.True(o is L); ICsConfigurationBuilder cb2 = TangFactory.GetTang().NewConfigurationBuilder(); cb2.BindImplementation(typeof(IH), typeof(M)); cb2.BindImplementation(typeof(M), typeof(L)); // constructor of L is explicitly bound IInjector i2 = TangFactory.GetTang().NewInjector(cb2.Build()); var o2 = i2.GetInstance<IH>(); - Assert.IsTrue(o2 is L); + Assert.True(o2 is L); } - [TestMethod] + [Fact] public void TestMultiLayersWithNoInjectableDefaultConstructor() { TangImpl.Reset(); @@ -252,7 +251,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection cb.BindImplementation(typeof(IH), typeof(L1)); IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); var o = i.GetInstance<IH>(); - Assert.IsNotNull(o); + Assert.NotNull(o); ICsConfigurationBuilder cb2 = TangFactory.GetTang().NewConfigurationBuilder(); cb2.BindImplementation(typeof(IH), typeof(M1)); // M1 doesn't have injectable default constructor, no implementation L1 is bound to M1 @@ -261,7 +260,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection try { var o2 = i2.GetInstance<IH>(); - Assert.IsTrue(o2 is L1); + Assert.True(o2 is L1); } catch (Exception e) { @@ -269,7 +268,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection // No known implementations / injectable constructors for Org.Apache.REEF.Tang.Tests.Injection.M1, Org.Apache.REEF.Tang.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null msg = e.Message; } - Assert.IsNotNull(msg); + Assert.NotNull(msg); } } @@ -305,9 +304,9 @@ namespace Org.Apache.REEF.Tang.Tests.Injection public void Verify(string s, int i, bool b) { - Assert.AreEqual(str, s); - Assert.AreEqual(iVal, i); - Assert.AreEqual(bVal, b); + Assert.Equal(str, s); + Assert.Equal(iVal, i); + Assert.Equal(bVal, b); } [NamedParameter] http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestNamedParameter.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestNamedParameter.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestNamedParameter.cs index 49214b8..796dc5d 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestNamedParameter.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestNamedParameter.cs @@ -17,18 +17,17 @@ * under the License. */ -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Annotations; using Org.Apache.REEF.Tang.Implementations.Tang; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Util; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.Injection { - [TestClass] public class TestNamedParameter { - [TestMethod] + [Fact] public void TestOptionalParameter() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -38,7 +37,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection o.Verify("foo"); } - [TestMethod] + [Fact] public void TestOptionalParameterWithDefault() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -47,7 +46,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection o.Verify(" "); } - [TestMethod] + [Fact] public void TestBoolParameter() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -57,7 +56,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection o.Verify(true); } - [TestMethod] + [Fact] public void TestBoolUpperCaseParameter() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -67,7 +66,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection o.Verify(true); } - [TestMethod] + [Fact] public void TestBoolParameterWithDefault() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -76,7 +75,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection o.Verify(false); } - [TestMethod] + [Fact] public void TestByteParameter() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -86,7 +85,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection o.Verify(6); } - [TestMethod] + [Fact] public void TestByteArrayParameter() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -97,10 +96,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection byte[] bytes = new byte[input.Length * sizeof(char)]; System.Buffer.BlockCopy(input.ToCharArray(), 0, bytes, 0, bytes.Length); - Assert.IsTrue(o.Verify(bytes)); + Assert.True(o.Verify(bytes)); } - [TestMethod] + [Fact] public void TestCharParameter() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -110,7 +109,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection o.Verify('C'); } - [TestMethod] + [Fact] public void TestShortParameter() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -120,7 +119,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection o.Verify(8); } - [TestMethod] + [Fact] public void TestIntParameter() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -130,7 +129,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection o.Verify(8); } - [TestMethod] + [Fact] public void TestLongParameter() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -140,7 +139,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection o.Verify(8777); } - [TestMethod] + [Fact] public void TestFloatParameter() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -164,7 +163,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection public void Verify(string s) { - Assert.AreEqual(s, str); + Assert.Equal(s, str); } [NamedParameter(DefaultValue = " ")] @@ -185,7 +184,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection public void Verify(char s) { - Assert.AreEqual(s, c); + Assert.Equal(s, c); } [NamedParameter(DefaultValue = " ")] @@ -206,7 +205,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection public void Verify(byte v) { - Assert.AreEqual(v, b); + Assert.Equal(v, b); } [NamedParameter(DefaultValue = "7")] @@ -227,7 +226,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection public void Verify(bool v) { - Assert.AreEqual(v, b); + Assert.Equal(v, b); } [NamedParameter(DefaultValue = "false")] @@ -282,7 +281,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection public void Verify(short v) { - Assert.AreEqual(v, s); + Assert.Equal(v, s); } [NamedParameter(DefaultValue = "3")] @@ -303,7 +302,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection public void Verify(int v) { - Assert.AreEqual(v, i); + Assert.Equal(v, i); } [NamedParameter(DefaultValue = "3")] @@ -324,7 +323,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection public void Verify(int v) { - Assert.AreEqual(v, l); + Assert.Equal(v, l); } [NamedParameter(DefaultValue = "34567")] @@ -345,7 +344,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection public void Verify(float v) { - Assert.AreEqual(v, f); + Assert.Equal(v, f); } [NamedParameter(DefaultValue = "12.5")] http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestSetInjection.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestSetInjection.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestSetInjection.cs index a1e92fc..b896b49 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestSetInjection.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestSetInjection.cs @@ -20,12 +20,12 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Annotations; using Org.Apache.REEF.Tang.Formats; using Org.Apache.REEF.Tang.Implementations.Tang; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Util; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.Injection { @@ -40,10 +40,9 @@ namespace Org.Apache.REEF.Tang.Tests.Injection TimeSpan TimeshiftSpan { get; } } - [TestClass] public class TestSetInjection { - [TestMethod] + [Fact] public void TestStringInjectDefault() { Box b = (Box)TangFactory.GetTang().NewInjector().GetInstance(typeof(Box)); @@ -55,20 +54,20 @@ namespace Org.Apache.REEF.Tang.Tests.Injection expected.Add("two"); expected.Add("three"); - Assert.IsTrue(actual.Contains("one")); - Assert.IsTrue(actual.Contains("two")); - Assert.IsTrue(actual.Contains("three")); + Assert.True(actual.Contains("one")); + Assert.True(actual.Contains("two")); + Assert.True(actual.Contains("three")); } - [TestMethod] + [Fact] public void TestStringInjectNoDefault() { BoxNoDefault b = (BoxNoDefault)TangFactory.GetTang().NewInjector().GetInstance(typeof(BoxNoDefault)); ISet<string> actual = b.Numbers; - Assert.AreEqual(actual.Count, 0); + Assert.Equal(actual.Count, 0); } - [TestMethod] + [Fact] public void TestStringInjectNoDefaultWithValue() { var cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -77,10 +76,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection ISet<string> actual = b.Numbers; - Assert.AreEqual(actual.Count, 1); + Assert.Equal(actual.Count, 1); } - [TestMethod] + [Fact] public void TestObjectInjectDefault() { IInjector i = TangFactory.GetTang().NewInjector(); @@ -91,12 +90,12 @@ namespace Org.Apache.REEF.Tang.Tests.Injection expected.Add(new Integer(42)); expected.Add(new Float(42.0001f)); - Assert.IsTrue(actual.Contains(new Integer(42))); - Assert.IsTrue(actual.Contains(new Float(42.0001f))); - Assert.AreEqual(actual.Count, expected.Count); + Assert.True(actual.Contains(new Integer(42))); + Assert.True(actual.Contains(new Float(42.0001f))); + Assert.Equal(actual.Count, expected.Count); } - [TestMethod] + [Fact] public void TestBindVolatileParameterForSet() { IInjector i = TangFactory.GetTang().NewInjector(); @@ -106,11 +105,11 @@ namespace Org.Apache.REEF.Tang.Tests.Injection i.BindVolatileParameter(GenericType<SetOfClasses>.Class, numbers); ISet<INumber> actual = ((Pool)i.GetInstance(typeof(Pool))).Numbers; - Assert.IsTrue(actual.Contains(new Integer(42))); - Assert.IsTrue(actual.Contains(new Float(42.0001f))); + Assert.True(actual.Contains(new Integer(42))); + Assert.True(actual.Contains(new Float(42.0001f))); } - [TestMethod] + [Fact] public void TestInjectionWithSetFromSameInterface() { IConfiguration c = TangFactory.GetTang() @@ -125,11 +124,11 @@ namespace Org.Apache.REEF.Tang.Tests.Injection i.BindVolatileParameter(GenericType<SetOfClasses>.Class, numbers); var actual = ((PoolNumber)i.GetInstance(typeof(INumber))).Numbers; - Assert.IsTrue(actual.Contains(new Integer(42))); - Assert.IsTrue(actual.Contains(new Float(42.0001f))); + Assert.True(actual.Contains(new Integer(42))); + Assert.True(actual.Contains(new Float(42.0001f))); } - [TestMethod] + [Fact] public void TestStringInjectBound() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -144,13 +143,13 @@ namespace Org.Apache.REEF.Tang.Tests.Injection expected.Add("five"); expected.Add("six"); - Assert.IsTrue(actual.Contains("four")); - Assert.IsTrue(actual.Contains("five")); - Assert.IsTrue(actual.Contains("six")); - Assert.AreEqual(actual.Count, expected.Count); + Assert.True(actual.Contains("four")); + Assert.True(actual.Contains("five")); + Assert.True(actual.Contains("six")); + Assert.Equal(actual.Count, expected.Count); } - [TestMethod] + [Fact] public void TestObjectInjectBound() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -165,10 +164,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection ISet<INumber> expected = new HashSet<INumber>(); expected.Add(new Integer(4)); expected.Add(new Float(42.0001f)); - Assert.IsTrue(Utilities.Utilities.Equals<INumber>(actual, expected)); + Assert.True(Utilities.Utilities.Equals<INumber>(actual, expected)); } - [TestMethod] + [Fact] public void TestSetOfClassBound() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -181,20 +180,20 @@ namespace Org.Apache.REEF.Tang.Tests.Injection ISet<INumber> expected = new HashSet<INumber>(); expected.Add(new Integer1(4)); - Assert.IsTrue(Utilities.Utilities.Equals<INumber>(actual, expected)); + Assert.True(Utilities.Utilities.Equals<INumber>(actual, expected)); } - [TestMethod] + [Fact] public void TestSetOfClassWithDefault() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); ISet<INumber> actual = i.GetInstance<Pool1>().Numbers; - Assert.IsNotNull(actual); + Assert.NotNull(actual); } - [TestMethod] + [Fact] public void TestSetOfTimeshift() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -206,10 +205,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); ISet<ITimeshift> actual = i.GetInstance<SetofTimeShiftClass>().Timeshifts; - Assert.IsTrue(actual.Count == 1); + Assert.True(actual.Count == 1); } - [TestMethod] + [Fact] public void TestSetOfTimeshiftMultipleInstances() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -223,10 +222,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); ISet<ITimeshift> actual = i.GetInstance<SetofTimeShiftClass>().Timeshifts; - Assert.IsTrue(actual.Count == 1); + Assert.True(actual.Count == 1); } - [TestMethod] + [Fact] public void TestSetOfTimeshiftMultipleSubClasses() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -244,10 +243,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); ISet<ITimeshift> actual = i.GetInstance<SetofTimeShiftClass>().Timeshifts; - Assert.IsTrue(actual.Count == 2); + Assert.True(actual.Count == 2); } - [TestMethod] + [Fact] public void TestSetOfTimeshiftWithDefault() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -255,10 +254,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); ISet<ITimeshift> actual = i.GetInstance<SetofTimeShiftClass>().Timeshifts; - Assert.IsTrue(actual.Count == 1); + Assert.True(actual.Count == 1); } - [TestMethod] + [Fact] public void TestSetOfTimeshiftWithEmptySet() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -266,10 +265,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); ISet<ITimeshift> actual = i.GetInstance<SetofTimeShiftClassWithoutDefault>().Timeshifts; - Assert.IsTrue(actual.Count == 0); + Assert.True(actual.Count == 0); } - [TestMethod] + [Fact] public void TestObjectInjectRoundTrip() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -287,10 +286,10 @@ namespace Org.Apache.REEF.Tang.Tests.Injection ISet<INumber> expected = new HashSet<INumber>(); expected.Add(new Integer(4)); expected.Add(new Float(42.0001f)); - Assert.IsTrue(Utilities.Utilities.Equals<INumber>(actual, expected)); + Assert.True(Utilities.Utilities.Equals<INumber>(actual, expected)); } - [TestMethod] + [Fact] public void TestStringInjectRoundTrip() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); @@ -305,12 +304,12 @@ namespace Org.Apache.REEF.Tang.Tests.Injection ISet<string> actual = ((Box)TangFactory.GetTang().NewInjector(cb2.Build()).GetInstance(typeof(Box))).Numbers; - Assert.IsTrue(actual.Contains("four")); - Assert.IsTrue(actual.Contains("five")); - Assert.IsTrue(actual.Contains("six")); + Assert.True(actual.Contains("four")); + Assert.True(actual.Contains("five")); + Assert.True(actual.Contains("six")); } - [TestMethod] + [Fact] public void TestDefaultAsClass() { IInjector i = TangFactory.GetTang().NewInjector(); @@ -322,11 +321,11 @@ namespace Org.Apache.REEF.Tang.Tests.Injection ISet<INumber> expected = new HashSet<INumber>(); expected.Add(new Integer(1)); - Assert.AreEqual(expected.Count, actual.Count); - Assert.IsTrue(actual.Contains(new Integer(1))); + Assert.Equal(expected.Count, actual.Count); + Assert.True(actual.Contains(new Integer(1))); } - [TestMethod] + [Fact] public void TestInjectionExtension() { IInjector i = TangFactory.GetTang().NewInjector(); @@ -338,8 +337,8 @@ namespace Org.Apache.REEF.Tang.Tests.Injection ISet<INumber> expected = new HashSet<INumber>(); expected.Add(new Integer(1)); - Assert.AreEqual(expected.Count, actual.Count); - Assert.IsTrue(actual.Contains(new Integer(1))); + Assert.Equal(expected.Count, actual.Count); + Assert.True(actual.Contains(new Integer(1))); } [NamedParameter(DefaultValues = new string[] { "one", "two", "three" })] http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestDefaultConstructor.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestDefaultConstructor.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestDefaultConstructor.cs index f2f0b2e..1f0efbe 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestDefaultConstructor.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestDefaultConstructor.cs @@ -17,16 +17,15 @@ * under the License. */ -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Annotations; using Org.Apache.REEF.Tang.Implementations.Tang; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.ScenarioTest { - [TestClass] public class TestDefaultConstructor { - [TestMethod] + [Fact] public void TestDefaultConstructorWithoutBinding() { var r = (A)TangFactory.GetTang().NewInjector().GetInstance(typeof(A)); http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestHttpService.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestHttpService.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestHttpService.cs index 9674b77..6375376 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestHttpService.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestHttpService.cs @@ -18,19 +18,18 @@ */ using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Annotations; using Org.Apache.REEF.Tang.Formats; using Org.Apache.REEF.Tang.Implementations.Tang; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Util; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.ScenarioTest { - [TestClass] public class TestHttpService { - [TestMethod] + [Fact] public void HttpEventHandlersTest() { ConfigurationModule module = @@ -41,13 +40,13 @@ namespace Org.Apache.REEF.Tang.Tests.ScenarioTest IConfiguration c = module.Build(); var service = TangFactory.GetTang().NewInjector(c).GetInstance<HttpServer>(); - Assert.IsNotNull(service); + Assert.NotNull(service); var j = TangFactory.GetTang().NewInjector(c).GetInstance<HttpRunTimeStartHandler>(); - Assert.IsNotNull(j); + Assert.NotNull(j); } - [TestMethod] + [Fact] public void RuntimeStartHandlerTest() { ConfigurationModule module = @@ -59,17 +58,17 @@ namespace Org.Apache.REEF.Tang.Tests.ScenarioTest RuntimeClock clock = TangFactory.GetTang().NewInjector(clockConfiguraiton).GetInstance<RuntimeClock>(); var rh = clock.ClockRuntimeStartHandler.Get(); - Assert.AreEqual(rh.Count, 1); + Assert.Equal(rh.Count, 1); foreach (var e in rh) { - Assert.IsTrue(e is HttpRunTimeStartHandler); + Assert.True(e is HttpRunTimeStartHandler); HttpRunTimeStartHandler r = (HttpRunTimeStartHandler)e; var s = r.Server; - Assert.AreEqual(s.JettyHandler.HttpeventHanlders.Count, 0); // no handlers are bound + Assert.Equal(s.JettyHandler.HttpeventHanlders.Count, 0); // no handlers are bound } } - [TestMethod] + [Fact] public void RuntimeStartStopHandlerTest() { IConfiguration clockConfiguraiton = HttpRuntimeConfiguration.CONF.Build(); @@ -80,26 +79,26 @@ namespace Org.Apache.REEF.Tang.Tests.ScenarioTest HttpRunTimeStartHandler start = null; HttpRunTimeStopHandler stop = null; - Assert.AreEqual(starts.Count, 1); + Assert.Equal(starts.Count, 1); foreach (var e in starts) { - Assert.IsTrue(e is HttpRunTimeStartHandler); + Assert.True(e is HttpRunTimeStartHandler); start = (HttpRunTimeStartHandler)e; } - Assert.AreEqual(stops.Count, 1); + Assert.Equal(stops.Count, 1); foreach (var e in stops) { - Assert.IsTrue(e is HttpRunTimeStopHandler); + Assert.True(e is HttpRunTimeStopHandler); stop = (HttpRunTimeStopHandler)e; } - Assert.AreEqual(start.Server, stop.Server); - Assert.AreEqual(start.Server.JettyHandler.HttpeventHanlders, stop.Server.JettyHandler.HttpeventHanlders); - Assert.AreSame(start.Server, stop.Server); + Assert.Equal(start.Server, stop.Server); + Assert.Equal(start.Server.JettyHandler.HttpeventHanlders, stop.Server.JettyHandler.HttpeventHanlders); + Assert.Same(start.Server, stop.Server); } - [TestMethod] + [Fact] public void RuntimeStartHandlerMergeTest() { IConfiguration clockConfiguraiton = HttpHandlerConfiguration.CONF @@ -112,10 +111,10 @@ namespace Org.Apache.REEF.Tang.Tests.ScenarioTest RuntimeClock clock = TangFactory.GetTang().NewInjector(clockConfiguraiton).GetInstance<RuntimeClock>(); var rh = clock.ClockRuntimeStartHandler.Get(); - Assert.AreEqual(rh.Count, 1); + Assert.Equal(rh.Count, 1); foreach (var e in rh) { - Assert.IsTrue(e is HttpRunTimeStartHandler); + Assert.True(e is HttpRunTimeStartHandler); HttpRunTimeStartHandler r = (HttpRunTimeStartHandler)e; var s = r.Server; foreach (IHttpHandler h in s.JettyHandler.HttpeventHanlders) http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestRuntimeClock.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestRuntimeClock.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestRuntimeClock.cs index 11daac8..d5d9956 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestRuntimeClock.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestRuntimeClock.cs @@ -19,13 +19,13 @@ using System; using System.Collections.Generic; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Annotations; using Org.Apache.REEF.Tang.Formats; using Org.Apache.REEF.Tang.Implementations.InjectionPlan; using Org.Apache.REEF.Tang.Implementations.Tang; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Util; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.ScenarioTest { @@ -50,18 +50,17 @@ namespace Org.Apache.REEF.Tang.Tests.ScenarioTest void OnNext(T value); } - [TestClass] public class TestScenarios { - [TestMethod] + [Fact] public void TestRuntimeClock() { var r = (RuntimeClock)TangFactory.GetTang().NewInjector().GetInstance(typeof(RuntimeClock)); - Assert.IsNotNull(r); + Assert.NotNull(r); r.CurrentTime(); } - [TestMethod] + [Fact] public void TestEvaluatorRuntime() { ConfigurationModule module = @@ -72,10 +71,10 @@ namespace Org.Apache.REEF.Tang.Tests.ScenarioTest RuntimeClock clock = TangFactory.GetTang().NewInjector(clockConfiguration).GetInstance<RuntimeClock>(); var r = clock.ClockRuntimeStartHandler.Get(); - Assert.AreEqual(r.Count, 1); + Assert.Equal(r.Count, 1); foreach (var e in r) { - Assert.IsTrue(e is EvaluatorRuntime); + Assert.True(e is EvaluatorRuntime); } } } http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestTrackingURIProvider.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestTrackingURIProvider.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestTrackingURIProvider.cs index b7cd55a..8ce6e0f 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestTrackingURIProvider.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ScenarioTest/TestTrackingURIProvider.cs @@ -17,42 +17,41 @@ * under the License. */ -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Implementations.Tang; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Util; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.ScenarioTest { - [TestClass] public class TestTrackingURIProvider { - [TestMethod] + [Fact] public void TrackingIdThroughNamedParameterTest() { ICsConfigurationBuilder cba = TangFactory.GetTang().NewConfigurationBuilder(); string trackingId = System.Environment.MachineName + ":8080"; cba.BindNamedParameter<TrackingId, string>(GenericType<TrackingId>.Class, trackingId); string id = (string)TangFactory.GetTang().NewInjector(cba.Build()).GetNamedInstance(typeof(TrackingId)); - Assert.AreEqual(id, trackingId); + Assert.Equal(id, trackingId); } - [TestMethod] + [Fact] public void DefaultTrackingIdThroughInterfaceTest() { string trackingId = System.Environment.MachineName + ":8080"; var id = TangFactory.GetTang().NewInjector().GetInstance<ITrackingURIProvider>(); - Assert.AreEqual(id.GetURI(), trackingId); + Assert.Equal(id.GetURI(), trackingId); } - [TestMethod] + [Fact] public void TrackingIdThroughInterfaceTest() { ICsConfigurationBuilder cba = TangFactory.GetTang().NewConfigurationBuilder(); cba.BindNamedParameter<PortNumber, string>(GenericType<PortNumber>.Class, "8080"); string trackingId = System.Environment.MachineName + ":8080"; var id = TangFactory.GetTang().NewInjector().GetInstance<ITrackingURIProvider>(); - Assert.AreEqual(id.GetURI(), trackingId); + Assert.Equal(id.GetURI(), trackingId); } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/SmokeTest/ObjectTreeTest.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/SmokeTest/ObjectTreeTest.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/SmokeTest/ObjectTreeTest.cs index 2d89037..5c022e4 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/SmokeTest/ObjectTreeTest.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/SmokeTest/ObjectTreeTest.cs @@ -17,13 +17,12 @@ * under the License. */ -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Implementations.Tang; using Org.Apache.REEF.Tang.Interface; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.SmokeTest { - [TestClass] public class ObjectTreeTest { public static IConfiguration GetConfiguration() @@ -34,21 +33,21 @@ namespace Org.Apache.REEF.Tang.Tests.SmokeTest .Build(); } - [TestMethod] + [Fact] public void TestInstantiation() { IRootInterface root = TangFactory.GetTang().NewInjector(GetConfiguration()).GetInstance<IRootInterface>(); - Assert.IsTrue(root.IsValid(), "Object instantiation left us in an inconsistent state."); + Assert.True(root.IsValid(), "Object instantiation left us in an inconsistent state."); } - [TestMethod] + [Fact] public void TestTwoInstantiations() { IRootInterface firstRoot = TangFactory.GetTang().NewInjector(GetConfiguration()).GetInstance<IRootInterface>(); IRootInterface secondRoot = TangFactory.GetTang().NewInjector(GetConfiguration()).GetInstance<IRootInterface>(); - Assert.AreNotSame(firstRoot, secondRoot, "Two instantiations of the object tree should not be the same"); - Assert.AreEqual(firstRoot, secondRoot, "Two instantiations of the object tree should be equal"); + Assert.False(firstRoot == secondRoot, "Two instantiations of the object tree should not be the same"); + Assert.True(firstRoot.Equals(secondRoot), "Two instantiations of the object tree should be equal"); } } } http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestDefaultImpementaion.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestDefaultImpementaion.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestDefaultImpementaion.cs index b7bf6ff..9702038 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestDefaultImpementaion.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestDefaultImpementaion.cs @@ -17,12 +17,12 @@ * under the License. */ -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Annotations; using Org.Apache.REEF.Tang.Exceptions; using Org.Apache.REEF.Tang.Implementations.Tang; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Util; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.Tang { @@ -46,41 +46,40 @@ namespace Org.Apache.REEF.Tang.Tests.Tang void aMethod(); } - [TestClass] public class TestDefaultImplementation { - [TestMethod] + [Fact] public void TestDefaultConstructor() { ClassWithDefaultConstructor impl = (ClassWithDefaultConstructor)TangFactory.GetTang().NewInjector().GetInstance(typeof(ClassWithDefaultConstructor)); - Assert.IsNotNull(impl); + Assert.NotNull(impl); } - [TestMethod] + [Fact] public void TestDefaultImpl() { ClassWithDefaultConstructor impl = (ClassWithDefaultConstructor)TangFactory.GetTang().NewInjector().GetInstance(typeof(ClassWithDefaultConstructor)); - Assert.IsNotNull(impl); + Assert.NotNull(impl); } - [TestMethod] + [Fact] public void TestDefaultImplOnInterface() { IAnInterface impl = (IAnInterface)TangFactory.GetTang().NewInjector().GetInstance(typeof(IAnInterface)); - Assert.IsNotNull(impl); + Assert.NotNull(impl); impl.aMethod(); } - [TestMethod] + [Fact] public void TestGetInstanceOfNamedParameter() { IConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); IInjector i = TangFactory.GetTang().NewInjector(cb.Build()); IfaceWithDefault iwd = i.GetNamedInstance<IfaceWithDefaultName, IfaceWithDefault>(GenericType<IfaceWithDefaultName>.Class); - Assert.IsNotNull(iwd); + Assert.NotNull(iwd); } - [TestMethod] + [Fact] public void TestCantGetInstanceOfNamedParameter() { string msg = null; @@ -95,37 +94,37 @@ namespace Org.Apache.REEF.Tang.Tests.Tang { System.Diagnostics.Debug.WriteLine(e); } - Assert.IsNull(msg); + Assert.Null(msg); } - [TestMethod] + [Fact] public void TestCanGetDefaultedInterface() { - Assert.IsNotNull(TangFactory.GetTang().NewInjector().GetInstance<IHaveDefaultImpl>()); + Assert.NotNull(TangFactory.GetTang().NewInjector().GetInstance<IHaveDefaultImpl>()); } - [TestMethod] + [Fact] public void TestCanOverrideDefaultedInterface() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); cb.BindImplementation(GenericType<IHaveDefaultImpl>.Class, GenericType<OverrideDefaultImpl>.Class); var o = TangFactory.GetTang().NewInjector(cb.Build()).GetInstance<IHaveDefaultImpl>(); - Assert.IsTrue(o is OverrideDefaultImpl); + Assert.True(o is OverrideDefaultImpl); } - [TestMethod] + [Fact] public void TestCanGetStringDefaultedInterface() { - Assert.IsNotNull(TangFactory.GetTang().NewInjector().GetInstance<IHaveDefaultStringImpl>()); + Assert.NotNull(TangFactory.GetTang().NewInjector().GetInstance<IHaveDefaultStringImpl>()); } - [TestMethod] + [Fact] public void TestCanOverrideStringDefaultedInterface() { ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder(); cb.BindImplementation(GenericType<IHaveDefaultStringImpl>.Class, GenericType<OverrideDefaultStringImpl>.Class); var o = TangFactory.GetTang().NewInjector(cb.Build()).GetInstance<IHaveDefaultStringImpl>(); - Assert.IsTrue(o is OverrideDefaultStringImpl); + Assert.True(o is OverrideDefaultStringImpl); } } http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestExternalConstructors.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestExternalConstructors.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestExternalConstructors.cs index 6e8f4a0..1b40c68 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestExternalConstructors.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestExternalConstructors.cs @@ -17,26 +17,24 @@ * under the License. */ -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Annotations; using Org.Apache.REEF.Tang.Implementations.Tang; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Util; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.Tang { - [TestClass] public class TestExternalConstructors { static ITang tang; - [TestInitialize] - public void TestSetup() + public TestExternalConstructors() { tang = TangFactory.GetTang(); } - [TestMethod] + [Fact] public void TestBindConstructor() { ICsConfigurationBuilder b = TangFactory.GetTang().NewConfigurationBuilder(); @@ -46,16 +44,16 @@ namespace Org.Apache.REEF.Tang.Tests.Tang TangFactory.GetTang().NewInjector(b.Build()).GetInstance(typeof(B)); } - [TestMethod] + [Fact] public void TestSImpleExternalConstructor() { ICsConfigurationBuilder b = TangFactory.GetTang().NewConfigurationBuilder(); b.BindConstructor(GenericType<A>.Class, GenericType<ACons>.Class); A aRef = (A)TangFactory.GetTang().NewInjector(b.Build()).GetInstance(typeof(A)); - Assert.IsNotNull(aRef); + Assert.NotNull(aRef); } - [TestMethod] + [Fact] public void TestExternalLegacyConstructor() { ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(); @@ -64,8 +62,8 @@ namespace Org.Apache.REEF.Tang.Tests.Tang i.BindVolatileInstance(GenericType<int>.Class, 42); i.BindVolatileInstance(GenericType<string>.Class, "The meaning of life is "); ExternalConstructorExample.Legacy l = i.GetInstance<ExternalConstructorExample.Legacy>(); - Assert.AreEqual(42, l.X); - Assert.AreEqual("The meaning of life is ", l.Y); + Assert.Equal(42, l.X); + Assert.Equal("The meaning of life is ", l.Y); } public class A http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestLegacyConstructors.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestLegacyConstructors.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestLegacyConstructors.cs index ab6f7d0..e495888 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestLegacyConstructors.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestLegacyConstructors.cs @@ -18,25 +18,23 @@ */ using System.Collections.Generic; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Implementations.Tang; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Util; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.Tang { - [TestClass] public class TestLegacyConstructors { static ITang tang; - [TestInitialize] - public void TestSetup() + public TestLegacyConstructors() { tang = TangFactory.GetTang(); } - [TestMethod] + [Fact] public void TestLegacyConstructor() { ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(); @@ -52,8 +50,8 @@ namespace Org.Apache.REEF.Tang.Tests.Tang i.BindVolatileInstance(GenericType<int>.Class, 42); i.BindVolatileInstance(GenericType<string>.Class, "The meaning of life is "); LegacyConstructor l = i.GetInstance<LegacyConstructor>(); - Assert.AreEqual(42, l.X); - Assert.AreEqual("The meaning of life is ", l.Y); + Assert.Equal(42, l.X); + Assert.Equal("The meaning of life is ", l.Y); } } http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Utilities/AssemblyLoaderTests.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Utilities/AssemblyLoaderTests.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Utilities/AssemblyLoaderTests.cs index 0ce2057..63b0de3 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Utilities/AssemblyLoaderTests.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Utilities/AssemblyLoaderTests.cs @@ -16,27 +16,26 @@ // under the License. using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Examples; using Org.Apache.REEF.Tang.Util; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.Utilities { - [TestClass] public class AssemblyLoaderTests { - [TestMethod] + [Fact] public void AssemblyLoadingFailsNoException() { var notUsed = new AssemblyLoader(new[] { "DoesNotExist.dll" }); } - [TestMethod] + [Fact] public void AssemblyLoadingSomeSucceedFailuresAreIgnored() { var loader = new AssemblyLoader(new[] { "DoesNotExist.dll", FileNames.Examples }); - Assert.AreEqual(1, loader.Assemblies.Count); - Assert.IsTrue(loader.Assemblies.First().GetName().Name == FileNames.Examples); + Assert.Equal(1, loader.Assemblies.Count); + Assert.True(loader.Assemblies.First().GetName().Name == FileNames.Examples); } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Utilities/TestUtilities.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Utilities/TestUtilities.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Utilities/TestUtilities.cs index 41102ec..3ed12b9 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Utilities/TestUtilities.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Utilities/TestUtilities.cs @@ -20,47 +20,46 @@ using System; using System.Collections.Generic; using System.Reflection; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Org.Apache.REEF.Tang.Examples; using Org.Apache.REEF.Tang.Formats; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Util; +using Xunit; namespace Org.Apache.REEF.Tang.Tests.Utilities { - [TestClass] public class TestUtilities { - [TestMethod] + [Fact] public void TestIsAssignableFromIgnoreGeneric() { var result = ReflectionUtilities.IsAssignableFromIgnoreGeneric(typeof(IExternalConstructor<>), typeof(Foo)); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void TestIsAssignableFromIgnoreGenericNegtive() { var result = ReflectionUtilities.IsAssignableFromIgnoreGeneric(typeof(ISet<>), typeof(Foo)); - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void TestIsInstanceOfGeneric() { var p1 = new OptionalParameter<int>(); bool r1 = ReflectionUtilities.IsInstanceOfGeneric(p1, typeof(OptionalParameter<>)); var p2 = new RequiredParameter<string>(); bool r2 = ReflectionUtilities.IsInstanceOfGeneric(p2, typeof(RequiredParameter<>)); - Assert.IsTrue(r1); - Assert.IsTrue(r2); + Assert.True(r1); + Assert.True(r2); } - [TestMethod] + [Fact] public void TestGetInterfaceTargetForTypeInheritFromGeneric() { Type result = ReflectionUtilities.GetInterfaceTarget(typeof(IExternalConstructor<>), typeof(Foo)); - Assert.AreEqual(result, typeof(Int32)); + Assert.Equal(result, typeof(Int32)); } class Foo : IExternalConstructor<Int32> @@ -71,7 +70,7 @@ namespace Org.Apache.REEF.Tang.Tests.Utilities } } - [TestMethod] + [Fact] public void TestGetEnclosingClassShortNameByType() { var asm = Assembly.Load(FileNames.Examples); @@ -79,35 +78,35 @@ namespace Org.Apache.REEF.Tang.Tests.Utilities Type timer = asm.GetType(FileNames.Timer); string[] pathSeconds = ReflectionUtilities.GetEnclosingClassNames(seconds); - Assert.AreEqual(pathSeconds[0], timer.AssemblyQualifiedName); - Assert.AreEqual(pathSeconds[1], seconds.AssemblyQualifiedName); + Assert.Equal(pathSeconds[0], timer.AssemblyQualifiedName); + Assert.Equal(pathSeconds[1], seconds.AssemblyQualifiedName); string[] pathTime = ReflectionUtilities.GetEnclosingClassNames(timer); - Assert.AreEqual(pathTime[0], timer.AssemblyQualifiedName); + Assert.Equal(pathTime[0], timer.AssemblyQualifiedName); } - [TestMethod] + [Fact] public void TestGetName() { var asm = Assembly.Load(FileNames.Examples); Type B2 = asm.GetType(FileNames.B2); string n = ReflectionUtilities.GetName(B2); - Assert.AreEqual(n, B2.FullName); + Assert.Equal(n, B2.FullName); } - [TestMethod] + [Fact] public void TestGetEnclosingTypesInclusive() { var asm = Assembly.Load(FileNames.Examples); Type B2 = asm.GetType(FileNames.B2); Type[] ts = ReflectionUtilities.GetEnclosingClasses(B2); - Assert.AreEqual(ts[0], asm.GetType(FileNames.B)); - Assert.AreEqual(ts[1], asm.GetType(FileNames.B1)); - Assert.AreEqual(ts[2], asm.GetType(FileNames.B2)); + Assert.Equal(ts[0], asm.GetType(FileNames.B)); + Assert.Equal(ts[1], asm.GetType(FileNames.B1)); + Assert.Equal(ts[2], asm.GetType(FileNames.B2)); } - [TestMethod] + [Fact] public void TestGetEnclosingClassShortNameByName() { var asm = Assembly.Load(FileNames.Examples); @@ -116,12 +115,12 @@ namespace Org.Apache.REEF.Tang.Tests.Utilities Type b2 = asm.GetType(FileNames.B2); string[] path = ReflectionUtilities.GetEnclosingClassNames(FileNames.B2); - Assert.AreEqual(path[0], b.AssemblyQualifiedName); - Assert.AreEqual(path[1], b1.AssemblyQualifiedName); - Assert.AreEqual(path[2], b2.AssemblyQualifiedName); + Assert.Equal(path[0], b.AssemblyQualifiedName); + Assert.Equal(path[1], b1.AssemblyQualifiedName); + Assert.Equal(path[2], b2.AssemblyQualifiedName); } - [TestMethod] + [Fact] public void TestGetEnclosingClassShortNameByFullName() { var asm = Assembly.Load(FileNames.Examples); @@ -130,12 +129,12 @@ namespace Org.Apache.REEF.Tang.Tests.Utilities Type b1 = asm.GetType(FileNames.B1); Type b2 = asm.GetType(FileNames.B2); string[] path = ReflectionUtilities.GetEnclosingClassNames(c.FullName); - Assert.AreEqual(path[0], b.AssemblyQualifiedName); - Assert.AreEqual(path[1], b1.AssemblyQualifiedName); - Assert.AreEqual(path[2], b2.AssemblyQualifiedName); + Assert.Equal(path[0], b.AssemblyQualifiedName); + Assert.Equal(path[1], b1.AssemblyQualifiedName); + Assert.Equal(path[2], b2.AssemblyQualifiedName); } - [TestMethod] + [Fact] public void TestGetEnclosingClassShortNameByAssemblyQualifiedName() { var asm = Assembly.Load(FileNames.Examples); @@ -146,12 +145,12 @@ namespace Org.Apache.REEF.Tang.Tests.Utilities string[] path = ReflectionUtilities.GetEnclosingClassNames(c.AssemblyQualifiedName); - Assert.AreEqual(path[0], b.AssemblyQualifiedName); - Assert.AreEqual(path[1], b1.AssemblyQualifiedName); - Assert.AreEqual(path[2], b2.AssemblyQualifiedName); + Assert.Equal(path[0], b.AssemblyQualifiedName); + Assert.Equal(path[1], b1.AssemblyQualifiedName); + Assert.Equal(path[2], b2.AssemblyQualifiedName); } - [TestMethod] + [Fact] public void AssemblyNamesTest() { var asm = Assembly.Load(FileNames.Examples); @@ -171,22 +170,22 @@ namespace Org.Apache.REEF.Tang.Tests.Utilities } } - [TestMethod] + [Fact] public void TestGetInterfaceTargetForGenericType() { Type iface = typeof(ISet<>); Type type = typeof(MySet<string>); Type p = ReflectionUtilities.GetInterfaceTarget(iface, type); - Assert.IsTrue(p.Equals(typeof(string))); + Assert.True(p.Equals(typeof(string))); } - [TestMethod] + [Fact] public void TestGetInterfaceTargetForSystemGenericType() { Type iface = typeof(ISet<>); Type type = typeof(ISet<int>); Type p = ReflectionUtilities.GetInterfaceTarget(iface, type); - Assert.IsTrue(p.Equals(typeof(int))); + Assert.True(p.Equals(typeof(int))); } }
