-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #428 from TimeWarpEngineering/Cramer/2024-06-23/Next
Only include contentFiles in nuget. Put types in contentfiles and js …
- Loading branch information
Showing
8 changed files
with
127 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace ConventionTest_; | ||
|
||
using FluentAssertions; | ||
using TimeWarp.Fixie; | ||
|
||
[TestTag(TestTags.Fast)] | ||
public class SimpleNoApplicationTest_Should_ | ||
{ | ||
public static void AlwaysPass() => true.Should().BeTrue(); | ||
|
||
[Skip("Demonstrates skip attribute")] | ||
public static void SkipExample() => true.Should().BeFalse(); | ||
|
||
[TestTag(TestTags.Fast)] | ||
public static void TagExample() => true.Should().BeTrue(); | ||
|
||
[Input(5, 3, 2)] | ||
[Input(8, 5, 3)] | ||
public static void Subtract(int aX, int aY, int aExpectedDifference) | ||
{ | ||
int result = aX - aY; | ||
result.Should().Be(aExpectedDifference); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace TimeWarp.State.Tests; | ||
|
||
class TestingConvention : TimeWarp.Fixie.TestingConvention { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Fixie.TestAdapter" /> | ||
<PackageReference Include="FluentAssertions" /> | ||
<PackageReference Include="TimeWarp.Fixie" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Source\TimeWarp.State\TimeWarp.State.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
namespace GetEnclosingStateType_; | ||
|
||
using FluentAssertions; | ||
using TimeWarp.Features.RenderSubscriptions; | ||
using TimeWarp.State; | ||
using TimeWarp.State.Extensions; | ||
|
||
public class TypeExtensionsTests | ||
{ | ||
private class TestState : IState | ||
{ | ||
public class NestedClass | ||
{ | ||
} | ||
|
||
public class AnotherNestedClass : NestedClass | ||
{ | ||
} | ||
|
||
public Guid Guid { get; } | ||
public void Initialize() => throw new NotImplementedException(); | ||
} | ||
|
||
public void Should_Get_Enclosing_State_Type_For_Nested_Class() | ||
{ | ||
// Arrange | ||
Type nestedClassType = typeof(TestState.NestedClass); | ||
|
||
// Act | ||
Type enclosingStateType = nestedClassType.GetEnclosingStateType(); | ||
|
||
// Assert | ||
enclosingStateType.Should().Be(typeof(TestState)); | ||
} | ||
|
||
public void Should_Get_Enclosing_State_Type_For_Deeply_Nested_Class() | ||
{ | ||
// Arrange | ||
Type deeplyNestedClassType = typeof(TestState.AnotherNestedClass); | ||
|
||
// Act | ||
Type enclosingStateType = deeplyNestedClassType.GetEnclosingStateType(); | ||
|
||
// Assert | ||
enclosingStateType.Should().Be(typeof(TestState)); | ||
} | ||
|
||
public void Should_Throw_Exception_For_Non_Nested_Class() | ||
{ | ||
// Arrange | ||
Type nonNestedClassType = typeof(string); // Example of a non-nested class | ||
|
||
// Act & Assert | ||
Action act = () => nonNestedClassType.GetEnclosingStateType(); | ||
act.Should().Throw<NonNestedClassException>() | ||
.WithMessage("String must be nested in a class that implements IState"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters