/// <summary> /// Given a log and a resource string, acquires the text of that resource string and /// compares it to the log. Asserts if the log does not contain the desired string. /// </summary> /// <param name="e">The MockEngine that contains the log we're checking</param> /// <param name="log">The TaskLoggingHelper that we use to load the string resource</param> /// <param name="errorResource">The name of the resource string to check the log for</param> /// <param name="args">Arguments needed to format the resource string properly</param> internal static void VerifyLogContainsErrorFromResource(MockEngine e, TaskLoggingHelper log, string errorResource, params object[] args) { string errorMessage = log.FormatResourceString(errorResource, args); e.AssertLogContains(errorMessage); }
/// <summary> /// Given a log and a resource string, acquires the text of that resource string and /// compares it to the log. Assert fails if the log contain the desired string. /// </summary> /// <param name="e">The MockEngine that contains the log we're checking</param> /// <param name="log">The TaskLoggingHelper that we use to load the string resource</param> /// <param name="errorResource">The name of the resource string to check the log for</param> /// <param name="args">Arguments needed to format the resource string properly</param> private void VerifyLogDoesNotContainResource(MockEngine e, TaskLoggingHelper log, string messageResource, params object[] args) { string message = log.FormatResourceString(messageResource, args); e.AssertLogDoesntContain(message); }
public void TestFormatResourceString2() { tlh = new TaskLoggingHelper(task); tlh.FormatResourceString("MessageResource1"); }
internal static StateFileBase DeserializeCache(string stateFile, TaskLoggingHelper log, Type requiredReturnType) { StateFileBase o = null; try { if (((stateFile == null) || (stateFile.Length <= 0)) || !File.Exists(stateFile)) { return(o); } using (FileStream stream = new FileStream(stateFile, FileMode.Open)) { object obj2 = new BinaryFormatter().Deserialize(stream); o = obj2 as StateFileBase; if ((o == null) && (obj2 != null)) { log.LogMessageFromResources("General.CouldNotReadStateFileMessage", new object[] { stateFile, log.FormatResourceString("General.IncompatibleStateFileType", new object[0]) }); } if ((o != null) && !requiredReturnType.IsInstanceOfType(o)) { log.LogWarningWithCodeFromResources("General.CouldNotReadStateFile", new object[] { stateFile, log.FormatResourceString("General.IncompatibleStateFileType", new object[0]) }); o = null; } } } catch (Exception exception) { log.LogWarningWithCodeFromResources("General.CouldNotReadStateFile", new object[] { stateFile, exception.Message }); } return(o); }
public void TestFormatResourceString1() { tlh = new TaskLoggingHelper(task); tlh.FormatResourceString(null); }