private void AddToLogs(string type, string message, string source, DateTime time, string user, string url, ClientInformation clientInformation) { var errorLog = new ErrorLog { ErrorId = Guid.NewGuid(), Application = "/", Type = type, Message = message, Source = source, Time = time }; if (user.HasValue()) { errorLog.AddServerVariable(HttpServerVariables.LogonUser, user); } if (url.HasValue()) { errorLog.AddServerVariable(HttpServerVariables.Url, url); } errorLog.SetClientInformation(clientInformation); _logs.Add(errorLog); }
public void SetClientInformation_InformationIsNull_Throws() { // arrange var error = new ErrorLog(); // act var result = Assert.Throws<ArgumentNullException>(() => error.SetClientInformation(null)); // assert Assert.That(result, Is.Not.Null); Assert.That(result.ParamName, Is.EqualTo("information")); }
public void SetClientInformation_SetsInformation() { // arrange var error = new ErrorLog(); var info = new ClientInformation(); // act error.SetClientInformation(info); // assert Assert.That(error.ClientInformation, Is.EqualTo(info)); }