public void Matching_AsmVerLeading0() { bool expectedResult = true; string assemblyVersion = "0.1.1.0"; string pluginVersion = "1.1.0"; string[] logMessages = new string[] { }; CompareVersions task = new CompareVersions() { AssemblyVersion = assemblyVersion, PluginVersion = pluginVersion }; bool taskResult = task.Execute(); MockTaskLogger mockTaskLogger = task.Logger as MockTaskLogger; foreach (MockLogEntry entry in mockTaskLogger.LogEntries) { Console.WriteLine(entry); } Assert.AreEqual(logMessages.Length, mockTaskLogger.LogEntries.Count); for (int i = 0; i < logMessages.Length; i++) { Assert.AreEqual(logMessages[i], mockTaskLogger.LogEntries[i].ToString()); } Assert.AreEqual(expectedResult, taskResult); }
public void NotMatching() { bool expectedResult = true; string assemblyVersion = "1.1.0"; string pluginVersion = "1.2.0"; CompareVersions task = new CompareVersions() { AssemblyVersion = assemblyVersion, PluginVersion = pluginVersion }; string[] logMessages = new string[] { $"{task.GetType().Name}: PluginVersion {pluginVersion} does not match AssemblyVersion {assemblyVersion}." }; bool taskResult = task.Execute(); MockTaskLogger mockTaskLogger = task.Logger as MockTaskLogger; foreach (MockLogEntry entry in mockTaskLogger.LogEntries) { Console.WriteLine(entry); } Assert.AreEqual(logMessages.Length, mockTaskLogger.LogEntries.Count); for (int i = 0; i < logMessages.Length; i++) { Assert.AreEqual(logMessages[i], mockTaskLogger.LogEntries[i].ToString()); } Assert.AreEqual(expectedResult, taskResult); }