You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by do...@apache.org on 2015/12/04 17:15:02 UTC
[1/2] reef git commit: [REEF-1030] Migrate Tang tests which use only
simple attributes to xUnit
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)));
}
}
[2/2] reef git commit: [REEF-1030] Migrate Tang tests which use only
simple attributes to xUnit
Posted by do...@apache.org.
[REEF-1030] Migrate Tang tests which use only simple attributes to xUnit
This migrates first batch of Tang tests to xUnit.
JIRA:
[REEF-1030](https://issues.apache.org/jira/browse/REEF-1030)
Pull request:
This closes #692
Project: http://git-wip-us.apache.org/repos/asf/reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/9c36dba5
Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/9c36dba5
Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/9c36dba5
Branch: refs/heads/master
Commit: 9c36dba5504ef5a56fccf763a976cefdab43e6e6
Parents: 13e4572
Author: Mariia Mykhailova <ma...@apache.org>
Authored: Tue Dec 1 15:58:21 2015 -0800
Committer: Dongjoon Hyun <do...@apache.org>
Committed: Sat Dec 5 00:25:39 2015 +0900
----------------------------------------------------------------------
.../ClassHierarchy/TestAvroSerialization.cs | 85 ++++-------
.../ClassHierarchy/TestClassHierarchy.cs | 153 +++++++++----------
.../ClassHierarchy/TestGeneric.cs | 8 +-
.../ClassHierarchy/TestMultipleInterface.cs | 5 +-
.../ClassHierarchy/TestNamedParameter.cs | 33 ++--
.../ClassHierarchy/TestParameterParser.cs | 61 ++++----
.../Configuration/TestAvroConfiguration.cs | 9 +-
.../Configuration/TestConfiguration.cs | 86 +++++------
.../TestCsConfigurationBuilderExtension.cs | 53 ++++---
.../Format/TestConfigurationModule.cs | 117 ++++++--------
.../Format/TestConfigurationModuleForList.cs | 27 ++--
.../Format/TestTaskConfiguration.cs | 21 ++-
.../Injection/TestAmbigousConstructors.cs | 7 +-
.../Injection/TestInjectionFuture.cs | 55 ++++---
.../Injection/TestListInjection.cs | 133 ++++++++--------
.../Injection/TestMissingParameters.cs | 23 ++-
.../Injection/TestMissingParamtersInNested.cs | 23 ++-
.../Injection/TestMultipleConstructors.cs | 53 ++++---
.../Injection/TestNamedParameter.cs | 45 +++---
.../Injection/TestSetInjection.cs | 105 +++++++------
.../ScenarioTest/TestDefaultConstructor.cs | 5 +-
.../ScenarioTest/TestHttpService.cs | 39 +++--
.../ScenarioTest/TestRuntimeClock.cs | 13 +-
.../ScenarioTest/TestTrackingURIProvider.cs | 15 +-
.../SmokeTest/ObjectTreeTest.cs | 13 +-
.../Tang/TestDefaultImpementaion.cs | 39 +++--
.../Tang/TestExternalConstructors.cs | 18 +--
.../Tang/TestLegacyConstructors.cs | 12 +-
.../Utilities/AssemblyLoaderTests.cs | 11 +-
.../Utilities/TestUtilities.cs | 75 +++++----
30 files changed, 627 insertions(+), 715 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestAvroSerialization.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestAvroSerialization.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestAvroSerialization.cs
index ea6a112..ee0dd07 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestAvroSerialization.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestAvroSerialization.cs
@@ -20,7 +20,6 @@
using System;
using System.IO;
using Microsoft.Hadoop.Avro;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Examples.Tasks.HelloTask;
using Org.Apache.REEF.Tang.Examples;
using Org.Apache.REEF.Tang.Implementations.ClassHierarchy;
@@ -28,40 +27,20 @@ using Org.Apache.REEF.Tang.Implementations.ClassHierarchy.AvroDataContract;
using Org.Apache.REEF.Tang.Implementations.Tang;
using Org.Apache.REEF.Tang.Interface;
using Org.Apache.REEF.Tang.Types;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
{
- [TestClass]
public class TestAvroSerialization
{
private AvroClassHierarchySerializer _serializer =
(AvroClassHierarchySerializer)TangFactory.GetTang().NewInjector().GetInstance<IClassHierarchySerializer>();
- [ClassInitialize]
- public static void ClassSetup(TestContext context)
- {
- }
-
- [ClassCleanup]
- public static void ClassCleanup()
- {
- }
-
- [TestInitialize]
- public void TestSetup()
- {
- }
-
- [TestCleanup]
- public void TestCleanup()
- {
- }
-
/// <summary>
/// This test is to convert an ClassHierarchy into AvroNode object, and then convert it back to an
/// AvroClassHierarchy.
/// </summary>
- [TestMethod]
+ [Fact]
public void TestToFromAvroNode()
{
Type timerType = typeof(Timer);
@@ -81,9 +60,9 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
INode secondNode2 = ns2.GetNode(secondType.AssemblyQualifiedName);
IClassNode simpleConstructorsClassNode2 = (IClassNode)ns2.GetNode(simpleConstructorType.AssemblyQualifiedName);
- Assert.AreEqual(timerClassNode, timerClassNode2);
- Assert.AreEqual(secondNode, secondNode2);
- Assert.AreEqual(simpleConstructorsClassNode, simpleConstructorsClassNode2);
+ Assert.Equal(timerClassNode, timerClassNode2);
+ Assert.Equal(secondNode, secondNode2);
+ Assert.Equal(simpleConstructorsClassNode, simpleConstructorsClassNode2);
}
/// <summary>
@@ -92,18 +71,18 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
/// I have manually synced all the IList into List in auto generated code. Otherwise AvroSerializer.Create<AvroNode>() will throw the following error
/// "Could not find any matching known type for 'System.Collections.Generic.IList`1[Org.Apache.REEF.Tang.Implementations.ClassHierarchy.AvroDataContract.AvroConstructorDef]'."
/// </summary>
- [TestMethod]
+ [Fact]
public void TestGetSchema()
{
var serializer = AvroSerializer.Create<AvroNode>();
var s = serializer.WriterSchema.ToString();
- Assert.IsNotNull(s);
+ Assert.NotNull(s);
}
/// <summary>
/// This test is to merge two AvroClassHierarchies
/// </summary>
- [TestMethod]
+ [Fact]
public void TestAvroClassHierarchyMerge()
{
IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(
@@ -125,30 +104,30 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
IClassNode timerClassNode2 = (IClassNode)ns5.GetNode(typeof(Timer).AssemblyQualifiedName);
IClassNode avroNodeClassNode2 = (IClassNode)ns5.GetNode(typeof(AvroNode).AssemblyQualifiedName);
- Assert.AreEqual(timerClassNode, timerClassNode2);
- Assert.AreEqual(avroNodeClassNode, avroNodeClassNode2);
+ Assert.Equal(timerClassNode, timerClassNode2);
+ Assert.Equal(avroNodeClassNode, avroNodeClassNode2);
}
/// <summary>
/// Test serialize a class hierarchy into a test file
/// </summary>
- [TestMethod]
+ [Fact]
public void TestToTextFileForTask()
{
IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(new string[] { typeof(HelloTask).Assembly.GetName().Name });
_serializer.ToTextFile(ns, "avroTask.bin");
- Assert.IsTrue(File.Exists("avroTask.bin"));
+ Assert.True(File.Exists("avroTask.bin"));
}
/// <summary>
/// Test serialize a class hierarchy into a JSon string
/// </summary>
- [TestMethod]
+ [Fact]
public void TestToString()
{
IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(new string[] { typeof(HelloTask).Assembly.GetName().Name });
string s = _serializer.ToString(ns);
- Assert.IsNotNull(s);
+ Assert.NotNull(s);
}
/// <summary>
@@ -157,8 +136,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
/// Unable to cast object of type 'Newtonsoft.Json.Linq.JObject' to type 'Org.Apache.REEF.Tang.Implementations.ClassHierarchy.AvroDataContract.AvroClassNode'.
/// This is because auto generated code use object as return type instead of AvroClassNode
/// </summary>
- [Ignore] // TODO: after Avro fix the issue. Enable the test
- [TestMethod]
+ [Fact(Skip = "TODO: after Avro fix the issue, enable the test")]
public void TestToFromJsonString()
{
Type timerType = typeof(Timer);
@@ -178,9 +156,9 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
INode secondNode2 = ns2.GetNode(secondType.AssemblyQualifiedName);
IClassNode simpleConstructorsClassNode2 = (IClassNode)ns2.GetNode(simpleConstructorType.AssemblyQualifiedName);
- Assert.AreEqual(timerClassNode, timerClassNode2);
- Assert.AreEqual(secondNode, secondNode2);
- Assert.AreEqual(simpleConstructorsClassNode, simpleConstructorsClassNode2);
+ Assert.Equal(timerClassNode, timerClassNode2);
+ Assert.Equal(secondNode, secondNode2);
+ Assert.Equal(simpleConstructorsClassNode, simpleConstructorsClassNode2);
}
/// <summary>
@@ -189,8 +167,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
/// Unable to cast object of type 'Newtonsoft.Json.Linq.JObject' to type 'Org.Apache.REEF.Tang.Implementations.ClassHierarchy.AvroDataContract.AvroClassNode'.
/// This is because auto generated code use object as return type instead of AvroClassNode
/// </summary>
- [Ignore] // TODO: after Avro fix the issue. Enable the test
- [TestMethod]
+ [Fact(Skip = "TODO: after Avro fix the issue, enable the test")]
public void TestToFromTextFile()
{
Type timerType = typeof(Timer);
@@ -210,17 +187,16 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
INode secondNode2 = ns2.GetNode(secondType.AssemblyQualifiedName);
IClassNode simpleConstructorsClassNode2 = (IClassNode)ns2.GetNode(simpleConstructorType.AssemblyQualifiedName);
- Assert.AreEqual(timerClassNode, timerClassNode2);
- Assert.AreEqual(secondNode, secondNode2);
- Assert.AreEqual(simpleConstructorsClassNode, simpleConstructorsClassNode2);
+ Assert.Equal(timerClassNode, timerClassNode2);
+ Assert.Equal(secondNode, secondNode2);
+ Assert.Equal(simpleConstructorsClassNode, simpleConstructorsClassNode2);
}
/// <summary>
/// Test serialize a class hierarchy to a file and deserialize from the file
/// Currently, in ToFile() method, writer.Write(avroNodeData) throw exception "Value cannot be null.\r\nParameter name: value".
/// </summary>
- [Ignore] // TODO: after Avro fix the issue. Enable the test
- [TestMethod]
+ [Fact(Skip = "TODO: after Avro fix the issue, enable the test")]
public void TestToFromFile()
{
Type timerType = typeof(Timer);
@@ -240,17 +216,16 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
INode secondNode2 = ns2.GetNode(secondType.AssemblyQualifiedName);
IClassNode simpleConstructorsClassNode2 = (IClassNode)ns2.GetNode(simpleConstructorType.AssemblyQualifiedName);
- Assert.AreEqual(timerClassNode, timerClassNode2);
- Assert.AreEqual(secondNode, secondNode2);
- Assert.AreEqual(simpleConstructorsClassNode, simpleConstructorsClassNode2);
+ Assert.Equal(timerClassNode, timerClassNode2);
+ Assert.Equal(secondNode, secondNode2);
+ Assert.Equal(simpleConstructorsClassNode, simpleConstructorsClassNode2);
}
/// <summary>
/// Test serialize class hierarchy to byte array and deserializa back to class hierarchy
/// AvroSerializer.Serialize(stream, obj) doesn't allow any null values in the obj to be serialized even if it is nullable
/// </summary>
- [Ignore] // TODO: after Avro fix the issue. Enable the test
- [TestMethod]
+ [Fact(Skip = "TODO: after Avro fix the issue, enable the test")]
public void TestToFromByteArray()
{
Type timerType = typeof(Timer);
@@ -270,9 +245,9 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
INode secondNode2 = ns2.GetNode(secondType.AssemblyQualifiedName);
IClassNode simpleConstructorsClassNode2 = (IClassNode)ns2.GetNode(simpleConstructorType.AssemblyQualifiedName);
- Assert.AreEqual(timerClassNode, timerClassNode2);
- Assert.AreEqual(secondNode, secondNode2);
- Assert.AreEqual(simpleConstructorsClassNode, simpleConstructorsClassNode2);
+ Assert.Equal(timerClassNode, timerClassNode2);
+ Assert.Equal(secondNode, secondNode2);
+ Assert.Equal(simpleConstructorsClassNode, simpleConstructorsClassNode2);
}
}
}
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs
index 788d756..fa64ff1 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs
@@ -19,7 +19,6 @@
using System;
using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Common.Tasks;
using Org.Apache.REEF.Examples.Tasks.HelloTask;
using Org.Apache.REEF.Tang.Annotations;
@@ -29,16 +28,15 @@ 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.ClassHierarchy
{
- [TestClass]
public class TestClassHierarchy
{
public IClassHierarchy ns = null;
- [TestInitialize]
- public void TestSetup()
+ public TestClassHierarchy()
{
if (ns == null)
{
@@ -47,12 +45,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
}
}
- [TestCleanup]
- public void TestCleanup()
- {
- }
-
- [TestMethod]
+ [Fact]
public void TestString()
{
INode n = null;
@@ -66,9 +59,9 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
catch (NameResolutionException)
{
}
- Assert.IsNull(n);
+ Assert.Null(n);
- Assert.IsNotNull(ns.GetNode(typeof(System.String).AssemblyQualifiedName));
+ Assert.NotNull(ns.GetNode(typeof(System.String).AssemblyQualifiedName));
string msg = null;
try
@@ -83,10 +76,10 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
{
}
- Assert.IsNull(msg, msg);
+ Assert.True(msg == null, msg);
}
- [TestMethod]
+ [Fact]
public void TestInt()
{
INode n = null;
@@ -100,9 +93,9 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
catch (NameResolutionException)
{
}
- Assert.IsNull(n);
+ Assert.Null(n);
- Assert.IsNotNull(ns.GetNode(typeof(System.Int32).AssemblyQualifiedName));
+ Assert.NotNull(ns.GetNode(typeof(System.Int32).AssemblyQualifiedName));
string msg = null;
try
@@ -117,159 +110,159 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
{
}
- Assert.IsNull(msg, msg);
+ Assert.True(msg == null, msg);
}
- [TestMethod]
+ [Fact]
public void TestSimpleConstructors()
{
IClassNode cls = (IClassNode)ns.GetNode(typeof(SimpleConstructors).AssemblyQualifiedName);
- Assert.IsTrue(cls.GetChildren().Count == 0);
+ Assert.True(cls.GetChildren().Count == 0);
IList<IConstructorDef> def = cls.GetInjectableConstructors();
- Assert.AreEqual(3, def.Count);
+ Assert.Equal(3, def.Count);
}
- [TestMethod]
+ [Fact]
public void TestTimer()
{
IClassNode timerClassNode = (IClassNode)ns.GetNode(typeof(Timer).AssemblyQualifiedName);
INode secondNode = ns.GetNode(typeof(Timer.Seconds).AssemblyQualifiedName);
- Assert.AreEqual(secondNode.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(Timer.Seconds)));
+ Assert.Equal(secondNode.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(Timer.Seconds)));
}
- [TestMethod]
+ [Fact]
public void TestNamedParameterConstructors()
{
var node = ns.GetNode(typeof(NamedParameterConstructors).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(NamedParameterConstructors)));
+ Assert.Equal(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(NamedParameterConstructors)));
}
- [TestMethod]
+ [Fact]
public void TestArray()
{
Type t = (new string[0]).GetType();
INode node = ns.GetNode(t.AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), t.AssemblyQualifiedName);
+ Assert.Equal(node.GetFullName(), t.AssemblyQualifiedName);
}
- [TestMethod]
+ [Fact]
public void TestRepeatConstructorArg()
{
TestNegativeCase(typeof(RepeatConstructorArg),
"Repeated constructor parameter detected. Cannot inject constructor RepeatConstructorArg(int,int).");
}
- [TestMethod]
+ [Fact]
public void TestRepeatConstructorArgClasses()
{
TestNegativeCase(typeof(RepeatConstructorArgClasses),
"Repeated constructor parameter detected. Cannot inject constructor RepeatConstructorArgClasses(A, A).");
}
- [TestMethod]
+ [Fact]
public void testLeafRepeatedConstructorArgClasses()
{
INode node = ns.GetNode(typeof(LeafRepeatedConstructorArgClasses).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(LeafRepeatedConstructorArgClasses).AssemblyQualifiedName);
+ Assert.Equal(node.GetFullName(), typeof(LeafRepeatedConstructorArgClasses).AssemblyQualifiedName);
}
- [TestMethod]
+ [Fact]
public void TestNamedRepeatConstructorArgClasses()
{
INode node = ns.GetNode(typeof(NamedRepeatConstructorArgClasses).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(NamedRepeatConstructorArgClasses).AssemblyQualifiedName);
+ Assert.Equal(node.GetFullName(), typeof(NamedRepeatConstructorArgClasses).AssemblyQualifiedName);
}
- [TestMethod]
+ [Fact]
public void TestResolveDependencies()
{
ns.GetNode(typeof(SimpleConstructors).AssemblyQualifiedName);
- Assert.IsNotNull(ns.GetNode(typeof(string).AssemblyQualifiedName));
+ Assert.NotNull(ns.GetNode(typeof(string).AssemblyQualifiedName));
}
- [TestMethod]
+ [Fact]
public void TestDocumentedLocalNamedParameter()
{
var node = ns.GetNode(typeof(DocumentedLocalNamedParameter).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(DocumentedLocalNamedParameter)));
+ Assert.Equal(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(DocumentedLocalNamedParameter)));
}
- [TestMethod]
+ [Fact]
public void TestNamedParameterTypeMismatch()
{
TestNegativeCase(typeof(NamedParameterTypeMismatch),
"Named parameter type mismatch in NamedParameterTypeMismatch. Constructor expects a System.String but Foo is a System.Int32.");
}
- [TestMethod]
+ [Fact]
public void TestUnannotatedName()
{
TestNegativeCase(typeof(UnannotatedName),
"Named parameter UnannotatedName is missing its [NamedParameter] attribute.");
}
- [TestMethod]
+ [Fact]
public void TestAnnotatedNotName()
{
TestNegativeCase(typeof(AnnotatedNotName),
"Found illegal [NamedParameter] AnnotatedNotName does not implement Name<T>.");
}
- [TestMethod]
+ [Fact]
public void TestAnnotatedNameWrongInterface()
{
TestNegativeCase(typeof(AnnotatedNameWrongInterface),
"Found illegal [NamedParameter] AnnotatedNameWrongInterface does not implement Name<T>.");
}
- [TestMethod]
+ [Fact]
public void TestAnnotatedNameMultipleInterfaces()
{
TestNegativeCase(typeof(AnnotatedNameMultipleInterfaces),
"Named parameter Org.Apache.REEF.Tang.Implementation.AnnotatedNameMultipleInterfaces implements multiple interfaces. It is only allowed to implement Name<T>.");
}
- [TestMethod]
+ [Fact]
public void TestUnAnnotatedNameMultipleInterfaces()
{
TestNegativeCase(typeof(UnAnnotatedNameMultipleInterfaces),
"Named parameter Org.Apache.REEF.Tang.Implementation.UnAnnotatedNameMultipleInterfaces is missing its @NamedParameter annotation.");
}
- [TestMethod]
+ [Fact]
public void TestNameWithConstructor()
{
TestNegativeCase(typeof(NameWithConstructor),
"Named parameter Org.Apache.REEF.Tang.Implementation.NameWithConstructor has a constructor. Named parameters must not declare any constructors.");
}
- [TestMethod]
+ [Fact]
public void TestNameWithZeroArgInject()
{
TestNegativeCase(typeof(NameWithZeroArgInject),
"Named parameter Org.Apache.REEF.Tang.Implementation.NameWithZeroArgInject has an injectable constructor. Named parameters must not declare any constructors.");
}
- [TestMethod]
+ [Fact]
public void TestInjectNonStaticLocalArgClass()
{
var node = ns.GetNode(typeof(InjectNonStaticLocalArgClass).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(InjectNonStaticLocalArgClass).AssemblyQualifiedName);
+ Assert.Equal(node.GetFullName(), typeof(InjectNonStaticLocalArgClass).AssemblyQualifiedName);
}
- [TestMethod]
+ [Fact]
public void TestInjectNonStaticLocalType()
{
var node = ns.GetNode(typeof(InjectNonStaticLocalType).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(InjectNonStaticLocalType).AssemblyQualifiedName);
+ Assert.Equal(node.GetFullName(), typeof(InjectNonStaticLocalType).AssemblyQualifiedName);
}
- [TestMethod]
+ [Fact]
public void TestOKShortNames()
{
var node = ns.GetNode(typeof(ShortNameFooA).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(ShortNameFooA).AssemblyQualifiedName);
+ Assert.Equal(node.GetFullName(), typeof(ShortNameFooA).AssemblyQualifiedName);
}
public void TestConflictingShortNames()
@@ -287,30 +280,30 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
{
Console.WriteLine(e);
}
- Assert.IsNull(msg, msg);
+ Assert.True(msg == null, msg);
}
- [TestMethod]
+ [Fact]
public void TestRoundTripInnerClassNames()
{
INode node = ns.GetNode(typeof(Nested.Inner).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(Nested.Inner).AssemblyQualifiedName);
+ Assert.Equal(node.GetFullName(), typeof(Nested.Inner).AssemblyQualifiedName);
}
- [TestMethod]
+ [Fact]
public void TestRoundTripAnonInnerClassNames()
{
INode node1 = ns.GetNode(typeof(AnonNested.X1).AssemblyQualifiedName);
INode node2 = ns.GetNode(typeof(AnonNested.Y1).AssemblyQualifiedName);
- Assert.AreNotEqual(node1.GetFullName(), node2.GetFullName());
+ Assert.NotEqual(node1.GetFullName(), node2.GetFullName());
Type t1 = ReflectionUtilities.GetTypeByName(node1.GetFullName());
Type t2 = ReflectionUtilities.GetTypeByName(node2.GetFullName());
- Assert.AreNotSame(t1, t2);
+ Assert.NotSame(t1, t2);
}
- [TestMethod]
+ [Fact]
public void TestNameCantBindWrongSubclassAsDefault()
{
TestNegativeCase(typeof(BadName),
@@ -318,22 +311,22 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
}
- [TestMethod]
+ [Fact]
public void TestNameCantBindWrongSubclassOfArgumentAsDefault()
{
TestNegativeCase(typeof(BadNameForGeneric),
"class BadNameForGeneric defines a default class Int32 with a type that does not extend of its target's string in ISet<string>");
}
- [TestMethod]
+ [Fact]
public void TestNameCantBindSubclassOfArgumentAsDefault()
{
ns = TangFactory.GetTang().GetClassHierarchy(new string[] { FileNames.Examples, FileNames.Common, FileNames.Tasks });
INode node = ns.GetNode(typeof(GoodNameForGeneric).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(GoodNameForGeneric).AssemblyQualifiedName);
+ Assert.Equal(node.GetFullName(), typeof(GoodNameForGeneric).AssemblyQualifiedName);
}
- [TestMethod]
+ [Fact]
public void TestInterfaceCantBindWrongImplAsDefault()
{
TestNegativeCase(typeof(IBadIfaceDefault),
@@ -351,32 +344,32 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
catch (Exception)
{
}
- Assert.IsNull(msg, msg);
+ Assert.True(msg == null, msg);
}
- [TestMethod]
+ [Fact]
public void TestParseableDefaultClassNotOK()
{
TestNegativeCase(typeof(BadParsableDefaultClass),
"Named parameter BadParsableDefaultClass defines default implementation for parsable type System.string");
}
- [TestMethod]
+ [Fact]
public void testGenericTorture1()
{
g(typeof(GenericTorture1));
}
- [TestMethod]
+ [Fact]
public void testGenericTorture2()
{
g(typeof(GenericTorture2));
}
- [TestMethod]
+ [Fact]
public void testGenericTorture3()
{
g(typeof(GenericTorture3));
}
- [TestMethod]
+ [Fact]
public void testGenericTorture4()
{
g(typeof(GenericTorture4));
@@ -389,31 +382,31 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
public INode g(Type t)
{
INode n = ns.GetNode(s(t));
- Assert.IsNotNull(n);
+ Assert.NotNull(n);
return n;
}
- [TestMethod]
+ [Fact]
public void TestHelloTaskNode()
{
var node = ns.GetNode(typeof(HelloTask).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(HelloTask)));
+ Assert.Equal(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(HelloTask)));
}
- [TestMethod]
+ [Fact]
public void TestITackNode()
{
var node = ns.GetNode(typeof(ITask).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(ITask)));
+ Assert.Equal(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(ITask)));
}
- [TestMethod]
+ [Fact]
public void TestNamedParameterIdentifier()
{
var node = ns.GetNode(typeof(TaskConfigurationOptions.Identifier).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(TaskConfigurationOptions.Identifier)));
+ Assert.Equal(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(TaskConfigurationOptions.Identifier)));
}
- [TestMethod]
+ [Fact]
public void TestInterface()
{
g(typeof(A));
@@ -435,11 +428,11 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
var b = (B)i.GetInstance(typeof(B));
var c = (C)i.GetInstance(typeof(C));
- Assert.IsNotNull(a);
- Assert.IsNotNull(implString);
- Assert.IsNotNull(implInt);
- Assert.IsNotNull(b);
- Assert.IsNotNull(c);
+ Assert.NotNull(a);
+ Assert.NotNull(implString);
+ Assert.NotNull(implInt);
+ Assert.NotNull(b);
+ Assert.NotNull(c);
}
}
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestGeneric.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestGeneric.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestGeneric.cs
index 0e53847..6e01c1c 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestGeneric.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestGeneric.cs
@@ -18,23 +18,21 @@
*/
using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Tang.Examples;
using Org.Apache.REEF.Tang.Implementations.Tang;
using Org.Apache.REEF.Wake.RX;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
{
- [TestClass]
public class TestGeneric
{
- [ClassInitialize]
- public static void ClassSetup(TestContext context)
+ public TestGeneric()
{
TangImpl.Reset();
}
- [TestMethod]
+ [Fact]
public void TestGenericClassWithT()
{
List<string> appDlls = new List<string>();
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestMultipleInterface.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestMultipleInterface.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestMultipleInterface.cs
index a92e366..19a4002 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestMultipleInterface.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestMultipleInterface.cs
@@ -18,16 +18,15 @@
*/
using System;
-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.ClassHierarchy
{
- [TestClass]
public class TestMultipleInterface
{
- [TestMethod]
+ [Fact]
public void TestFoo()
{
var ch = TangFactory.GetTang().GetDefaultClassHierarchy();
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestNamedParameter.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestNamedParameter.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestNamedParameter.cs
index cf7bdd4..c40ae5e 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestNamedParameter.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestNamedParameter.cs
@@ -17,40 +17,39 @@
* under the License.
*/
-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.Protobuf;
using Org.Apache.REEF.Tang.Types;
using Org.Apache.REEF.Tang.Util;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
{
- [TestClass]
public class TestNamedParameter
{
- [TestMethod]
+ [Fact]
public void TestNamedParameterWithDefaultValues()
{
var ns = TangFactory.GetTang().GetDefaultClassHierarchy();
INamedParameterNode cls = (INamedParameterNode)ns.GetNode(typeof(NamedParameterWithDefaultValues).AssemblyQualifiedName);
- Assert.IsTrue(cls.GetDocumentation().Equals("NamedParameterWithDefaultValues"));
- Assert.IsTrue(cls.GetShortName().Equals("NamedParameterWithDefaultValues"));
- Assert.IsTrue(cls.GetAlias().Equals("org.apache.REEF.tang.tests.classHierarchy.NamedParameterWithDefaultValues"));
- Assert.IsTrue(cls.GetAliasLanguage().ToString().Equals(Language.Java.ToString()));
+ Assert.True(cls.GetDocumentation().Equals("NamedParameterWithDefaultValues"));
+ Assert.True(cls.GetShortName().Equals("NamedParameterWithDefaultValues"));
+ Assert.True(cls.GetAlias().Equals("org.apache.REEF.tang.tests.classHierarchy.NamedParameterWithDefaultValues"));
+ Assert.True(cls.GetAliasLanguage().ToString().Equals(Language.Java.ToString()));
}
- [TestMethod]
+ [Fact]
public void TestNamedParameterWithAlias()
{
var ns = TangFactory.GetTang().GetDefaultClassHierarchy();
INamedParameterNode cls = (INamedParameterNode)ns.GetNode(typeof(NamedParameterWithAlias).AssemblyQualifiedName);
- Assert.IsTrue(cls.GetAlias().Equals("org.apache.REEF.tang.tests.classHierarchy.NamedParameterWithAlias"));
- Assert.IsTrue(cls.GetAliasLanguage().ToString().Equals(Language.Java.ToString()));
+ Assert.True(cls.GetAlias().Equals("org.apache.REEF.tang.tests.classHierarchy.NamedParameterWithAlias"));
+ Assert.True(cls.GetAliasLanguage().ToString().Equals(Language.Java.ToString()));
}
- [TestMethod]
+ [Fact]
public void TestNamedParameterWithAliasRoundTrip()
{
var ns = TangFactory.GetTang().GetDefaultClassHierarchy();
@@ -59,13 +58,13 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
var ns1 = new ProtocolBufferClassHierarchy(ProtocolBufferClassHierarchy.Serialize(ns));
var node2 = ns1.GetNode(typeof(NamedParameterWithAlias).AssemblyQualifiedName);
- Assert.IsTrue(node2 is INamedParameterNode);
- Assert.IsTrue(((INamedParameterNode)node2).GetAliasLanguage().ToString().Equals(Language.Java.ToString()));
- Assert.IsTrue(((INamedParameterNode)node2).GetFullName().Equals(typeof(NamedParameterWithAlias).AssemblyQualifiedName));
- Assert.IsTrue(((INamedParameterNode)node2).GetAlias().Equals("org.apache.REEF.tang.tests.classHierarchy.NamedParameterWithAlias"));
+ Assert.True(node2 is INamedParameterNode);
+ Assert.True(((INamedParameterNode)node2).GetAliasLanguage().ToString().Equals(Language.Java.ToString()));
+ Assert.True(((INamedParameterNode)node2).GetFullName().Equals(typeof(NamedParameterWithAlias).AssemblyQualifiedName));
+ Assert.True(((INamedParameterNode)node2).GetAlias().Equals("org.apache.REEF.tang.tests.classHierarchy.NamedParameterWithAlias"));
}
- [TestMethod]
+ [Fact]
public void TestGetNamedparameterValue()
{
var b = TangFactory.GetTang().NewConfigurationBuilder()
@@ -76,7 +75,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
var i = TangFactory.GetTang().NewInjector(b);
var o = i.GetInstance<ClassWithNamedParameterWithAlias>();
var no = i.GetNamedInstance<NamedParameterWithAlias, string>();
- Assert.IsTrue(o.Value.Equals("test"));
+ Assert.True(o.Value.Equals("test"));
}
}
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestParameterParser.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestParameterParser.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestParameterParser.cs
index 3d107be..1ab5384 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestParameterParser.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestParameterParser.cs
@@ -18,19 +18,18 @@
*/
using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Tang.Annotations;
using Org.Apache.REEF.Tang.Implementations.ClassHierarchy;
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.ClassHierarchy
{
- [TestClass]
public class TestParameterParser
{
- [TestMethod]
+ [Fact]
public void ParseIntTest()
{
var parser = new ParameterParser();
@@ -38,79 +37,79 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
}
- [TestMethod]
+ [Fact]
public void ParseBoolTest()
{
var parser = new ParameterParser();
Boolean o = (Boolean)parser.Parse(typeof(Boolean), "false");
}
- [TestMethod]
+ [Fact]
public void ParseLongTest()
{
var parser = new ParameterParser();
long o = (long)parser.Parse(typeof(long), "8675309");
}
- [TestMethod]
+ [Fact]
public void ParseStringTest()
{
var parser = new ParameterParser();
string o = (string)parser.Parse(typeof(string), "hello");
}
- [TestMethod]
+ [Fact]
public void ParseDoubleTest()
{
var parser = new ParameterParser();
Double o = (Double)parser.Parse(typeof(double), "12.6");
}
- [TestMethod]
+ [Fact]
public void ParseCharTest()
{
var parser = new ParameterParser();
Char o = (Char)parser.Parse(typeof(char), "c");
}
- [TestMethod]
+ [Fact]
public void ParseByteTest()
{
var parser = new ParameterParser();
Byte o = (Byte)parser.Parse(typeof(byte), "8");
}
- [TestMethod]
+ [Fact]
public void ParseShortTest()
{
var parser = new ParameterParser();
Int16 o = (Int16)parser.Parse(typeof(short), "8");
}
- [TestMethod]
+ [Fact]
public void ParseFloatTest()
{
var parser = new ParameterParser();
Single o = (Single)parser.Parse(typeof(float), "8.567");
}
- [TestMethod]
+ [Fact]
public void ParseByteArrayTest()
{
var parser = new ParameterParser();
byte[] o = (byte[])parser.Parse(typeof(byte[]), "hello");
}
- [TestMethod]
+ [Fact]
public void ParameterParserTest()
{
ParameterParser p = new ParameterParser();
p.AddParser(typeof(FooParser));
Foo f = (Foo)p.Parse(typeof(Foo), "woot");
- Assert.AreEqual(f.s, "woot");
+ Assert.Equal(f.s, "woot");
}
- [TestMethod]
+ [Fact]
public void TestUnregisteredParameterParser()
{
ParameterParser p = new ParameterParser();
@@ -124,19 +123,19 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
catch (NotSupportedException)
{
}
- Assert.IsNull(f);
+ Assert.Null(f);
}
- [TestMethod]
+ [Fact]
public void TestReturnSubclass()
{
ParameterParser p = new ParameterParser();
p.AddParser(typeof(BarParser));
Bar f = (Bar)p.Parse(typeof(Foo), "woot");
- Assert.AreEqual(f.s, "woot");
+ Assert.Equal(f.s, "woot");
}
- [TestMethod]
+ [Fact]
public void TestGoodMerge()
{
ParameterParser old = new ParameterParser();
@@ -144,10 +143,10 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
ParameterParser nw = new ParameterParser();
nw.MergeIn(old);
Bar f = (Bar)nw.Parse(typeof(Foo), "woot");
- Assert.AreEqual(f.s, "woot");
+ Assert.Equal(f.s, "woot");
}
- [TestMethod]
+ [Fact]
public void TestGoodMerge2()
{
ParameterParser old = new ParameterParser();
@@ -156,10 +155,10 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
nw.AddParser(typeof(BarParser));
nw.MergeIn(old);
Bar f = (Bar)nw.Parse(typeof(Foo), "woot");
- Assert.AreEqual(f.s, "woot");
+ Assert.Equal(f.s, "woot");
}
- [TestMethod]
+ [Fact]
public void TestBadMerge()
{
string msg = null;
@@ -175,20 +174,20 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
catch (ArgumentException)
{
}
- Assert.IsNull(msg);
+ Assert.Null(msg);
}
- [TestMethod]
+ [Fact]
public void testEndToEnd()
{
ITang tang = TangFactory.GetTang();
ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(new Type[] { typeof(BarParser) });
cb.BindNamedParameter<SomeNamedFoo, Foo>(GenericType<SomeNamedFoo>.Class, "hdfs://woot");
ILikeBars ilb = tang.NewInjector(cb.Build()).GetInstance<ILikeBars>();
- Assert.IsNotNull(ilb);
+ Assert.NotNull(ilb);
}
- [TestMethod]
+ [Fact]
public void TestDelegatingParser()
{
ITang tang = TangFactory.GetTang();
@@ -199,7 +198,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
cb2.BindNamedParameter<ParseName, ParseableType>(GenericType<ParseName>.Class, "a"); // ParseName : Name<ParseableType>
ParseableType t = (ParseableType)tang.NewInjector(cb2.Build()).GetNamedInstance(typeof(ParseName));
- Assert.IsTrue(t is ParseTypeA);
+ Assert.True(t is ParseTypeA);
cb2 = tang.NewConfigurationBuilder(cb.Build());
cb2.BindNamedParameter<ParseNameB, ParseTypeB>(GenericType<ParseNameB>.Class, "b"); // ParseNameB : Name<ParseTypeB : ParseableType>
@@ -257,7 +256,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
ILikeBars([Parameter(typeof(SomeNamedFoo))] Foo bar)
{
Bar b = (Bar)bar;
- Assert.AreEqual(b.s, "hdfs://woot");
+ Assert.Equal(b.s, "hdfs://woot");
}
}
@@ -309,7 +308,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
[Inject]
public NeedsA([Parameter(typeof(ParseNameA))] ParseableType a)
{
- Assert.IsTrue(a is ParseTypeA);
+ Assert.True(a is ParseTypeA);
}
}
@@ -318,7 +317,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
[Inject]
public NeedsB([Parameter(typeof(ParseNameB))] ParseTypeB b)
{
- Assert.IsTrue(b is ParseTypeB);
+ Assert.True(b is ParseTypeB);
}
}
}
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestAvroConfiguration.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestAvroConfiguration.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestAvroConfiguration.cs
index 3dda5d0..f5b03db 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestAvroConfiguration.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestAvroConfiguration.cs
@@ -18,7 +18,6 @@
*/
using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Common.Tasks;
using Org.Apache.REEF.Examples.Tasks.HelloTask;
using Org.Apache.REEF.Tang.Formats;
@@ -27,13 +26,13 @@ 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.Configuration
{
- [TestClass]
public class TestAvroConfiguration
{
- [TestMethod]
+ [Fact]
public void TestFromJsonString()
{
IConfigurationSerializer serializerImpl = (IConfigurationSerializer)TangFactory.GetTang().NewInjector().GetInstance(typeof(IConfigurationSerializer));
@@ -44,12 +43,12 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
string jsonStr = serializerImpl.ToString(conf);
IConfiguration c = serializerImpl.FromString(jsonStr);
- Assert.IsNotNull(c);
+ Assert.NotNull(c);
string jsonStr2 = serializerImpl.ToString(c);
IConfiguration c1 = serializerImpl.FromString(jsonStr2);
- Assert.IsNotNull(c1);
+ Assert.NotNull(c1);
}
private AvroConfiguration ToAvroConfiguration()
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs
index f986316..d6093e6 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs
@@ -19,7 +19,6 @@
using System;
using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Common.Tasks;
using Org.Apache.REEF.Examples.Tasks.HelloTask;
using Org.Apache.REEF.Tang.Annotations;
@@ -34,18 +33,13 @@ using Org.Apache.REEF.Tang.Interface;
using Org.Apache.REEF.Tang.Protobuf;
using Org.Apache.REEF.Tang.Tests.ScenarioTest;
using Org.Apache.REEF.Tang.Util;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.Configuration
{
- [TestClass]
public class TestConfiguration
{
- [ClassInitialize]
- public static void ClassSetup(TestContext context)
- {
- }
-
- [TestMethod]
+ [Fact]
public void TestDeserializedConfigMerge()
{
Type activityInterfaceType = typeof(ITask);
@@ -78,7 +72,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
var b = merged.newBuilder().Build();
}
- [TestMethod]
+ [Fact]
public void TestActivityConfiguration()
{
Type activityInterfaceType = typeof(ITask);
@@ -99,10 +93,10 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
IInjector injector = tang1.NewInjector(conf1);
var activityRef = (ITask)injector.GetInstance(activityInterfaceType);
- Assert.IsNotNull(activityRef);
+ Assert.NotNull(activityRef);
}
- [TestMethod]
+ [Fact]
public void TestMultipleConfiguration()
{
Type activityInterfaceType = typeof(ITask);
@@ -120,14 +114,14 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
IInjector injector = TangFactory.GetTang().NewInjector(new IConfiguration[] { conf, httpConfiguraiton });
var activityRef = (ITask)injector.GetInstance(activityInterfaceType);
- Assert.IsNotNull(activityRef);
+ Assert.NotNull(activityRef);
RuntimeClock clock = injector.GetInstance<RuntimeClock>();
var rh = clock.ClockRuntimeStartHandler.Get();
- Assert.AreEqual(rh.Count, 1);
+ Assert.Equal(rh.Count, 1);
}
- [TestMethod]
+ [Fact]
public void TestActivityConfigWithSeparateAssembly()
{
Type activityInterfaceType = typeof(ITask);
@@ -147,10 +141,10 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
.NewInjector(new string[] { FileNames.Common, FileNames.Tasks }, "TaskConf1.txt")
.GetInstance(typeof(ITask));
- Assert.IsNotNull(activityRef);
+ Assert.NotNull(activityRef);
}
- [TestMethod]
+ [Fact]
public void TestGetConfigFromProtoBufClassHierarchy()
{
Type iTaskType = typeof(ITask);
@@ -168,7 +162,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
ConfigurationFile.WriteConfigurationFile(conf, "taskConf2.txt");
}
- [TestMethod]
+ [Fact]
public void TestActivityConfig()
{
Type activityInterfaceType = typeof(ITask);
@@ -182,10 +176,10 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
IInjector injector = tang.NewInjector(new string[] { FileNames.Common, FileNames.Tasks }, "TaskConf.txt");
var activityRef = (ITask)injector.GetInstance(activityInterfaceType);
- Assert.IsNotNull(activityRef);
+ Assert.NotNull(activityRef);
}
- [TestMethod]
+ [Fact]
public void TestActivityConfigWithString()
{
Type activityInterfaceType = typeof(ITask);
@@ -202,10 +196,10 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
IInjector injector = tang.NewInjector(conf2);
var activityRef = (ITask)injector.GetInstance(activityInterfaceType);
- Assert.IsNotNull(activityRef);
+ Assert.NotNull(activityRef);
}
- [TestMethod]
+ [Fact]
public void TestTweetConfiguration()
{
Type tweeterType = typeof(Tweeter);
@@ -228,7 +222,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
tweeter.sendMessage();
}
- [TestMethod]
+ [Fact]
public void TestTweetConfig()
{
Type tweeterType = typeof(Tweeter);
@@ -248,7 +242,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
}
- [TestMethod]
+ [Fact]
public void TestTweetConfigWithAvroThroughFile()
{
Type tweeterType = typeof(Tweeter);
@@ -270,7 +264,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
tweeter.sendMessage();
}
- [TestMethod]
+ [Fact]
public void TestTweetConfigAddConfigurationFromString()
{
Type tweeterType = typeof(Tweeter);
@@ -294,7 +288,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
tweeter.sendMessage();
}
- [TestMethod]
+ [Fact]
public void TestTweetConfigWithAvroSerialization()
{
Type tweeterType = typeof(Tweeter);
@@ -316,7 +310,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
tweeter.sendMessage();
}
- [TestMethod]
+ [Fact]
public void TestTweetConfigGetConfigurationFromString()
{
Type tweeterType = typeof(Tweeter);
@@ -338,7 +332,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
tweeter.sendMessage();
}
- [TestMethod]
+ [Fact]
public void TestTweetInvalidBinding()
{
string msg = null;
@@ -352,10 +346,10 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
{
msg = e.Message;
}
- Assert.IsNotNull(msg);
+ Assert.NotNull(msg);
}
- [TestMethod]
+ [Fact]
public void TestTimerConfiguration()
{
Type timerType = typeof(Timer);
@@ -375,12 +369,12 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
IInjector injector = tang.NewInjector(conf1);
var timer = (Timer)injector.GetInstance(timerType);
- Assert.IsNotNull(timer);
+ Assert.NotNull(timer);
timer.sleep();
}
- [TestMethod]
+ [Fact]
public void TestDocumentLoadNamedParameterConfiguration()
{
Type documentedLocalNamedParameterType = typeof(DocumentedLocalNamedParameter);
@@ -401,11 +395,11 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
IInjector injector = tang1.NewInjector(conf1);
var doc = (DocumentedLocalNamedParameter)injector.GetInstance(documentedLocalNamedParameterType);
- Assert.IsNotNull(doc);
+ Assert.NotNull(doc);
var s = doc.ToString();
}
- [TestMethod]
+ [Fact]
public void TestTimerConfigurationWithClassHierarchy()
{
Type timerType = typeof(Timer);
@@ -427,11 +421,11 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
IInjector injector = tang1.NewInjector(conf1);
var timer = (Timer)injector.GetInstance(timerType);
- Assert.IsNotNull(timer);
+ Assert.NotNull(timer);
timer.sleep();
}
- [TestMethod]
+ [Fact]
public void TestSetConfig()
{
IConfiguration conf = TangFactory.GetTang().NewConfigurationBuilder()
@@ -449,12 +443,12 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
Box b2 = (Box)TangFactory.GetTang().NewInjector(conf2).GetInstance(typeof(Box));
ISet<string> actual = b2.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 TestSetConfigWithAvroSerialization()
{
IConfiguration conf = TangFactory.GetTang().NewConfigurationBuilder()
@@ -472,12 +466,12 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
Box b2 = (Box)TangFactory.GetTang().NewInjector(conf2).GetInstance(typeof(Box));
ISet<string> actual = b2.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 TestNullStringValue()
{
string msg = null;
@@ -491,10 +485,10 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
{
msg = e.Message;
}
- Assert.IsNotNull(msg);
+ Assert.NotNull(msg);
}
- [TestMethod]
+ [Fact]
public void TestSetConfigNullValue()
{
string msg = null;
@@ -510,7 +504,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
{
msg = e.Message;
}
- Assert.IsNotNull(msg);
+ Assert.NotNull(msg);
}
}
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestCsConfigurationBuilderExtension.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestCsConfigurationBuilderExtension.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestCsConfigurationBuilderExtension.cs
index 3740fd7..d60827f 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestCsConfigurationBuilderExtension.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestCsConfigurationBuilderExtension.cs
@@ -18,22 +18,21 @@
*/
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.Tests.Injection;
using Org.Apache.REEF.Tang.Tests.Tang;
using Org.Apache.REEF.Tang.Util;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.Configuration
{
/// <summary>
/// This class is to test extension API defined in ICsConfigurationBuilder
/// </summary>
- [TestClass]
public class TestCsConfigurationBuilderExtension
{
- [TestMethod]
+ [Fact]
public void TestBindNamedParameter1()
{
ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();
@@ -45,11 +44,11 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
Aimpl a2 = (Aimpl)i.GetNamedInstance<AImplName, INamedImplA>(GenericType<AImplName>.Class);
Bimpl b1 = (Bimpl)i.GetNamedInstance<BImplName, INamedImplA>(GenericType<BImplName>.Class);
Bimpl b2 = (Bimpl)i.GetNamedInstance<BImplName, INamedImplA>(GenericType<BImplName>.Class);
- Assert.AreSame(a1, a2);
- Assert.AreSame(b1, b2);
+ Assert.Same(a1, a2);
+ Assert.Same(b1, b2);
}
- [TestMethod]
+ [Fact]
public void TestBindStringNamedParam()
{
ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();
@@ -59,7 +58,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
o.Verify("foo");
}
- [TestMethod]
+ [Fact]
public void TestBindIntNamedParam()
{
ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();
@@ -69,7 +68,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
o.Verify(8);
}
- [TestMethod]
+ [Fact]
public void TestBindNamedParam()
{
ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();
@@ -79,7 +78,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
o.Verify(true);
}
- [TestMethod]
+ [Fact]
public void TestBindSetEntryImplValue()
{
ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();
@@ -92,10 +91,10 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
ISet<INumber> expected = new HashSet<INumber>();
expected.Add(new TestSetInjection.Integer1(4));
- Assert.IsTrue(Utilities.Utilities.Equals<INumber>(actual, expected));
+ Assert.True(Utilities.Utilities.Equals<INumber>(actual, expected));
}
- [TestMethod]
+ [Fact]
public void TestBindSetEntryStringValue()
{
IConfiguration conf = TangFactory.GetTang().NewConfigurationBuilder()
@@ -107,21 +106,21 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
Box b = (Box)TangFactory.GetTang().NewInjector(conf).GetInstance(typeof(Box));
ISet<string> actual = b.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 TestBindImplementation()
{
ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();
cb.BindImplementation<Interf, Impl>();
Interf o = TangFactory.GetTang().NewInjector(cb.Build()).GetInstance<Interf>();
- Assert.IsTrue(o is Impl);
+ Assert.True(o is Impl);
}
- [TestMethod]
+ [Fact]
public void TestBindList()
{
IList<string> injected = new List<string>();
@@ -135,13 +134,13 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
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);
}
- [TestMethod]
+ [Fact]
public void TestObjectInjectWithInjectableSubclassesMultipleInstances()
{
IList<string> injected = new List<string>();
@@ -158,13 +157,13 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
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)));
}
- [TestMethod]
+ [Fact]
public void TestBindConstructor()
{
ICsConfigurationBuilder b = TangFactory.GetTang().NewConfigurationBuilder();
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModule.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModule.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModule.cs
index 15f2d7c..b0da309 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModule.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModule.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.Exceptions;
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.Format
{
@@ -38,30 +38,9 @@ namespace Org.Apache.REEF.Tang.Tests.Format
{
}
- [TestClass]
public class TestConfigurationModule
{
- [ClassInitialize]
- public static void ClassSetup(TestContext context)
- {
- }
-
- [ClassCleanup]
- public static void ClassCleanup()
- {
- }
-
- [TestInitialize]
- public void TestSetup()
- {
- }
-
- [TestCleanup]
- public void TestCleanup()
- {
- }
-
- [TestMethod]
+ [Fact]
public void SmokeTest()
{
// Here we set some configuration values. In true tang style,
@@ -74,10 +53,10 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Set(MyConfigurationModule.FooNess, "12")
.Build();
IFoo f = (IFoo)TangFactory.GetTang().NewInjector(c).GetInstance(fooType);
- Assert.AreEqual(f.getFooness(), 12);
+ Assert.Equal(f.getFooness(), 12);
}
- [TestMethod]
+ [Fact]
public void SmokeTestConfig()
{
// Here we set some configuration values. In true tang style,
@@ -90,32 +69,32 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Set(MyConfigurationModule.FooNess, "12")
.Build();
IFoo f = (IFoo)TangFactory.GetTang().NewInjector(c).GetInstance(fooType);
- Assert.AreEqual(f.getFooness(), 12);
+ Assert.Equal(f.getFooness(), 12);
AvroConfigurationSerializer serializerCs = new AvroConfigurationSerializer();
serializerCs.ToFileStream(c, "TangTestCs.avroconf");
var c3 = serializerCs.FromFileStream("TangTestCs.avroconf");
IFoo f3 = (IFoo)TangFactory.GetTang().NewInjector(c3).GetInstance(fooType);
- Assert.AreEqual(f3.getFooness(), 12);
+ Assert.Equal(f3.getFooness(), 12);
serializerCs.ToFile(c, "TangTestCs1.avro");
var c4 = serializerCs.FromFile("TangTestCs1.avro");
IFoo f4 = (IFoo)TangFactory.GetTang().NewInjector(c4).GetInstance(fooType);
- Assert.AreEqual(f4.getFooness(), 12);
+ Assert.Equal(f4.getFooness(), 12);
IConfigurationSerializer serializerImpl = (IConfigurationSerializer)TangFactory.GetTang().NewInjector().GetInstance(typeof(IConfigurationSerializer));
serializerImpl.ToFile(c, "TangTestCs1.avro");
var c5 = serializerImpl.FromFile("TangTestCs1.avro");
IFoo f5 = (IFoo)TangFactory.GetTang().NewInjector(c5).GetInstance(fooType);
- Assert.AreEqual(f5.getFooness(), 12);
+ Assert.Equal(f5.getFooness(), 12);
// this is to test the file generated from Java. name,value b=must be recognized by C# class hierarchy
AvroConfigurationSerializer serializer = new AvroConfigurationSerializer();
var avroConfig = serializer.AvroDeserializeFromFile("Evaluator.conf");
- Assert.IsNotNull(avroConfig);
+ Assert.NotNull(avroConfig);
}
- [TestMethod]
+ [Fact]
public void OmitOptionalTest()
{
Type fooType = typeof(Org.Apache.REEF.Tang.Tests.Format.IFoo);
@@ -124,10 +103,10 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Set(MyConfigurationModule.TheFoo, GenericType<FooImpl>.Class)
.Build();
IFoo f = (IFoo)TangFactory.GetTang().NewInjector(c).GetInstance(fooType);
- Assert.AreEqual(f.getFooness(), 42);
+ Assert.Equal(f.getFooness(), 42);
}
- [TestMethod]
+ [Fact]
public void OmitRequiredTest()
{
string msg = null;
@@ -141,10 +120,10 @@ namespace Org.Apache.REEF.Tang.Tests.Format
catch (Exception)
{
}
- Assert.IsNull(msg);
+ Assert.Null(msg);
}
- [TestMethod]
+ [Fact]
public void BadConfTest()
{
string msg = null;
@@ -156,16 +135,16 @@ namespace Org.Apache.REEF.Tang.Tests.Format
catch (Exception)
{
}
- Assert.IsNull(msg);
+ Assert.Null(msg);
}
- [TestMethod]
+ [Fact]
public void NonExistentStringBindOK()
{
new MyBadConfigurationModule().BindImplementation(GenericType<IFoo>.Class, "i.do.not.exist");
}
- [TestMethod]
+ [Fact]
public void NonExistentStringBindNotOK()
{
string msg = null;
@@ -177,10 +156,10 @@ namespace Org.Apache.REEF.Tang.Tests.Format
catch (Exception)
{
}
- Assert.IsNull(msg);
+ Assert.Null(msg);
}
- [TestMethod]
+ [Fact]
public void MultiBindTest()
{
// Here we set some configuration values. In true tang style,
@@ -192,12 +171,12 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Build();
IFoo f = (IFoo)TangFactory.GetTang().NewInjector(c).GetInstance(typeof(IFoo));
IFoo g = (IFoo)TangFactory.GetTang().NewInjector(c).GetInstance(typeof(object));
- Assert.AreEqual(f.getFooness(), 12);
- Assert.AreEqual(g.getFooness(), 12);
- Assert.IsFalse(f == g);
+ Assert.Equal(f.getFooness(), 12);
+ Assert.Equal(g.getFooness(), 12);
+ Assert.False(f == g);
}
- [TestMethod]
+ [Fact]
public void ForeignSetTest()
{
string msg = null;
@@ -209,10 +188,10 @@ namespace Org.Apache.REEF.Tang.Tests.Format
catch (Exception)
{
}
- Assert.IsNull(msg);
+ Assert.Null(msg);
}
- [TestMethod]
+ [Fact]
public void ForeignBindTest()
{
string msg = null;
@@ -224,10 +203,10 @@ namespace Org.Apache.REEF.Tang.Tests.Format
catch (Exception)
{
}
- Assert.IsNull(msg);
+ Assert.Null(msg);
}
- [TestMethod]
+ [Fact]
public void SingletonTest()
{
IConfiguration c = new MyConfigurationModule()
@@ -237,17 +216,17 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Set(MyConfigurationModule.TheFoo, GenericType<FooImpl>.Class)
.Build();
IInjector i = TangFactory.GetTang().NewInjector(c);
- Assert.IsTrue(i.GetInstance(typeof(IFoo)) == i.GetInstance(typeof(IFoo)));
+ Assert.True(i.GetInstance(typeof(IFoo)) == i.GetInstance(typeof(IFoo)));
}
- [TestMethod]
+ [Fact]
public void ImmutablilityTest()
{
// builder methods return copies; the original module is immutable
ConfigurationModule builder1 = MyConfigurationModule.Conf
.Set(MyConfigurationModule.TheFoo, GenericType<FooImpl>.Class);
- Assert.IsFalse(builder1 == MyConfigurationModule.Conf);
+ Assert.False(builder1 == MyConfigurationModule.Conf);
IConfiguration config1 = builder1.Build();
@@ -259,11 +238,11 @@ namespace Org.Apache.REEF.Tang.Tests.Format
// instantiation of each just to be sure everything is fine in this situation
IInjector i1 = TangFactory.GetTang().NewInjector(config1);
IInjector i2 = TangFactory.GetTang().NewInjector(config2);
- Assert.AreEqual(42, ((IFoo)i1.GetInstance(typeof(IFoo))).getFooness());
- Assert.AreEqual(7, ((IFoo)i2.GetInstance(typeof(IFoo))).getFooness());
+ Assert.Equal(42, ((IFoo)i1.GetInstance(typeof(IFoo))).getFooness());
+ Assert.Equal(7, ((IFoo)i2.GetInstance(typeof(IFoo))).getFooness());
}
- [TestMethod]
+ [Fact]
public void SetParamTest()
{
IConfiguration c = SetConfigurationModule.CONF
@@ -272,12 +251,12 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Build();
ISet<string> s = (ISet<string>)TangFactory.GetTang().NewInjector(c).GetNamedInstance(typeof(SetName));
- Assert.AreEqual(s.Count, 2);
- Assert.IsTrue(s.Contains("a"));
- Assert.IsTrue(s.Contains("b"));
+ Assert.Equal(s.Count, 2);
+ Assert.True(s.Contains("a"));
+ Assert.True(s.Contains("b"));
}
- [TestMethod]
+ [Fact]
public void SetClassTest()
{
IConfiguration c = SetClassConfigurationModule.CONF
@@ -285,7 +264,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Set(SetClassConfigurationModule.P, GenericType<SubB>.Class)
.Build();
ISet<ISuper> s = (ISet<ISuper>)TangFactory.GetTang().NewInjector(c).GetNamedInstance(typeof(SetClass));
- Assert.AreEqual(2, s.Count);
+ Assert.Equal(2, s.Count);
bool sawA = false, sawB = false;
foreach (ISuper sup in s)
@@ -300,13 +279,13 @@ namespace Org.Apache.REEF.Tang.Tests.Format
}
else
{
- Assert.Fail();
+ Assert.True(false);
}
}
- Assert.IsTrue(sawA && sawB);
+ Assert.True(sawA && sawB);
}
- [TestMethod]
+ [Fact]
public void SetClassRoundTripTest()
{
IConfiguration c = SetClassConfigurationModule.CONF
@@ -320,7 +299,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format
// ConfigurationFile.AddConfiguration(cb, ConfigurationFile.ToConfigurationString(c));
ISet<ISuper> s = (ISet<ISuper>)TangFactory.GetTang().NewInjector(c2).GetNamedInstance(typeof(SetClass));
- Assert.AreEqual(2, s.Count);
+ Assert.Equal(2, s.Count);
bool sawA = false, sawB = false;
foreach (ISuper sup in s)
{
@@ -334,13 +313,13 @@ namespace Org.Apache.REEF.Tang.Tests.Format
}
else
{
- Assert.Fail();
+ Assert.True(false);
}
}
- Assert.IsTrue(sawA && sawB);
+ Assert.True(sawA && sawB);
}
- [TestMethod]
+ [Fact]
public void ErrorOnStaticTimeSet()
{
string msg = null;
@@ -353,10 +332,10 @@ namespace Org.Apache.REEF.Tang.Tests.Format
catch (ClassHierarchyException)
{
}
- Assert.IsNull(msg);
+ Assert.Null(msg);
}
- [TestMethod]
+ [Fact]
public void ErrorOnSetMerge()
{
ConfigurationModuleBuilder cb = null;
@@ -369,7 +348,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format
{
System.Diagnostics.Debug.WriteLine(e);
}
- Assert.IsNull(cb);
+ Assert.Null(cb);
}
}
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModuleForList.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModuleForList.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModuleForList.cs
index d5fb873..ceea35b 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModuleForList.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModuleForList.cs
@@ -19,12 +19,12 @@
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.Tang;
using Org.Apache.REEF.Tang.Interface;
using Org.Apache.REEF.Tang.Util;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.Format
{
@@ -32,12 +32,11 @@ namespace Org.Apache.REEF.Tang.Tests.Format
{
}
- [TestClass]
public class TestConfigurationModuleForList
{
// ConfigurationModuleBuilder BindList<U, T>(GenericType<U> iface, IParam<IList<T>> opt)
// public ConfigurationModule Set<T>(IImpl<IList<T>> opt, IList<string> impl)
- [TestMethod]
+ [Fact]
public void ListParamTest()
{
IList<string> v = new List<string>();
@@ -49,14 +48,14 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Build();
IList<string> s = (IList<string>)TangFactory.GetTang().NewInjector(c).GetNamedInstance(typeof(ListName));
- Assert.AreEqual(s.Count, 2);
- Assert.IsTrue(s.Contains("a"));
- Assert.IsTrue(s.Contains("b"));
+ Assert.Equal(s.Count, 2);
+ Assert.True(s.Contains("a"));
+ Assert.True(s.Contains("b"));
}
// public ConfigurationModuleBuilder BindList<U, T>(GenericType<U> iface, IImpl<IList<T>> opt) where U : Name<IList<T>>
// public ConfigurationModule Set<T>(IImpl<IList<T>> opt, IList<Type> impl)
- [TestMethod]
+ [Fact]
public void ListImplTest()
{
IList<Type> v = new List<Type>();
@@ -68,22 +67,22 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Build();
IList<IListSuper> s = (IList<IListSuper>)TangFactory.GetTang().NewInjector(c).GetNamedInstance(typeof(ListClass));
- Assert.AreEqual(s.Count, 2);
- Assert.IsTrue(s[0] is ListSubA);
- Assert.IsTrue(s[1] is ListSubB);
+ Assert.Equal(s.Count, 2);
+ Assert.True(s[0] is ListSubA);
+ Assert.True(s[1] is ListSubB);
}
// public ConfigurationModuleBuilder BindList<U, T>(GenericType<U> iface, IList<string> impl)
- [TestMethod]
+ [Fact]
public void ListStringTest()
{
IConfiguration c = ListIntConfigurationModule.CONF
.Build();
IList<int> i = (IList<int>)TangFactory.GetTang().NewInjector(c).GetNamedInstance(typeof(ListIntName));
- Assert.AreEqual(i.Count, 2);
- Assert.IsTrue(i.Contains(1));
- Assert.IsTrue(i.Contains(2));
+ Assert.Equal(i.Count, 2);
+ Assert.True(i.Contains(1));
+ Assert.True(i.Contains(2));
}
}
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestTaskConfiguration.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestTaskConfiguration.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestTaskConfiguration.cs
index 14cc1ce..099f993 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestTaskConfiguration.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestTaskConfiguration.cs
@@ -19,7 +19,6 @@
using System;
using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Common.Tasks;
using Org.Apache.REEF.Examples.Tasks.HelloTask;
using Org.Apache.REEF.Tang.Annotations;
@@ -27,6 +26,7 @@ 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.Format
{
@@ -65,10 +65,9 @@ namespace Org.Apache.REEF.Tang.Tests.Format
string GetId();
}
- [TestClass]
public class TestTaskConfiguration
{
- [TestMethod]
+ [Fact]
public void TaskConfigurationTestWith3Parameters()
{
TaskConfigurationWith3Parameters.Conf
@@ -76,7 +75,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Build();
}
- [TestMethod]
+ [Fact]
public void TaskConfigurationWithMyEventHandlerTest()
{
TaskConfigurationWithMyEventHandler.Conf
@@ -84,7 +83,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Build();
}
- [TestMethod]
+ [Fact]
public void TaskConfigurationTest()
{
IConfiguration conf1 = TaskConfiguration.Conf
@@ -104,7 +103,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format
IInjector injector1 = TangFactory.GetTang().NewInjector(conf1);
var task1 = (HelloTask)injector1.GetInstance(typeof(ITask));
- Assert.IsNotNull(task1);
+ Assert.NotNull(task1);
var serializer = new AvroConfigurationSerializer();
byte[] bytes = serializer.ToByteArray(conf1);
@@ -112,10 +111,10 @@ namespace Org.Apache.REEF.Tang.Tests.Format
IInjector injector2 = TangFactory.GetTang().NewInjector(conf2);
var task2 = (HelloTask)injector2.GetInstance(typeof(ITask));
- Assert.IsNotNull(task2);
+ Assert.NotNull(task2);
}
- [TestMethod]
+ [Fact]
public void TaskConfigurationSerializationTest()
{
IConfiguration conf1 = TaskConfiguration.Conf
@@ -132,7 +131,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format
IInjector injector1 = TangFactory.GetTang().NewInjector(conf1);
var task1 = (HelloTask)injector1.GetInstance(typeof(ITask));
- Assert.IsNotNull(task1);
+ Assert.NotNull(task1);
var serializer = new AvroConfigurationSerializer();
byte[] bytes = serializer.ToByteArray(conf1);
@@ -140,14 +139,14 @@ namespace Org.Apache.REEF.Tang.Tests.Format
IInjector injector2 = TangFactory.GetTang().NewInjector(conf2);
var task2 = (HelloTask)injector2.GetInstance(typeof(ITask));
- Assert.IsNotNull(task2);
+ Assert.NotNull(task2);
serializer.ToFileStream(conf1, "TaskConfiguration.bin");
IConfiguration conf3 = serializer.FromFileStream("TaskConfiguration.bin");
IInjector injector3 = TangFactory.GetTang().NewInjector(conf3);
var task3 = (HelloTask)injector3.GetInstance(typeof(ITask));
- Assert.IsNotNull(task3);
+ Assert.NotNull(task3);
}
}
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestAmbigousConstructors.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestAmbigousConstructors.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestAmbigousConstructors.cs
index 56b9d52..e52c4b8 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestAmbigousConstructors.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestAmbigousConstructors.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 TestAmbigousConstructors
{
- [TestMethod]
+ [Fact]
public void AmbigousConstructorTest()
{
// Cannot inject Org.Apache.REEF.Tang.Tests.Injection.AmbigousConstructorClass, Org.Apache.REEF.Tang.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
@@ -50,7 +49,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection
{
System.Diagnostics.Debug.WriteLine(e);
}
- Assert.IsNull(obj);
+ Assert.Null(obj);
}
}