本文整理汇总了C#中System.Net.Http.Formatting.MediaTypeFormatter.SequenceEqual方法的典型用法代码示例。如果您正苦于以下问题:C# MediaTypeFormatter.SequenceEqual方法的具体用法?C# MediaTypeFormatter.SequenceEqual怎么用?C# MediaTypeFormatter.SequenceEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Http.Formatting.MediaTypeFormatter
的用法示例。
在下文中一共展示了MediaTypeFormatter.SequenceEqual方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsODataFormatter_ReturnsTrue_For_Derived_ODataFormatters
public void IsODataFormatter_ReturnsTrue_For_Derived_ODataFormatters()
{
// Arrange
HttpConfiguration configuration = new HttpConfiguration();
ODataMediaTypeFormatter formatter1 = CreateODataFormatter();
DerivedODataMediaTypeFormatter formatter2 = new DerivedODataMediaTypeFormatter(new ODataPayloadKind[0]);
configuration.Formatters.Add(formatter1);
configuration.Formatters.Add(formatter2);
// Act
IEnumerable<MediaTypeFormatter> result = configuration.Formatters.Where(f => f != null && Decorator.GetInner(f) is ODataMediaTypeFormatter);
// Assert
IEnumerable<MediaTypeFormatter> expectedFormatters = new MediaTypeFormatter[]
{
formatter1, formatter2
};
Assert.True(expectedFormatters.SequenceEqual(result));
}
示例2: IsODataFormatter_ReturnsTrue_ForODataFormatters
public void IsODataFormatter_ReturnsTrue_ForODataFormatters()
{
// Arrange
HttpConfiguration configuration = new HttpConfiguration();
ODataMediaTypeFormatter formatter1 = CreateODataFormatter();
ODataMediaTypeFormatter formatter2 = CreateODataFormatter();
configuration.Formatters.Add(formatter1);
configuration.Formatters.Add(formatter2);
// Act
IEnumerable<MediaTypeFormatter> result = configuration.Formatters.Where(f => f != null && f.IsODataFormatter());
// Assert
IEnumerable<MediaTypeFormatter> expectedFormatters = new MediaTypeFormatter[]
{
formatter1, formatter2
};
Assert.True(expectedFormatters.SequenceEqual(result));
}
示例3: Constructor1_AcceptsDuplicateFormatterTypes
public void Constructor1_AcceptsDuplicateFormatterTypes()
{
MediaTypeFormatter[] formatters = new MediaTypeFormatter[]
{
new XmlMediaTypeFormatter(),
new JsonMediaTypeFormatter(),
new FormUrlEncodedMediaTypeFormatter(),
new XmlMediaTypeFormatter(),
new JsonMediaTypeFormatter(),
new FormUrlEncodedMediaTypeFormatter(),
};
MediaTypeFormatterCollection collection = new MediaTypeFormatterCollection(formatters);
Assert.True(formatters.SequenceEqual(collection));
}
示例4: Constructor1_AcceptsDuplicateFormatterTypes
public void Constructor1_AcceptsDuplicateFormatterTypes()
{
MediaTypeFormatter[] formatters = new MediaTypeFormatter[]
{
new XmlMediaTypeFormatter(),
new JsonMediaTypeFormatter(),
#if !NETFX_CORE // No FormUrlEncodedMediaTypeFormatter in portable library version
new FormUrlEncodedMediaTypeFormatter(),
#endif
new XmlMediaTypeFormatter(),
new JsonMediaTypeFormatter(),
#if !NETFX_CORE // No FormUrlEncodedMediaTypeFormatter in portable library version
new FormUrlEncodedMediaTypeFormatter(),
#endif
};
MediaTypeFormatterCollection collection = new MediaTypeFormatterCollection(formatters);
Assert.True(formatters.SequenceEqual(collection));
}
示例5: GetODataFormatters_ReturnsFormatter_IfSet
public void GetODataFormatters_ReturnsFormatter_IfSet()
{
// Arrange
HttpConfiguration configuration = new HttpConfiguration();
ODataMediaTypeFormatter formatter1 = CreateODataFormatter();
ODataMediaTypeFormatter formatter2 = CreateODataFormatter();
configuration.Formatters.Add(formatter1);
configuration.Formatters.Add(formatter2);
// Act
IEnumerable<MediaTypeFormatter> result = configuration.GetODataFormatters();
// Assert
IEnumerable<MediaTypeFormatter> expectedFormatters = new MediaTypeFormatter[]
{
formatter1, formatter2
};
Assert.True(expectedFormatters.SequenceEqual(result));
}