public void CanWriteInactiveAccentColor() { // Arrange MockFileSystem mockFileSystem = new MockFileSystem(); RegFileProcessor systemUnderTest = new RegFileProcessor(mockFileSystem); string mockOutputFilePath = @"C:\test.reg"; string[] expectedResult = { "Windows Registry Editor Version 5.00", "", "; created with Colorful Title Bars application", "; visit https://github.com/Plotron/Colorful-Title-Bars for more details", "", "[HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\DWM]", "\"AccentColorInactive\"=dword:00d5bb72", }; // Act systemUnderTest.SaveInactiveAccentColorToRegFile(Color.FromArgb(114, 187, 213), mockOutputFilePath); // Assert string[] outputLines = mockFileSystem.GetFile(mockOutputFilePath).TextContents.SplitLines(); Assert.IsTrue(expectedResult.SequenceEqual(outputLines)); }
public void CanReadInactiveAccentColorFromRegFile() { // Arrange MockFileSystem mockFileSystem = new MockFileSystem(); RegFileProcessor systemUnderTest = new RegFileProcessor(mockFileSystem); var mockInputRegFile = new MockFileData( "Windows Registry Editor Version 5.00" + "\r\n; created with Colorful Title Bars application" + "\r\n; visit https://github.com/Plotron/Colorful-Title-Bars for more details" + "\r\n[HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\DWM]" + "\r\n\"AccentColorInactive\"=dword:00D5BB72" + "\r\n\"AccentColor\"=dword:00FF9A7D2D"); string mockInputFilePath = @"C:\test.reg"; mockFileSystem.AddFile(mockInputFilePath, mockInputRegFile); Color expectedResult = Color.FromArgb(114, 187, 213); // Act Color?actualResult = systemUnderTest.LoadInactiveAccentColorFromRegFile(mockInputFilePath); // Assert Assert.IsTrue(actualResult.HasValue); Assert.AreEqual(expectedResult, actualResult); }
public void ReadingInactiveAccentColorFromBlankRegFileReturnsNoValue() { // Arrange MockFileSystem mockFileSystem = new MockFileSystem(); RegFileProcessor systemUnderTest = new RegFileProcessor(mockFileSystem); var mockInputRegFile = new MockFileData( ""); string mockInputFilePath = @"C:\test.reg"; mockFileSystem.AddFile(mockInputFilePath, mockInputRegFile); // Act Color?result = systemUnderTest.LoadInactiveAccentColorFromRegFile(mockInputFilePath); // Assert Assert.IsFalse(result.HasValue); }
public void ReadingInactiveAccentColorFromIncompleteRegFileReturnsNoValue() { // Arrange MockFileSystem mockFileSystem = new MockFileSystem(); RegFileProcessor systemUnderTest = new RegFileProcessor(mockFileSystem); var mockInputRegFile = new MockFileData( "Windows Registry Editor Version 5.00" + "\r\n[HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\DWM]" + "\r\n\"AccentColorInactive\"=dword:00D5B"); string mockInputFilePath = @"C:\test.reg"; mockFileSystem.AddFile(mockInputFilePath, mockInputRegFile); // Act Color?result = systemUnderTest.LoadInactiveAccentColorFromRegFile(mockInputFilePath); // Assert Assert.IsFalse(result.HasValue); }
public MainForm() { InitializeComponent(); _windowColor = new RegFileProcessor(); }