Files
GmRelayBot/tests/GmRelay.Bot.Tests/Project/LicenseFileTests.cs
Toutsu 9deccd3a9d
PR Checks / test-and-build (pull_request) Successful in 7m7s
docs: add MIT LICENSE file
Add LICENSE file with MIT License text to repository root.
README.md already references it; the file was missing.

Includes TDD-verified tests ensuring LICENSE exists and contains
MIT License text, and README references it correctly.

Bump version → 1.15.1

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 16:25:17 +03:00

47 lines
1.4 KiB
C#

using System;
using System.IO;
using Xunit;
namespace GmRelay.Bot.Tests.Project;
public class LicenseFileTests
{
private static string GetRepoRoot()
{
var dir = AppContext.BaseDirectory;
while (!string.IsNullOrEmpty(dir) && !File.Exists(Path.Combine(dir, "Directory.Build.props")))
{
dir = Directory.GetParent(dir)?.FullName;
}
return dir ?? throw new InvalidOperationException("Could not find repo root");
}
[Fact]
public void LicenseFile_ExistsInRepoRoot()
{
var repoRoot = GetRepoRoot();
var licensePath = Path.Combine(repoRoot, "LICENSE");
Assert.True(File.Exists(licensePath), "LICENSE file should exist in repo root");
}
[Fact]
public void LicenseFile_ContainsMitLicenseText()
{
var repoRoot = GetRepoRoot();
var licensePath = Path.Combine(repoRoot, "LICENSE");
Assert.True(File.Exists(licensePath), "LICENSE file should exist");
var content = File.ReadAllText(licensePath);
Assert.Contains("MIT License", content);
}
[Fact]
public void Readme_ReferencesLicenseFile()
{
var repoRoot = GetRepoRoot();
var readmePath = Path.Combine(repoRoot, "README.md");
Assert.True(File.Exists(readmePath), "README.md should exist");
var content = File.ReadAllText(readmePath);
Assert.Contains("./LICENSE", content);
}
}