public override bool Handle(ApacheLogParser apacheLogParser) { string line = null; const int middlePivot = 1; line = apacheLogParser.ProccessingString.Split('[', ']')[middlePivot]; apacheLogParser.Result.DateTimeOffset = DateTimeHelpers.ConvertApacheLogDateTime(line); return(true); }
public void DataWithoutUnpropriateFilesAndWithoutQueryParamers_Test() { var testData = "199.72.81.55 - - [01/Jul/1995:00:00:01 -0400] \"GET /history/apollo/ HTTP/1.0\" 200 6245"; _sut.TryParse(testData, out var result); Assert.AreEqual(result.ContentSize, 6245L); Assert.AreEqual(result.DateTimeOffset, DateTimeHelpers.ConvertApacheLogDateTime("01/Jul/1995:00:00:01 -0400")); Assert.AreEqual(result.Host, "199.72.81.55"); Assert.AreEqual(result.Route, "/history/apollo/"); Assert.AreEqual(result.StatusCode, 200); Assert.AreEqual(result.QueryParameters, string.Empty); }