/UnitTests/GitUI.Tests/Theming/ThemeFileReaderTests.cs
C# | 41 lines | 36 code | 5 blank | 0 comment | 0 complexity | 6a2ca99dfecc300e744276bf1d165e7a MD5 | raw file
Possible License(s): GPL-3.0
- using System.IO;
- using FluentAssertions;
- using GitUI.Theming;
- using NUnit.Framework;
- namespace GitUITests.Theming
- {
- [TestFixture]
- public class ThemeFileReaderTests
- {
- [Test]
- public void Should_return_file_text()
- {
- const string mockThemeContent = "test content";
- ThemeFileReader reader = new();
- var tempPath = Path.GetTempFileName();
- try
- {
- File.WriteAllText(tempPath, mockThemeContent);
- reader.ReadThemeFile(tempPath).Should().Be(mockThemeContent);
- }
- finally
- {
- File.Delete(tempPath);
- }
- }
- [Test]
- public void Should_throw_ThemeException_if_file_does_not_exist()
- {
- string nonExistingFile = Path.Combine(TestContext.CurrentContext.TestDirectory, "non_existing_theme.css");
- ThemeFileReader reader = new();
- reader.Invoking(_ => _.ReadThemeFile(nonExistingFile))
- .Should().Throw<ThemeException>()
- .Which.InnerException.Should().BeOfType<FileNotFoundException>();
- }
- }
- }