Skip to content

Commit

Permalink
fix: move test classes to individual files
Browse files Browse the repository at this point in the history
  • Loading branch information
workgroupengineering committed Jan 25, 2022
1 parent 5e7baef commit 99c39e3
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 53 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Uno.UI.RuntimeTests.Tests.UnitTestsTests
{
[TestClass]
class Give_UnitTest_DynamicData_From_Method : IDisposable
{
static int TestSucces_Count = 0;

[DataTestMethod]
[DynamicData(nameof(GetData), DynamicDataSourceType.Method)]
public void When_Get_Arguments_From_Method(int a, int b, int expected)
{
var actual = a + b;
Assert.AreEqual(expected, actual);
TestSucces_Count++;
}

public static IEnumerable<object[]> GetData()
{
yield return new object[] { 1, 1, 2 };
yield return new object[] { 12, 30, 42 };
yield return new object[] { 14, 1, 15 };
}

public void Dispose() =>
Assert.Equals(TestSucces_Count, 3);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Uno.UI.RuntimeTests.Tests.UnitTestsTests
{
[TestClass]
class Give_UnitTest_DynamicData_From_Property : IDisposable
{
static int TestSucces_Count = 0;

[DataTestMethod]
[DynamicData(nameof(Data), DynamicDataSourceType.Property)]
public void When_Get_Arguments_From_Property(int a, int b, int expected)
{
var actual = a + b;
Assert.AreEqual(expected, actual);
TestSucces_Count++;
}

public static IEnumerable<object[]> Data
{
get
{
yield return new object[] { 1, 1, 2 };
yield return new object[] { 12, 30, 42 };
yield return new object[] { 14, 1, 15 };
}
}

public void Dispose() =>
Assert.Equals(TestSucces_Count, 3);
}
}
53 changes: 0 additions & 53 deletions src/Uno.UI.RuntimeTests/Tests/UnitTestsTests/Given_UnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,57 +39,4 @@ public void When_Success()
{
}
}

[TestClass]
class Give_UnitTest_DynamicData_From_Method : IDisposable
{
static int TestSucces_Count = 0;

[DataTestMethod]
[DynamicData(nameof(GetData), DynamicDataSourceType.Method)]
public void When_Get_Arguments_From_Method(int a, int b, int expected)
{
var actual = a + b;
Assert.AreEqual(expected, actual);
TestSucces_Count++;
}

public static IEnumerable<object[]> GetData()
{
yield return new object[] { 1, 1, 2 };
yield return new object[] { 12, 30, 42 };
yield return new object[] { 14, 1, 15 };
}

public void Dispose() =>
Assert.Equals(TestSucces_Count, 3);
}

[TestClass]
class Give_UnitTest_DynamicData_From_Property : IDisposable
{
static int TestSucces_Count = 0;

[DataTestMethod]
[DynamicData(nameof(Data), DynamicDataSourceType.Property)]
public void When_Get_Arguments_From_Property(int a, int b, int expected)
{
var actual = a + b;
Assert.AreEqual(expected, actual);
TestSucces_Count++;
}

public static IEnumerable<object[]> Data
{
get
{
yield return new object[] { 1, 1, 2 };
yield return new object[] { 12, 30, 42 };
yield return new object[] { 14, 1, 15 };
}
}

public void Dispose() =>
Assert.Equals(TestSucces_Count, 3);
}
}

0 comments on commit 99c39e3

Please sign in to comment.