本文整理汇总了C#中FileLineRecorderContext类的典型用法代码示例。如果您正苦于以下问题:C# FileLineRecorderContext类的具体用法?C# FileLineRecorderContext怎么用?C# FileLineRecorderContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileLineRecorderContext类属于命名空间,在下文中一共展示了FileLineRecorderContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyContextMapping_IfFieldsIsNotEmpty_ReturnNextInstructionSkip
public void ApplyContextMapping_IfFieldsIsNotEmpty_ReturnNextInstructionSkip()
{
//Arrange
RecorderContext context = new FileLineRecorderContext();
string[] fields = { "lorem", "ipsum" };
Exception error = null;
//Act
// ReSharper disable ExpressionIsAlwaysNull
var actual = MethodTestHelper.RunInstanceMethod<FileLineRecorder, NextInstruction>("ApplyContextMapping", _fileLineRecorder, new object[] { context, fields, error });
// ReSharper restore ExpressionIsAlwaysNull
//Assert
Assert.AreEqual(actual, NextInstruction.Skip);
}
示例2: DoLogic_IfRecorderContextNotNull_ReturnNextInstructionAbort
public void DoLogic_IfRecorderContextNotNull_ReturnNextInstructionAbort()
{
//Arrange
_context.RecordSent = 10;
RecorderContext rc = new FileLineRecorderContext();
_context.CurrentFile = new TerminalRemoteFileSystemInfo(rc, "", "");
//Act
// ReSharper disable ExpressionIsAlwaysNull
var actual = MethodTestHelper.RunInstanceMethod<FileRecorder, NextInstruction>("DoLogic", _fileRecorder, new object[] { _context });
// ReSharper restore ExpressionIsAlwaysNull
//Assert
Assert.AreEqual(actual, NextInstruction.Abort);
}
示例3: OnFieldMatch_IfMatchIsSuccessForTrueInput_ReturnNextInstructionReturn
public void OnFieldMatch_IfMatchIsSuccessForTrueInput_ReturnNextInstructionReturn()
{
//Arrange
var match = Regex.Match("Jun 4, 2012 00:00:08.000000000 192.168.20.89 00:26:22:44:1A:E3 66.220.151.77 GET 0-131.channel.facebook.com /pull?channel=p_1667955184%26seq=395%26partition=0%26clientid=75125d48%26cb=jmbc%26idle=926", @"(?<DATE>[a-zA-Z]*\s*[0-9]*,\s*[0-9]*\s*[0-9\:\.]*)\s*(?<SRC_IP>[0-9\.]*)\s*(?<SRC_MAC>.[^\s]*)\s*(?<DST_IP>[0-9\.]*)\s*(?<METHOD>.[^\s]*)\s*(?<URL>.[^\s]+)\s+(?<URI>.+)");
string field = null;
var context = new FileLineRecorderContext(_coslatUrlUnifiedRecorder)
{
SourceHeaderInfo = new Dictionary<string, int>()
};
//Act
// ReSharper disable ExpressionIsAlwaysNull
var actual = MethodTestHelper.RunInstanceMethod<CoslatUrlUnifiedRecorder, NextInstruction>("OnFieldMatch", _coslatUrlUnifiedRecorder, new object[] { context, field, match });
// ReSharper restore ExpressionIsAlwaysNull
//Assert
Assert.AreEqual(actual, NextInstruction.Return);
}
示例4: OnFieldMatch_IfContextIsNotIncludeSourceHeaderInfo_ReturnNullReferenceException
public void OnFieldMatch_IfContextIsNotIncludeSourceHeaderInfo_ReturnNullReferenceException()
{
//Arrange
var match = Regex.Match("Lorem ipsum", ".*");
string field = null;
var context = new FileLineRecorderContext(_coslatUrlUnifiedRecorder);
//Act
// ReSharper disable ExpressionIsAlwaysNull
MethodTestHelper.RunInstanceMethod<CoslatUrlUnifiedRecorder, NextInstruction>("OnFieldMatch", _coslatUrlUnifiedRecorder, new object[] { context, field, match });
// ReSharper restore ExpressionIsAlwaysNull
//Assert
//Unhandled System.NullReferenceException
}
示例5: OnFieldMatch_IfMatchIsSuccessForTrueInput_ReturnNextInstructionReturn
public void OnFieldMatch_IfMatchIsSuccessForTrueInput_ReturnNextInstructionReturn()
{
//Arrange
var match = Regex.Match("May 20 11:32:37 raven-lindev sshd[3092]: Server listening on :: port 22", "(?<DATE>[a-zA-Z]*\\s[0-9]*\\s[0-9\\:]+)\\s+(?<HOST_NAME>[^\\s]+)\\s+(?<EVENT>[^\\[]+)\\s*\\[\\s*(?<ID>[^\\]]+)\\]\\s*:\\s*(?<DESCRIPTION>[^\\n]+)");
string field = null;
var context = new FileLineRecorderContext(_ubuntuAuthUnifiedRecorder)
{
SourceHeaderInfo = new Dictionary<string, int>()
};
//Act
// ReSharper disable ExpressionIsAlwaysNull
var actual = MethodTestHelper.RunInstanceMethod<UbuntuAuthUnifiedRecorder, NextInstruction>("OnFieldMatch", _ubuntuAuthUnifiedRecorder, new object[] { context, field, match });
// ReSharper restore ExpressionIsAlwaysNull
//Assert
Assert.AreEqual(actual, NextInstruction.Return);
}
示例6: InputTextType_IfContextInputRecordLenthIsZero_ReturnComment
public void InputTextType_IfContextInputRecordLenthIsZero_ReturnComment()
{
//Arrange
var context = new FileLineRecorderContext(_netscalerUnifiedRecorder);
var inputTextRecord = new TextRecord { RecordText = String.Empty };
context.InputRecord = inputTextRecord;
Exception error = null;
//Act
// ReSharper disable ExpressionIsAlwaysNull
var actual = MethodTestHelper.RunInstanceMethod<NetscalerUnifiedRecorder, RecordInputType>("InputTextType", _netscalerUnifiedRecorder, new object[] { context, error });
// ReSharper restore ExpressionIsAlwaysNull
//Assert
Assert.AreEqual(actual, RecordInputType.Comment);
}
示例7: OnFieldMatch_IfMatchIsSuccessForTrueInput_ReturnNextInstructionReturn
public void OnFieldMatch_IfMatchIsSuccessForTrueInput_ReturnNextInstructionReturn()
{
//Arrange
var match = Regex.Match("2014-07-10 03:24:38.08 spid3s Resource governor reconfiguration succeeded.", @"^(?<DATE>[^\s]+)\s+(?<TIME>[^\s]+)\s+(?<EVENT>[^\s]+)\s+(?<DESCRIPTION>[^\n]+)$");
string field = null;
var context = new FileLineRecorderContext(_mssqlErrorUnifiedRecorder)
{
SourceHeaderInfo = new Dictionary<string, int>()
};
//Act
// ReSharper disable ExpressionIsAlwaysNull
var actual = MethodTestHelper.RunInstanceMethod<MssqlErrorUnifiedRecorder, NextInstruction>("OnFieldMatch", _mssqlErrorUnifiedRecorder, new object[] { context, field, match });
// ReSharper restore ExpressionIsAlwaysNull
//Assert
Assert.AreEqual(actual, NextInstruction.Return);
}
示例8: OnFieldMatch_IfMatchIsSuccessForTrueInput_ReturnNextInstructionReturn
public void OnFieldMatch_IfMatchIsSuccessForTrueInput_ReturnNextInstructionReturn()
{
//Arrange
var match = Regex.Match("7/21/2013,6:06:25 PM, SRMTESTMIRROR,8,750,Primary Image,Synchronized, Normal,11,82.5, 11.00,667.5, 89.00", "^(?<DATE>[^,]+),(?<TIME>[^,]+),(?<COMPUTER_NAME>[^,]+),(?<LUN>[^,]+),(?<IMAGE_SIZE>[^,]+),(?<IMAGE_STATE>[^,]+),(?<IMAGE_CONDITION>[^,]+),(?<SYNCPROCESS>[^,]+),(?<SYNCED_SIZE>[^,]+),(?<SYNCED_PERCENT>[^,]+),(?<REMAINED_SIZE>[^,]+),(?<REMAINED_PERCENT>[^,]+),(?<SINCE_LAST_UPDATE>[^\\,]+)$");
string field = null;
var context = new FileLineRecorderContext(_emcStorageRepUnifiedRecorder)
{
SourceHeaderInfo = new Dictionary<string, int>()
};
context.SourceHeaderInfo.Add("EventType",8);
//Act
// ReSharper disable ExpressionIsAlwaysNull
var actual = MethodTestHelper.RunInstanceMethod<EmcStorageRepUnifiedRecorder, NextInstruction>("OnFieldMatch", _emcStorageRepUnifiedRecorder, new object[] { context, field, match });
// ReSharper restore ExpressionIsAlwaysNull
//Assert
Assert.AreEqual(actual, NextInstruction.Return);
}
示例9: GetLastProcessedFile_IfContextIsNull_ReturnTrue
public void GetLastProcessedFile_IfContextIsNull_ReturnTrue()
{
//Arrange;
var context = new FileLineRecorderContext(_windowsSharelog);
context.LastFile = "asdas";
//Act
// ReSharper disable ExpressionIsAlwaysNull
var actual = MethodTestHelper.RunInstanceMethod<WindowsShareLogUnifiedRecorder, bool>("GetLastProcessedFile", _windowsSharelog, new object[] { context, true });
// ReSharper restore ExpressionIsAlwaysNull
//Assert
Assert.AreEqual(actual, true);
}
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:15,代码来源:WindowsShareLogUnifiedRecorderUnitTestFixture.cs
示例10: OnAfterSetData_IfContextFileLineRecorderContext_ReturnAbort
public void OnAfterSetData_IfContextFileLineRecorderContext_ReturnAbort()
{
//Arrange
RecorderContext context = new FileLineRecorderContext();
//Act
// ReSharper disable ExpressionIsAlwaysNull
var actual = MethodTestHelper.RunInstanceMethod<DbRecorderBase, NextInstruction>("OnAfterSetData", _dbRecorderBase, new object[] { context });
// ReSharper restore ExpressionIsAlwaysNull
//Assert
Assert.AreEqual(actual, NextInstruction.Abort);
}
示例11: InitContextInstance_IfContextInputRecordIsNull_NullReferenceException
public void InitContextInstance_IfContextInputRecordIsNull_NullReferenceException()
{
//Arrange
var context = new FileLineRecorderContext(_fileLineRecorder) { InputRecord = null };
object[] ctxArgs = null;
//Act
// ReSharper disable ExpressionIsAlwaysNull
MethodTestHelper.RunInstanceMethod<FileLineRecorder>("InitContextInstance", _fileLineRecorder, new object[] { context, ctxArgs });
// ReSharper restore ExpressionIsAlwaysNull
//Assert
// //Unhandled exception
}
示例12: GetHeaderInfo_IfHeaderInfoIsNull_ReturnAbort
public void GetHeaderInfo_IfHeaderInfoIsNull_ReturnAbort()
{
//Arrange
RecorderContext context = new FileLineRecorderContext();
context.HeaderInfo = null;
Exception error = null;
//Act
// ReSharper disable ExpressionIsAlwaysNull
var actual = MethodTestHelper.RunInstanceMethod<DbRecorderBase, NextInstruction>("GetHeaderInfo", _dbRecorderBase, new object[] { context, error });
// ReSharper restore ExpressionIsAlwaysNull
//Assert
Assert.AreEqual(actual, NextInstruction.Abort);
}
示例13: InputTextType_IfContextInputRecordIsEmpty_ReturnComment
public void InputTextType_IfContextInputRecordIsEmpty_ReturnComment()
{
//Arrange
var context = new FileLineRecorderContext(_iisFtpUnifiedRecorder) { InputRecord = new TextRecord() };
Exception error = null;
//Act
// ReSharper disable ExpressionIsAlwaysNull
var actual = MethodTestHelper.RunInstanceMethod<IisFtpUnifiedRecorder, RecordInputType>("InputTextType", _iisFtpUnifiedRecorder, new object[] { context, error });
// ReSharper restore ExpressionIsAlwaysNull
//Assert
Assert.AreEqual(actual, RecordInputType.Comment);
}
示例14: OnBeforeProcessRecordInput_IfContextHeaderInfoIsNotNull_ReturnNextInstructionDo
public void OnBeforeProcessRecordInput_IfContextHeaderInfoIsNotNull_ReturnNextInstructionDo()
{
//Arrange
var context = new FileLineRecorderContext(_ftp2012UnifiedRecorder)
{
HeaderInfo = new DataMappingInfo()
};
//Act
// ReSharper disable ExpressionIsAlwaysNull
var actual = MethodTestHelper.RunInstanceMethod<Ftp2012UnifiedRecorder, NextInstruction>("OnBeforeProcessRecordInput", _ftp2012UnifiedRecorder, new object[] { context });
// ReSharper restore ExpressionIsAlwaysNull
//Assert
Assert.AreEqual(actual, NextInstruction.Do);
}
示例15: OnFieldMatch_IfsourceIsempty_ReturnNextInstructionAbort
public void OnFieldMatch_IfsourceIsempty_ReturnNextInstructionAbort()
{
//Arrange
Match match = null;
RecorderContext context = new FileLineRecorderContext(_trendMicroUrlUnifiedRecorder);
var source = string.Empty;
//Act
// ReSharper disable ExpressionIsAlwaysNull
var actual = MethodTestHelper.RunInstanceMethod<TrendMicroUrlUnifiedRecorder, NextInstruction>("OnFieldMatch", _trendMicroUrlUnifiedRecorder, new object[] { context, source, match });
// ReSharper restore ExpressionIsAlwaysNull
//Assert
Assert.AreEqual(actual, NextInstruction.Abort);
}