本文整理汇总了C#中Configuration.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.Equals方法的具体用法?C# Configuration.Equals怎么用?C# Configuration.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldBeEqualToAnotherConfigurationIfItHasTheSameFullNameAndValue
public void ShouldBeEqualToAnotherConfigurationIfItHasTheSameFullNameAndValue()
{
var connections = new Configuration("connections");
var database1 = new Configuration("database", "localhost", c => c.BelongingTo(connections));
var database2 = new Configuration("database", "localhost", c => c.BelongingTo(connections));
Assert.IsTrue(database2.Equals(database1));
Assert.IsTrue(database1.Equals(database2));
}
示例2: ShouldNotBeEqualToAnotherConfigurationIfDoesNotHaveTheSameFullNameAndValue
public void ShouldNotBeEqualToAnotherConfigurationIfDoesNotHaveTheSameFullNameAndValue()
{
var connections = new Configuration("connections");
var infrastructure = new Configuration("infrastructure");
var database1 = new Configuration("database", "localhost", c => c.BelongingTo(connections));
var database2 = new Configuration("database", "localhost", c => c.BelongingTo(infrastructure));
var database3 = new Configuration("database", "remotehost", c => c.BelongingTo(connections));
var database4 = new Configuration("databases", "localhost", c => c.BelongingTo(infrastructure));
Assert.IsFalse(database2.Equals(database1));
Assert.IsFalse(database1.Equals(database2));
Assert.IsFalse(database2.Equals(database3));
Assert.IsFalse(database1.Equals(database3));
Assert.IsFalse(database2.Equals(database4));
Assert.IsFalse(database1.Equals(database4));
Assert.IsFalse(database3.Equals(database1));
Assert.IsFalse(database3.Equals(database2));
Assert.IsFalse(database4.Equals(database1));
Assert.IsFalse(database4.Equals(database2));
}
示例3: getSimilarConfig
private static Tuple<Configuration, Configuration> getSimilarConfig(Configuration config)
{
Configuration similarConfig = null;
List<Configuration> similarOnes = new List<Configuration>();
int nbCount = config.BinaryOptions.Count;
if (config.BinaryOptions.Keys.Contains(varModel.Root))
nbCount--;
bool found = false;
foreach (var configInGS in GlobalState.allMeasurements.getSimilarConfigs(config))
{
if (config.Equals(configInGS))
{
similarConfig = configInGS;
found = true;
break;
}
else if (takeSimilarConfig)
{
var conf = findSimilarConfigBinary(config, configInGS, nbCount);
if (conf != null)
similarOnes.Add(conf);
}
}
if (!found)
{
if (takeSimilarConfig && similarOnes.Count > 0)
similarConfig = findSimilarConfigNumeric(config, similarOnes);
else
{
if (similarOnes.Count == 0)
logError.logLine("Required config: " + config.ToString() + " " + config.printConfigurationForMeasurement());
// logError.log("Did not find a measured value for the configuration: " + config.ToString());
}
}
return Tuple.Create<Configuration, Configuration>(config, similarConfig);
}