Skip to content

Commit

Permalink
Add simple test
Browse files Browse the repository at this point in the history
  • Loading branch information
xBaank committed Jul 21, 2024
1 parent 8606023 commit 2fb77e3
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
Expand Down
25 changes: 25 additions & 0 deletions Tests/PlayerTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Console.Audio;
using FluentAssertions;
using OpenTK.Audio.OpenAL;

namespace Tests;

public class PlayerTests
{
[Fact]
public async Task I_can_play_a_song()
{
await using var player = new PlayerController() { Volume = 0 };

var video = (
await player.SearchAsync("https://www.youtube.com/watch?v=f8mL0_4GeV0")
).First();

await player.SetAsync(video);
await player.PlayAsync();
await Task.Delay((player.TotalTime ?? default) + TimeSpan.FromSeconds(5));

player.State.Should().Be(ALSourceState.Stopped);
player.Song.Should().Be(video);
}
}
3 changes: 2 additions & 1 deletion Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
Expand All @@ -10,6 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
Expand Down
7 changes: 0 additions & 7 deletions Tests/UnitTest1.cs

This file was deleted.

0 comments on commit 2fb77e3

Please sign in to comment.