public void RetrievalType_WithInvalidValue_ThrowsException() { // Arrange var invalidRetrievalType = (UserIdentityRetrievalType)(-1); var configuration = new AspNetSqlLoggingProviderConfiguration("Valid name"); // Act configuration.RetrievalType = invalidRetrievalType; }
public void Constructor_WithValidArguments_Succeeds() { // Arrange var validThreshold = LoggingEventType.Critical; var validConfiguration = new AspNetSqlLoggingProviderConfiguration("Valid app name"); var validConnectionString = "Valid constr"; // Act new AspNetSqlLoggingProvider(validThreshold, validConfiguration, validConnectionString, null); }
public void Constructor_WithValidArguments_InitializesLogQueryStringWithTrue() { // Arrange var expectedLogQueryString = true; // Act var configuration = new AspNetSqlLoggingProviderConfiguration("Valid name"); // Assert Assert.AreEqual(expectedLogQueryString, configuration.LogQueryString); }
public void Constructor_WithValidArguments_InitializesLogFormDataWithFalse() { // Arrange var expectedLogFormData = false; // Act var configuration = new AspNetSqlLoggingProviderConfiguration("Valid name"); // Assert Assert.AreEqual(expectedLogFormData, configuration.LogFormData); }
public void Constructor_WithValidArguments_SetsApplicationNameProperty() { // Arrange var expectedApplicationName = "Valid name"; // Act var configuration = new AspNetSqlLoggingProviderConfiguration(expectedApplicationName); // Assert Assert.AreEqual(expectedApplicationName, configuration.ApplicationName); }
public void Constructor_WithValidArguments_InitializesRetrievalTypeAsNone() { // Arrange var expectedRetrievalType = UserIdentityRetrievalType.None; // Act var configuration = new AspNetSqlLoggingProviderConfiguration("Valid name"); // Assert Assert.AreEqual(expectedRetrievalType, configuration.RetrievalType); }
public void LogFormData_ChangingValueToTrue_ShouldSucceed() { // Arrange var expectedValue = true; var configuration = new AspNetSqlLoggingProviderConfiguration("Valid name"); // Act configuration.LogFormData = expectedValue; // Assert Assert.AreEqual(expectedValue, configuration.LogFormData); }
public void LogQueryString_ChangingValueToFalse_ShouldSucceed() { // Arrange var expectedValue = false; var configuration = new AspNetSqlLoggingProviderConfiguration("Valid name"); // Act configuration.LogQueryString = expectedValue; // Assert Assert.AreEqual(expectedValue, configuration.LogQueryString); }
public void RetrievalType_ChangingValue_ShouldSucceed() { // Arrange var expectedRetrievalType = UserIdentityRetrievalType.Membership; var configuration = new AspNetSqlLoggingProviderConfiguration("Valid name"); // Act configuration.RetrievalType = expectedRetrievalType; // Arrange Assert.AreEqual(expectedRetrievalType, configuration.RetrievalType); }
public void Constructor_WithValidConfiguration_SetsRetrievalTypeProperty() { var expectedRetrievalType = UserIdentityRetrievalType.WindowsIdentity; var validConfiguration = new AspNetSqlLoggingProviderConfiguration("Valid app name") { RetrievalType = expectedRetrievalType }; // Act var provider = new AspNetSqlLoggingProvider(LoggingEventType.Critical, validConfiguration, "Valid constr", null); // Assert Assert.AreEqual(expectedRetrievalType, provider.RetrievalType); }
public void Constructor_WithValidConfiguration_SetsLogFormDataProperty() { var expectedLogFormData = true; var validConfiguration = new AspNetSqlLoggingProviderConfiguration("Valid app name") { LogFormData = expectedLogFormData }; // Act var provider = new AspNetSqlLoggingProvider(LoggingEventType.Critical, validConfiguration, "Valid constr", null); // Assert Assert.AreEqual(expectedLogFormData, provider.LogFormData); }
public void Constructor_ChangingLogFormDataInConfigurationAfterConstructorCall_HasNoEffect() { // Arrange var validConfiguration = new AspNetSqlLoggingProviderConfiguration("valid name") { LogFormData = true }; var provider = new AspNetSqlLoggingProvider(LoggingEventType.Critical, validConfiguration, "Valid constr", null); // Act validConfiguration.LogFormData = false; // Assert Assert.AreEqual(true, provider.LogFormData); }
public void Constructor_ChangingRetrievalTypeInConfigurationAfterConstructorCall_HasNoEffect() { // Arrange var validConfiguration = new AspNetSqlLoggingProviderConfiguration("valid name") { RetrievalType = UserIdentityRetrievalType.None }; var provider = new AspNetSqlLoggingProvider(LoggingEventType.Critical, validConfiguration, "Valid constr", null); // Act validConfiguration.RetrievalType = UserIdentityRetrievalType.Membership; // Assert Assert.AreEqual(UserIdentityRetrievalType.None, provider.RetrievalType); }
public void Constructor_WithTooLongApplicationName_ThrowsException() { // Arrange string invalidApplicationName = new string('a', 256); try { // Act var configuration = new AspNetSqlLoggingProviderConfiguration(invalidApplicationName); // Assert Assert.Fail("Exception expected."); } catch (Exception ex) { Assert.IsInstanceOfType(ex, typeof(ArgumentException)); var message = ex.Message; Assert.IsTrue(message.Contains("Value is too long"), "Message not descriptive: " + message); } }