Open itadapter opened 4 years ago
using System;
using System.Collections.Generic;
using System.Collections;
public class Program
{
public struct car{}
public static void Main()
{
var lst = new List<car>();
object o = lst;
var en = o is IEnumerable<object>;
var en2 = o is IEnumerable;
Console.WriteLine("of IEnumerable<object>: "+ (en));
Console.WriteLine("of IEnumerable: " + en2);
}
}
Produces for struct value types, however for classes it produces true true
of IEnumerable<object>: False
of IEnumerable: True
yeah, it is a very dangerous bug as it only affects structs as they are invariant waiting for @zhabis to fix later tonight
IEnumerable has a Cast<T>
extension so proper casting of IEnumerable with ANY T (ref or struct) is this:
(obj as IEnumerable)?.Cast<Object>() -> IEnumerable<object>
also for the test above:
Console.WriteLine((o as IEnumerable).Cast<object>().GetType().ToString());
yields
System.Linq.Enumerable+<CastIterator>d__97`1[System.Object]
Keep open until all testing is done
This was released in new pkg today. @JohnPKosh how are the unit tests? can this be closed? @jkosherx
@JohnPKosh @jkosherx Can this issue be closed now? Do we have unit tests for GetLogicResult()
? Do unit tests pass?
After reviewing test implementation this requires additional integration tests for ApiProtocolController.