/// <summary> /// Compares two IWritableLaunchProfile to see if they contain the same values. /// </summary> public static bool ProfilesAreEqual(IWritableLaunchProfile debugProfile1, IWritableLaunchProfile debugProfile2) { // Same instance are equal if (debugProfile1 == debugProfile2) { return(true); } if (!string.Equals(debugProfile1.Name, debugProfile2.Name, StringComparison.Ordinal) || !string.Equals(debugProfile1.CommandName, debugProfile2.CommandName, StringComparison.Ordinal) || !string.Equals(debugProfile1.ExecutablePath, debugProfile2.ExecutablePath, StringComparison.Ordinal) || !string.Equals(debugProfile1.CommandLineArgs, debugProfile2.CommandLineArgs, StringComparison.Ordinal) || !string.Equals(debugProfile1.WorkingDirectory, debugProfile2.WorkingDirectory, StringComparison.Ordinal) || !string.Equals(debugProfile1.LaunchUrl, debugProfile2.LaunchUrl, StringComparison.Ordinal) || debugProfile1.LaunchBrowser != debugProfile2.LaunchBrowser || !DictionaryEqualityComparer <string, object> .Instance.Equals(debugProfile1.OtherSettings.ToImmutableDictionary(), debugProfile2.OtherSettings.ToImmutableDictionary()) || !DictionaryEqualityComparer <string, string> .Instance.Equals(debugProfile1.EnvironmentVariables.ToImmutableDictionary(), debugProfile2.EnvironmentVariables.ToImmutableDictionary()) ) { return(false); } // Compare in-memory states return(debugProfile1.IsInMemoryObject() == debugProfile2.IsInMemoryObject()); }
public void IsInMemoryProfile_IWritableLaunchProfile(bool isInMemory) { WritableLaunchProfile data = new WritableLaunchProfile() { DoNotPersist = isInMemory }; IWritableLaunchProfile lp = (IWritableLaunchProfile)data; Assert.Equal(isInMemory, lp.IsInMemoryObject()); }
public LaunchProfile(IWritableLaunchProfile writableProfile) { Name = writableProfile.Name; ExecutablePath = writableProfile.ExecutablePath; CommandName = writableProfile.CommandName; CommandLineArgs = writableProfile.CommandLineArgs; WorkingDirectory = writableProfile.WorkingDirectory; LaunchBrowser = writableProfile.LaunchBrowser; LaunchUrl = writableProfile.LaunchUrl; DoNotPersist = writableProfile.IsInMemoryObject(); // If there are no env variables or settings we want to set them to null EnvironmentVariables = writableProfile.EnvironmentVariables.Count == 0 ? null : writableProfile.EnvironmentVariables.ToImmutableDictionary(); OtherSettings = writableProfile.OtherSettings.Count == 0 ? null : writableProfile.OtherSettings.ToImmutableDictionary(); }