本文整理汇总了C#中SqlConnection.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# SqlConnection.Contains方法的具体用法?C# SqlConnection.Contains怎么用?C# SqlConnection.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlConnection
的用法示例。
在下文中一共展示了SqlConnection.Contains方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RetrieveStatistics_ExpectedKeysInDictionary_Success
public void RetrieveStatistics_ExpectedKeysInDictionary_Success()
{
IDictionary d = new SqlConnection().RetrieveStatistics();
Assert.NotEmpty(d);
Assert.Equal(s_retrieveStatisticsKeys.Length, d.Count);
Assert.NotEmpty(d.Keys);
Assert.Equal(s_retrieveStatisticsKeys.Length, d.Keys.Count);
Assert.NotEmpty(d.Values);
Assert.Equal(s_retrieveStatisticsKeys.Length, d.Values.Count);
foreach (string key in s_retrieveStatisticsKeys)
{
Assert.True(d.Contains(key));
object value = d[key];
Assert.NotNull(value);
Assert.IsType<long>(value);
Assert.Equal(0L, value);
}
}
示例2: RetrieveStatistics_UnexpectedKeysNotInDictionary_Success
public void RetrieveStatistics_UnexpectedKeysNotInDictionary_Success()
{
IDictionary d = new SqlConnection().RetrieveStatistics();
Assert.False(d.Contains("Foo"));
Assert.Null(d["Foo"]);
}
示例3: RetrieveStatistics_Contains_NullKey_Throws
public void RetrieveStatistics_Contains_NullKey_Throws()
{
IDictionary d = new SqlConnection().RetrieveStatistics();
Assert.Throws<ArgumentNullException>("key", () => d.Contains(null));
}
示例4: RetrieveStatistics_Remove_NonExistentKey_Success
public void RetrieveStatistics_Remove_NonExistentKey_Success()
{
IDictionary d = new SqlConnection().RetrieveStatistics();
const string key = "Foo";
Assert.Equal(s_retrieveStatisticsKeys.Length, d.Count);
Assert.Equal(s_retrieveStatisticsKeys.Length, d.Keys.Count);
Assert.Equal(s_retrieveStatisticsKeys.Length, d.Values.Count);
Assert.False(d.Contains(key));
Assert.Null(d[key]);
d.Remove(key);
Assert.Equal(s_retrieveStatisticsKeys.Length, d.Count);
Assert.Equal(s_retrieveStatisticsKeys.Length, d.Keys.Count);
Assert.Equal(s_retrieveStatisticsKeys.Length, d.Values.Count);
Assert.False(d.Contains(key));
Assert.Null(d[key]);
}
示例5: RetrieveStatistics_Remove_ExistingKey_Success
public void RetrieveStatistics_Remove_ExistingKey_Success()
{
IDictionary d = new SqlConnection().RetrieveStatistics();
string key = s_retrieveStatisticsKeys[0];
Assert.Equal(s_retrieveStatisticsKeys.Length, d.Count);
Assert.Equal(s_retrieveStatisticsKeys.Length, d.Keys.Count);
Assert.Equal(s_retrieveStatisticsKeys.Length, d.Values.Count);
Assert.True(d.Contains(key));
Assert.NotNull(d[key]);
d.Remove(key);
Assert.Equal(s_retrieveStatisticsKeys.Length - 1, d.Count);
Assert.Equal(s_retrieveStatisticsKeys.Length - 1, d.Keys.Count);
Assert.Equal(s_retrieveStatisticsKeys.Length - 1, d.Values.Count);
Assert.False(d.Contains(key));
Assert.Null(d[key]);
}
示例6: RetrieveStatistics_Setter_Success
public void RetrieveStatistics_Setter_Success(object key, object value)
{
IDictionary d = new SqlConnection().RetrieveStatistics();
d[key] = value;
Assert.True(d.Contains(key));
object v = d[key];
Assert.Same(value, v);
}