public ExplicitCastVariation(ExplicitCastTestType testType, NodeCreateType nodeCreateType, Type nodeType, object data, Type retType, TestCase testCase, string desc) { _desc = desc; _data = data; _nodeType = nodeType; _testType = testType; _retType = retType; _nodeCreateType = nodeCreateType; }
protected override void DetermineChildren() { base.DetermineChildren(); Type type = Params[0] as Type; ExplicitCastTestType testType = (ExplicitCastTestType)Params[1]; NodeCreateType createType = (NodeCreateType)Params[2]; // add normal types foreach (object o in _data) { string desc = o.GetType().ToString() + " : "; // On Arabic locale DateTime and DateTimeOffset types threw on serialization if the date was // too big for the Arabic calendar if (o is DateTime) { desc += ((DateTime)o).ToString(CultureInfo.InvariantCulture); } else if (o is DateTimeOffset) { desc += ((DateTimeOffset)o).ToString(CultureInfo.InvariantCulture); } else { desc += o; } AddChild(new ExplicitCastVariation(testType, createType, type, o, o.GetType(), this, desc)); } // add Nullable types check (not applicable for XmlConvert tests) if (testType == ExplicitCastTestType.RoundTrip) { foreach (object o in _data) { string desc = o.GetType().ToString() + " : "; // On Arabic locale DateTime and DateTimeOffset types threw on serialization if the date was // too big for the Arabic calendar if (o is DateTime) { desc += ((DateTime)o).ToString(CultureInfo.InvariantCulture); } else if (o is DateTimeOffset) { desc += ((DateTimeOffset)o).ToString(CultureInfo.InvariantCulture); } else { desc += o; } AddChild(new ExplicitCastVariation(testType, createType, type, o, typeMapper[o.GetType()], this, desc)); } } }