public void Ctor_HasEmptyHttpUserAgentString()
		{
			// arrange
			var info = new ClientInformation();

			// assert
			Assert.That(info.HttpUserAgentString, Is.EqualTo(string.Empty));
		}
		public void Ctor_HasUnknownPlatform()
		{
			// arrange
			var info = new ClientInformation();

			// assert
			Assert.That(info.Platform, Is.EqualTo("UNKNOWN"));
		}
		public void Ctor_HasUnknownOperatingSystem()
		{
			// arrange
			var info = new ClientInformation();

			// assert
			Assert.That(info.OperatingSystem, Is.EqualTo("UNKNOWN"));
		}
		public void Ctor_HasEmptyDescription()
		{
			// arrange
			var info = new ClientInformation();
			
			// assert
			Assert.That(info.Description, Is.EqualTo(string.Empty));
		}
Example #5
0
		public void SetClientInformation(ClientInformation information)
		{
			if (information == null)
			{
				throw new ArgumentNullException("information");	
			}

			ClientInformation = information;
		}
Example #6
0
		public ErrorLog()
		{
			Url = "UNKNOWN";
			CleanUrl = Url;
			User = "******";
			ServerVariables = new List<NameValuePair>();
			Cookies = new List<NameValuePair>();
			FormValues = new List<NameValuePair>();
			QuerystringValues = new List<NameValuePair>();
			ClientInformation = new ClientInformation();
			StatusCodeInformation = new HttpStatusCodeInformation();
            CustomDataValues = new List<NameValuePair>();
		}
		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 ClientInformation Resolve(string httpUserAgent)
        {
            if (!httpUserAgent.HasValue())
            {
                return new ClientInformation();
            }

            _httpUserAgent = httpUserAgent;

            SplitHttpUserAgent(httpUserAgent);

            var information = new ClientInformation
                              	{
                              		Browser = ResolveBrowser(),
                              		Platform = ResolvePlatform(),
                              		OperatingSystem = ResolveOperatingSystem(),
                              		HttpUserAgentString = _httpUserAgent
                              	};

            return 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));
		}