public UserConfigurationServiceTests() { m_httpClientFactoryMock = new Mock <IHttpClientFactory>(); m_localStorageMock = new Mock <ILocalStorage>(); m_userConfigurationService = new UserConfigurationService(m_httpClientFactoryMock.Object, m_localStorageMock.Object); }
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_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."); }
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 virtual IHttpActionResult UserConfigurationPut([FromBody] User_Configuration userConfigurations) { var result = new UserConfigurationService().PutUserConfigurations(UserId, userConfigurations); return(Ok(result)); }
public virtual IHttpActionResult UserConfigurationPost([FromBody] User_Configuration userConfigurations) { var result = new UserConfigurationService().PostUserConfigurations(UserId, userConfigurations); return(Created("", result)); }
public IHttpActionResult UserConfigurationGet() { var result = new UserConfigurationService().GetUserConfigurations(UserId); return(Ok(result)); }
public void UserConfigurationService_UnitTest_ConstructorWithNullFilePath_ThrowsArgumentNullException() { var service = new UserConfigurationService(null); }