public void InputOfWrongTypeThrows() { var arrayNode = IDCNCFactory.NewArrayCollection <int>().NewNode(); IDirectedConnectedNode <int> deTypedArrayNode = arrayNode; Assert.Throws <InvalidCastException>(() => TypedHelpers.GetNodeAsValidType <PointerDCN <int>, int>(deTypedArrayNode)); var pointerNode = IDCNCFactory.NewPointerCollection <int>().NewNode(); IDirectedConnectedNode <int> deTypedPointerNode = pointerNode; Assert.Throws <InvalidCastException>(() => TypedHelpers.GetNodeAsValidType <ArrayDCN <int>, int>(deTypedPointerNode)); }
public void InputOfWrongTypeThrows() { var arrayCollection = IDCNCFactory.NewArrayCollection <int>(); IDirectedConnectedNodeCollection <int> deTypedArrayCollection = arrayCollection; Assert.Throws <InvalidCastException>( () => TypedHelpers.GetCollectionAsValidType <PointerDCNC <int>, int>(deTypedArrayCollection)); var pointerCollection = IDCNCFactory.NewPointerCollection <string>(); IDirectedConnectedNodeCollection <string> deTypedPointerCollection = pointerCollection; Assert.Throws <InvalidCastException>( () => TypedHelpers.GetCollectionAsValidType <ArrayDCNC <string>, string>(deTypedPointerCollection)); }
public void OutputIsOfExpectedType() { var arrayNode = IDCNCFactory.NewArrayCollection <int>().NewNode(); IDirectedConnectedNode <int> deTypedArrayNode = arrayNode; var hopefullyArrayOutput = TypedHelpers.GetNodeAsValidType <ArrayDCN <int>, int>(deTypedArrayNode); Assert.IsTrue(hopefullyArrayOutput is ArrayDCN <int>); var pointerNode = IDCNCFactory.NewPointerCollection <DateTime>().NewNode(); IDirectedConnectedNode <DateTime> deTypedPointerNode = pointerNode; var hopefullyPointerOutput = TypedHelpers.GetNodeAsValidType <PointerDCN <DateTime>, DateTime>(deTypedPointerNode); Assert.IsTrue(hopefullyPointerOutput is PointerDCN <DateTime>); }
public void OutputIsOfExpectedType() { var arrayCollection = IDCNCFactory.NewArrayCollection <int>(); IDirectedConnectedNodeCollection <int> deTypedArrayCollection = arrayCollection; var hopefullyArrayOutput = TypedHelpers.GetCollectionAsValidType <ArrayDCNC <int>, int>(deTypedArrayCollection); Assert.IsTrue(hopefullyArrayOutput is ArrayDCNC <int>); var pointerCollection = IDCNCFactory.NewPointerCollection <string>(); IDirectedConnectedNodeCollection <string> deTypedPointerCollection = pointerCollection; var hopefullyPointerOutput = TypedHelpers.GetCollectionAsValidType <PointerDCNC <string>, string>(deTypedPointerCollection); Assert.IsTrue(hopefullyPointerOutput is PointerDCNC <string>); }