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); }
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); }
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); }
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 }
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); }
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); }
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); }
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); }
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); }
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); }
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 }
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); }
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); }
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); }
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); }
public void InputTextType_IfContextInputRecordRecordTextIsNull_ReturnComment() { //Arrange var context = new FileLineRecorderContext(_windowsSharelog); var inputTextRecord = new TextRecord { RecordText = null }; context.InputRecord = inputTextRecord; Exception error = null; //Act // ReSharper disable ExpressionIsAlwaysNull var actual = MethodTestHelper.RunInstanceMethod<WindowsShareLogUnifiedRecorder, RecordInputType>("InputTextType", _windowsSharelog, new object[] { context, error }); // ReSharper restore ExpressionIsAlwaysNull //Assert Assert.AreEqual(actual, RecordInputType.Comment); }
public void OnFieldMatch_IfMatchIsSuccessForTrueInput_ReturnNextInstructionReturn() { //Arrange var match = Regex.Match(@"1,2011/01/25 01:26:40,0004C100832,THREAT,url,1,2011/01/25 01:26:39,10.10.9.42,5.126.182.187,193.189.142.3,75.126.182.187,URL_Default,tpe\guvenlik,,web-browsing,vsys1,LAN,Internet,ethernet1/6,ethernet1/1,,2011/01/25 01:26:40,29394,1,4125,80,63495,80,0x40,tcp,block-url,srv.sayyac.net/sa.js?_salogin=ztporno&_sav=4.3,(9999),malware-sites,informational,client-to-server", @"^(?<DOMAIN>[^,]*),(?<RECEIVE_TIME>[^,]*),(?<SERIAL>[^,]*),(?<TYPE>[^,]*),(?<CONTENT_TYPE>[^,]*),(?<CONFIG_VERSION>[^,]*),(?<GENERATE_TIME>[^,]*),(?<SOURCE_ADDRESS>[^,]*),(?<DESTINATION_ADDRESS>[^,]*),(?<NAT_SOURCE_IP>[^,]*),(?<NAT_DESTINATION_IP>[^,]*),(?<RULE>[^,]*),(?<SOURCE_USER>[^,]*),(?<DESTINATION_USER>[^,]*),(?<APPLICATION>[^,]*),(?<VIRTUAL_SYSTEM>[^,]*),(?<SOURCE_ZONE>[^,]*),(?<DESTINATION_ZONE>[^,]*),(?<INBOUND_INTERFACE>[^,]*),(?<OUTBOUND_INTERFACE>[^,]*),(?<LOG_ACTION>[^,]*),(?<TIME_LOGGED>[^,]*),(?<SESSION_ID>[^,]*),(?<REPEAT_COUNT>[^,]*),(?<SOURCE_PORT>[^,]*),(?<DESTINATION_PORT>[^,]*),(?<NAT_SOURCE_PORT>[^,]*),(?<NAT_DESTINATION_PORT>[^,]*),(?<FLAGS>[^,]*),(?<IP_PROTOCOL>[^,]*),(?<ACTION>[^,]*),(((?<BYTES>[^,]*),(?<BYTES_RCV>[^,]*),(?<BYTES_SEND>[^,]*),(?<PACKETS>[^,]*),(?<START_TIME>[^,]*),(?<ELAPSED>[^,]*),(?<URL_CATEGORY>[^,]*),(?<PADDING>[^\,]*))|((?<URL>[^,]*),(?<CONTENT_NAME>[^,]*),(?<CATEGORY>[^,]*),(?<SEVERITY>[^,]*),(?<DIRECTION>[^\,]*)))$"); string field = null; var context = new FileLineRecorderContext(_paloAltoUrlUnifiedRecorder) { SourceHeaderInfo = new Dictionary<string, int>() }; //Act // ReSharper disable ExpressionIsAlwaysNull var actual = MethodTestHelper.RunInstanceMethod<PaloAltoUrlUnifiedRecorder, NextInstruction>("OnFieldMatch", _paloAltoUrlUnifiedRecorder, new object[] { context, field, match }); // ReSharper restore ExpressionIsAlwaysNull //Assert Assert.AreEqual(actual, NextInstruction.Return); }
public void OnBeforeSetData_IfContextNotNull_ReturnNextInstructionDo() { //Arrange RecorderContext context = new FileLineRecorderContext(_windowsSharelog); context.Record.Datetime = "2014-09-15 14:12:53"; const string text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit"; var inputTextRecord = new TextRecord { RecordText = text }; context.InputRecord = inputTextRecord; //Act // ReSharper disable ExpressionIsAlwaysNull var actual = MethodTestHelper.RunInstanceMethod<WindowsShareLogUnifiedRecorder, NextInstruction>("OnBeforeSetData", _windowsSharelog, new object[] { context }); // ReSharper restore ExpressionIsAlwaysNull //Assert Assert.AreEqual(actual, NextInstruction.Do); }
public void InputTextType_IfContextInputRecordRecordTextIsRecordLikeString_ReturnRecord() { //Arrange const string text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit"; var context = new FileLineRecorderContext(_mssqlErrorUnifiedRecorder); var inputTextRecord = new TextRecord { RecordText = text }; context.InputRecord = inputTextRecord; Exception error = null; //Act // ReSharper disable ExpressionIsAlwaysNull var actual = MethodTestHelper.RunInstanceMethod<MssqlErrorUnifiedRecorder, RecordInputType>("InputTextType", _mssqlErrorUnifiedRecorder, new object[] { context, error }); // ReSharper restore ExpressionIsAlwaysNull //Assert Assert.AreEqual(actual, RecordInputType.Record); }
public void OnFieldMatch_IfMatchIsSuccessForTrueInput_ReturnNextInstructionReturn() { //Arrange var match = Regex.Match("THKUS05 2012-12-23 00:00:02 ICMP 95.183.207.253:1280 95.183.207.254:256 95.183.207.253 External Local Host Denied 0xc004000d Default rule Unidentified IP Traffic 0 0 0 0 - - - - 0 0 - - 4 - 0 -", "^(?<SERVERNAME>[^\\t]+)\\t+(?<DATE>[^\\t]+)\\t+(?<TIME>[^\\t]+)\\t+(?<PROTOCOL>[^\\t]+)\\t+(?<SOURCE_IP>[^:]+):(?<SOURCE_PORT>[^\\t]+)\\t+(?<DESTINATION_IP>[^:]+):(?<DESTINATION_PORT>[^\\t]+)\\t+(?<ORIGINAL_CLIENT_IP>[^\\t]+)\\t+(?<SOURCE_NETWORK>[^\\t]+)\\t+(?<DESTINATION_NETWORK>[^\\t]+)\\t+(?<ACTION>[^\\t]+)\\t(?<RESULT_CODE>[^\\t]+)\\t+(?<RULE>[^\\t]+)\\t+(?<APPLICATION_PROTOCOL>[^\\t]+)\\t+(?<BIDIRECTIONAL>[^\\t]+)\\t+(?<BYTES_SENT>[^\\t]+)\\t+(?<BYTES_RECEIVED>[^\\t]+)\\t+(?<CONNECTION_TIME>[^\\t]+)\\t+(?<DESTINATION_NAME>[^\\t]+)\\t+(?<CLIENT_USERNAME>[^\\t]+)\\t+(?<CLIENT_AGENT>[^\\t]+)\\t+(?<SESSION_ID>[^\\t]+)\\t+(?<CONNECTION_ID>[^\\t]+)\\t+(?<INTERFACE>[^\\t]+)\\t+(?<IPHEADER>[^\\t]+)\\t+(?<PAYLOAD>[^\\t]+)\\t+(?<GMT_TIME>[^\\t]+)\\t+(?<IPS_SCANRESULT>[^\\t]+)\\t+(?<IPS_SIGNATURE>[^\\t]+)\\t+(?<NAT_ADDRESS>[^(\\t|\\n)]+)$"); string field = null; var context = new FileLineRecorderContext(_TMGUnifiedRecorder) { SourceHeaderInfo = new Dictionary<string, int>() }; //Act // ReSharper disable ExpressionIsAlwaysNull var actual = MethodTestHelper.RunInstanceMethod<TmgUnifiedRecorder, NextInstruction>("OnFieldMatch", _TMGUnifiedRecorder, new object[] { context, field, match }); // ReSharper restore ExpressionIsAlwaysNull //Assert Assert.AreEqual(actual, NextInstruction.Return); }
public void InputTextType_IfContextInputRecordIsNull_ReturnUnknown() { //Arrange var context = new FileLineRecorderContext(_netscalerUnifiedRecorder) { InputRecord = null }; 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.Unknown); }
public void OnFieldMatch_IfMatchIsSuccessForTrueInput_ReturnNextInstructionReturn() { //Arrange var match = Regex.Match("16-06-14 00:00:20 10.1.22.85 [10238]USER avonftp 331 0", "(?<DATE>[\\w-\\/]*)\\s*(?<TIME>[0-9:]+)\\s*(?<C_IP>[0-9\\.]+)\\s*(?<CS_USERNAME>.[^\\s]+)?\\s*(?<S_IP>[0-9\\.]+)?\\s*(?<S_PORT>[0-9]+)?\\s*(?<CS_METHOD>[\\w]+)\\s*(?<CS_URI_STEM>.[^\\s]+)\\s*(?<SC_STATUS>.[^\\s]+)\\s*(?<SC_WIN32_STATUS>.[^\\s]+)?\\s*(?<SC_SUBSTATUS>.[^\\s]+)?\\s*(?<X_SESSION>.[^\\s]+)?\\s*(?<X_FULLPATH>.[^\\s]+)"); string field = null; var context = new FileLineRecorderContext(_natekAccessControlUnifiedRecorder) { SourceHeaderInfo = new Dictionary<string, int>() }; //Act // ReSharper disable ExpressionIsAlwaysNull var actual = MethodTestHelper.RunInstanceMethod<NatekAccessControlUnifiedRecorder, NextInstruction>("OnFieldMatch", _natekAccessControlUnifiedRecorder, new object[] { context, field, match }); // ReSharper restore ExpressionIsAlwaysNull //Assert Assert.AreEqual(actual, NextInstruction.Return); }
public void OnBeforeSetData_IfContextIsNotNull_Do() { //Arrange RecorderContext context = new FileLineRecorderContext(_netscalerUnifiedRecorder); context.Record = new RecWrapper(); //Act // ReSharper disable ExpressionIsAlwaysNull var actual = MethodTestHelper.RunInstanceMethod<NetscalerUnifiedRecorder, NextInstruction>("OnBeforeSetData", _netscalerUnifiedRecorder, new object[] { context }); // ReSharper restore ExpressionIsAlwaysNull //Asset Assert.AreEqual(actual, NextInstruction.Do); }
public void OnFieldMatch_IfMatchIsSuccessForWrongInput_ReturnNextInstructionReturn() { //Arrange var match = Regex.Match("Lorem ipsum", ".*"); string field = null; var context = new FileLineRecorderContext(_webWasherAuditUnifiedRecorder) { SourceHeaderInfo = new Dictionary<string, int>() }; //Act // ReSharper disable ExpressionIsAlwaysNull var actual = MethodTestHelper.RunInstanceMethod<WebwasherAuditUnifiedRecorder, NextInstruction>("OnFieldMatch", _webWasherAuditUnifiedRecorder, new object[] { context, field, match }); // ReSharper restore ExpressionIsAlwaysNull //Assert Assert.AreEqual(actual, NextInstruction.Return); }
public void GetHeaderText_IfContextIsNotNull_ReturnStringEmpty() { //Arrange var context = new FileLineRecorderContext(_coslatUrlUnifiedRecorder); //Act // ReSharper disable ExpressionIsAlwaysNull var actual = MethodTestHelper.RunInstanceMethod<CoslatUrlUnifiedRecorder, string>("GetHeaderText", _coslatUrlUnifiedRecorder, new object[] { context }); // ReSharper restore ExpressionIsAlwaysNull //Assert Assert.AreEqual(actual, string.Empty); }
public void OnFieldMatch_IfContextIsNotIncludeSourceHeaderInfo_ReturnNextInstructionReturn() { //Arrange var match = Regex.Match("Lorem ipsum", ".*"); string field = null; var context = new FileLineRecorderContext(_nginxErrorUnifiedRecorder); //Act // ReSharper disable ExpressionIsAlwaysNull var actual = MethodTestHelper.RunInstanceMethod<NginxErrorUnifiedRecorder, NextInstruction>("OnFieldMatch", _nginxErrorUnifiedRecorder, new object[] { context, field, match }); // ReSharper restore ExpressionIsAlwaysNull //Assert Assert.AreEqual(actual, NextInstruction.Return); }
public void OnFieldMatch_IfMatchIsNotSuccess_ReturnSkip() { //Arrange var match = Regex.Match("Lorem ipsum", "\\[+"); string field = null; var context = new FileLineRecorderContext(_coslatUrlUnifiedRecorder); //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.Skip); }
public void InputTextType_IfContextInputRecordRecordTextIsNotNull_ReturnReocrd() { //Arrange var context = new FileLineRecorderContext(_trendMicroUrlUnifiedRecorder); var inputTextRecord = new TextRecord { RecordText = String.Empty }; context.InputRecord = inputTextRecord; Exception error = null; //Act // ReSharper disable ExpressionIsAlwaysNull var actual = MethodTestHelper.RunInstanceMethod<TrendMicroUrlUnifiedRecorder, RecordInputType>("InputTextType", _trendMicroUrlUnifiedRecorder, new object[] { context, error }); // ReSharper restore ExpressionIsAlwaysNull //Assert Assert.AreEqual(actual, RecordInputType.Record); }
public void OnFieldMatch_IfMatchIsSuccessForWrongInput_ReturnNextInstructionReturn() { //Arrange var match = Regex.Match("Lorem ipsum", ".*"); 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 //Unhandled System.Collections.Generic.KeyNotFoundException Assert.AreEqual(actual, NextInstruction.Return); }
public void CreateFileSystemInfo_IfContextAndFullNameIsNotNull_ReturnRecorderFileSystemInfo() { //Arrange RecorderContext context = new FileLineRecorderContext(); const string fullName = "lorem ipsum"; //Act // ReSharper disable ExpressionIsAlwaysNull var actual = MethodTestHelper.RunInstanceMethod<FileRecorder, RecorderFileSystemInfo>("CreateFileSystemInfo", _fileRecorder, new object[] { context, fullName }); // ReSharper restore ExpressionIsAlwaysNull //Assert Assert.AreEqual(actual, null); }