Skip to content

Commit

Permalink
Merge pull request #56 from ricaun-io/develop
Browse files Browse the repository at this point in the history
Version 1.5.0 - Support `TestCaseSource`.
  • Loading branch information
ricaun authored Sep 19, 2024
2 parents 18613b9 + 7cd9610 commit 8fb6abe
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 1 deletion.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.5.0] / 2024-09-11 - 2024-09-19
### Features
- Support tests with `TestCaseSource`. (Fix: #55)
### Application
- Update `ricaun.NUnit` to `1.4.0`.
### Tests
- Add `TestsCaseSource` to test `TestCaseSourceAttribute`.
- Add tests with `TestCaseData` class with expected result.

## [1.4.1] / 2024-09-06
### TestAdapter
- Update project reference to `PrivateAssets` to remove reference in the package.
Expand Down Expand Up @@ -477,6 +486,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- [x] TestsFail

[vNext]: ../../compare/1.0.0...HEAD
[1.5.0]: ../../compare/1.4.1...1.5.0
[1.4.1]: ../../compare/1.4.0...1.4.1
[1.4.0]: ../../compare/1.3.6...1.4.0
[1.3.6]: ../../compare/1.3.5...1.3.6
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>1.4.1</Version>
<Version>1.5.0</Version>
</PropertyGroup>
</Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
74 changes: 74 additions & 0 deletions ricaun.RevitTest.Tests/TestsCaseSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using NUnit.Framework;
using System.Collections;
using System.Collections.Generic;

namespace ricaun.RevitTest.Tests
{
public class TestsCaseSource
{
public static int[] CasesSource = new[] { 1, 2, 3 };
[TestCaseSource(nameof(CasesSource))]
public void CasesSourceTest(int i)
{
Assert.True(i > 0);
}

static IEnumerable<int> CasesSourceMethod()
{
yield return 1;
yield return 2;
yield return 3;
}
[TestCaseSource(nameof(CasesSourceMethod))]
public void CasesSourceMethodTest(int i)
{
Assert.True(i > 0);
}

static IEnumerable<int> CasesSourceMethodWithParameters(int start, int count)
{
for (int i = 0; i < count; i++)
{
yield return start + i;
}
}
[TestCaseSource(nameof(CasesSourceMethodWithParameters), new object[] { 1, 4 })]
public void CasesSourceMethodWithParametersTest(int i)
{
Assert.True(i > 0);
}

public class AnotherClass
{
public static object[] CasesSource =
{
new object[] { 1, 2, 3 },
new object[] { 2, 3, 4 },
new object[] { 3, 4, 5 }
};
}
[TestCaseSource(typeof(AnotherClass), nameof(AnotherClass.CasesSource))]
public void CasesSourceAnotherClassTest(int i, int j, int k)
{
Assert.True(i > 0);
Assert.True(j > 0);
Assert.True(k > 0);
}

public static IEnumerable TestCaseDatas
{
get
{
yield return new TestCaseData(0).Returns(false);
yield return new TestCaseData(1).Returns(true);
yield return new TestCaseData(2).Returns(true);
yield return new TestCaseData(3).Returns(true);
}
}
[TestCaseSource(nameof(TestCaseDatas))]
public bool CasesSourceTestCaseDataTest(int i)
{
return i > 0;
}
}
}

0 comments on commit 8fb6abe

Please sign in to comment.