# Unit Tests
Unit tests in Stride are set up like any other unit tests in dotnet,
you create a new project specifically for unit tests, then write your tests in different C# files.
Here's a bare-bone project to get you started:
`YOUR_PROJECT_NAME.Windows.Tests.csproj`
```xml
net8.0-windows
win-x64
WinExe
..\Bin\Tests\Windows\$(Configuration)\
false
true
enable
enable
false
true
```
And an example C# file:
```cs
using Stride.Engine;
public class Tests
{
[Fact]
public void MyBareboneTest()
{
Assert.NotEqual(1, 2);
}
[Fact]
public void MyGameTest()
{
RunGameTest(async (game, scene) =>
{
var myEntity = new Entity();
scene.Entities.Add(myEntity);
Assert.NotEmpty(scene.Entities);
await game.Script.NextFrame(); // Wait one frame if you need to
myEntity.Scene = null;
Assert.Empty(scene.Entities);
});
}
///
/// Run the given function within a game, providing support for tests requiring ECS, physics simulation, graphics and others.
///
private static void RunGameTest(Func asyncFunction)
{
using var game = new Game();
// Fixed time step to reduce framerate discrepancies
game.IsFixedTimeStep = true;
game.IsDrawDesynchronized = false;
game.TargetElapsedTime = TimeSpan.FromTicks(10000000 / 60); // 60hz, 60fps
game.Script.AddTask(async () =>
{
await asyncFunction(game, game.SceneSystem.SceneInstance.RootScene);
game.Exit();
});
game.Run();
}
}
```