public void UserConfigurationService_UnitTest_Constructor_InitializesProperties() { var filePath = Path.Combine(_testDir, Guid.NewGuid() + ".config"); var service = new UserConfigurationService(filePath); Assert.IsNotNull(service.Help, "Help property was not initialized by constructor."); Assert.IsNotNull(service.Help.IsCollapsed, "Help IsCollapsed property was not initialized by constructor."); }
public void UserConfigurationService_UnitTest_HelpIsCollapsedWithoutType_ReturnsFalse() { var filePath = Path.Combine(_testDir, Guid.NewGuid() + ".config"); var service = new UserConfigurationService(filePath); var type = typeof(DsfActivity); var actual = service.Help.IsCollapsed[type]; Assert.IsFalse(actual, "Help.IsCollapsed did not return false for a type not in the dictionary."); }
public void UserConfigurationService_UnitTest_HelpIsCollapsedWithType_ReturnsStoredValue() { var filePath = Path.Combine(_testDir, Guid.NewGuid() + ".config"); var service = new UserConfigurationService(filePath); Assert.IsNotNull(service.Help, "Help property was not initialized by constructor."); Assert.IsNotNull(service.Help.IsCollapsed, "Help IsCollapsed property was not initialized by constructor."); const bool Expected = true; var type = typeof(DsfActivity); service.Help.IsCollapsed[type] = Expected; var actual = service.Help.IsCollapsed[type]; Assert.AreEqual(Expected, actual, "Help.IsCollapsed did not return the value stored for the type in the dictionary."); }
public void UserConfigurationService_UnitTest_ConstructorWithNullFilePath_ThrowsArgumentNullException() { var service = new UserConfigurationService(null); }
public void UserConfigurationService_UnitTest_PersistenceDispose_FileWritten() { var filePath = Path.Combine(_testDir, Guid.NewGuid() + ".config"); var service = new UserConfigurationService(filePath); var exists = File.Exists(filePath); Assert.IsFalse(exists, "UserConfigurationService created file before test."); service.Dispose(); exists = File.Exists(filePath); Assert.IsTrue(exists, "UserConfigurationService did not write file when disposed."); }