https://github.com/romfos/testfixture
Small fixture library. Test data generator for arrange section of unit test.
https://github.com/romfos/testfixture
csharp dotnet fixture tests unit-test
Last synced: 8 months ago
JSON representation
Small fixture library. Test data generator for arrange section of unit test.
- Host: GitHub
- URL: https://github.com/romfos/testfixture
- Owner: Romfos
- License: mit
- Created: 2022-09-30T15:37:29.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-17T18:03:16.000Z (about 2 years ago)
- Last Synced: 2024-05-17T19:23:17.014Z (about 2 years ago)
- Topics: csharp, dotnet, fixture, tests, unit-test
- Language: C#
- Homepage:
- Size: 132 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Description
Small fixture library for unit tests
[](https://github.com/Romfos/TestFixture/actions/workflows/verify.yml)
[](https://www.nuget.org/packages/TestFixture)
# Example
```csharp
[TestMethod]
public void ExampleTest()
{
// arrange
var underTest = new MyService();
var fixture = new Fixture();
var testData = fixture.Create();
// act
var actual = underTest.Add(testData);
// assert
Assert.AreEqual(3, actual);
}
```
# 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<> | ConcurrentBag<> | FrozenDictionary<,> |
| Collection<> | ImmutableDictionary<,> | ConcurrentDictionary<,> | FrozenSet<> |
| Dictionary<,> | ImmutableHashSet<> | ConcurrentQueue<> | |
| HashSet<> | ImmutableList<> | ConcurrentStack<> | |
| ICollection<> | ImmutableQueue<> | | |
| IDictionary<,> | ImmutableSortedDictionary<,> | | |
| IEnumerable<> | ImmutableSortedSet<> | | |
| IAsyncEnumerable<> | ImmutableStack<> | | |
| IList<> | IImmutableDictionary<,> | | |
| LinkedList<> | IImmutableList<> | | |
| List<> | IImmutableQueue<> | | |
| Queue<> | IImmutableStack<> | | |
| ReadOnlyCollection<> | | | |
| SortedDictionary<,> | | | |
| SortedList<,> | | | |
| SortedSet<> | | | |
| Stack<> | | | |
| IReadOnlyCollection<> | | | |
| IReadOnlyList<> | | | |
| IQueryable<> | | | |
- Composition of supported types in class, record, struct (inject method: first constructor, public set properties, public fields)