public void GetAuthorizationContextForService_ShouldReturnContext() { //------------Setup for test-------------------------- var getLogDataService = new GetServiceExecutionResult(); //------------Execute Test--------------------------- var resId = getLogDataService.GetAuthorizationContextForService(); //------------Assert Results------------------------- Assert.AreEqual(AuthorizationContext.Administrator, resId); }
public void GetLogDataService_HandlesType_ExpectName() { //------------Setup for test-------------------------- var getLogDataService = new GetServiceExecutionResult(); //------------Execute Test--------------------------- //------------Assert Results------------------------- Assert.AreEqual("GetServiceExecutionResult", getLogDataService.HandlesType()); }
public void GetResourceID_ShouldReturnEmptyGuid() { //------------Setup for test-------------------------- var getLogDataService = new GetServiceExecutionResult(); //------------Execute Test--------------------------- var resId = getLogDataService.GetResourceID(new Dictionary <string, StringBuilder>()); //------------Assert Results------------------------- Assert.AreEqual(Guid.Empty, resId); }
public void GetLogDataService_Execute_WithExecutionId_ShouldFilterLogData() { //------------Setup for test-------------------------- const string LogFilePath = @"TextFiles\LogFileWithFlatResultsNEwFormat.txt"; var getLogDataService = new GetServiceExecutionResult { ServerLogFilePath = LogFilePath }; //---------------Assert Precondition---------------- Assert.IsNotNull(getLogDataService); //------------Execute Test--------------------------- var stringBuilders = new Dictionary <string, StringBuilder> { { "ExecutionId", new StringBuilder("06385e0f-ac27-4cf0-af55-7642c3c08ba3") } }; var logEntriesJson = getLogDataService.Execute(stringBuilders, null); var serializer = new Dev2JsonSerializer(); var logEntry = serializer.Deserialize <LogEntry>(logEntriesJson.ToString()); Assert.AreEqual("{ \"Message\": \"Hello World.\"}", logEntry.Result); }