Skip to content

Small fixture library. Test data generator for arrange section of unit test.

License

Notifications You must be signed in to change notification settings

Romfos/TestFixture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

Small fixture library for unit tests

.github/workflows/verify.yml TestFixture

Example

[TestMethod]
public void ExampleTest()
{
    // arrange
    var underTest = new MyService();
    
    var fixture = new Fixture();
    var testData = fixture.Create<string[]>();

    // act
    var actual = underTest.Add(testData);

    // assert
    Assert.AreEqual(3, actual);
}

Supported platforms

  • .NET 6 or newer
  • .NET Framework 4.6.2+

Nuget

https://www.nuget.org/packages/TestFixture

Supported Types

  • BCL types:
Category Types
Primitives byte, sbyte, short, ushort, int, uint, long, ulong, float, double, decimal, char, string, bool
System types Enum, Guid, Uri, Nullable<>
Date & Time TimeSpan, DateTime, DateTimeOffset, TimeOnly (.NET 6+), DateOnly (.NET 6+)
  • Collections:
Generic Immutable Concurrent Frozen (.NET 8+)
Array[] ImmutableArray<> ConcurrentDictionary<,> FrozenDictionary<,>
List<> ImmutableList<>
Dictionary<,> ImmutableDictionary<,>
Queue<> ImmutableQueue<>
Stack<> IImmutableList<>
IEnumerable<> IImmutableQueue<>
ICollection<> IImmutableDictionary<,>
IList<>
IDictionary<,>
IAsyncEnumerable<>
IReadOnlyList<>
IReadOnlyCollection<>
  • Composition of supported types in class, record, struct (inject method: first constructor, public set properties, public fields)