public void ShouldNotAccepttInvalidFirstParameter() { string[] args = { "/lis", "tags", "new" }; ListArgument listArg = new ListArgument(args); listArg.IsValid().ShouldBeFalse(); }
public void ShouldAccepttListTagsByCountParameter() { string[] args = { "/list", "tags", "byCount" }; ListArgument listArg = new ListArgument(args); listArg.IsValid().ShouldBeTrue(); }
public void ShouldAccepTodayListParameter() { string[] args = { "/list", "TODAY" }; ListArgument listArg = new ListArgument(args); listArg.IsValid().ShouldBeTrue(); }
public void ShouldAcceptDefaultListParameter() { string[] args = { "/list" }; ListArgument listArg = new ListArgument(args); listArg.IsValid().ShouldBeTrue(); }
public void ShouldAccepttFutureListParameter() { string[] args = { "/list", "FUTUre" }; ListArgument listArg = new ListArgument(args); listArg.IsValid().ShouldBeTrue(); }
public static List <NativeArgument> ParseNativeArguments(params object[] args) { var list = new List <NativeArgument>(); foreach (var o in args) { if (o is int) { list.Add(new IntArgument() { Data = ((int)o) }); } else if (o is uint) { list.Add(new UIntArgument() { Data = ((uint)o) }); } else if (o is string) { list.Add(new StringArgument() { Data = ((string)o) }); } else if (o is float) { list.Add(new FloatArgument() { Data = ((float)o) }); } else if (o is double) { list.Add(new FloatArgument() { Data = ((float)(double)o) }); } else if (o is bool) { list.Add(new BooleanArgument() { Data = ((bool)o) }); } else if (o is GTANetworkShared.Vector3) { var tmp = (GTANetworkShared.Vector3)o; list.Add(new Vector3Argument() { X = tmp.X, Y = tmp.Y, Z = tmp.Z, }); } else if (o is Vector3) { var tmp = (Vector3)o; list.Add(new Vector3Argument() { X = tmp.X, Y = tmp.Y, Z = tmp.Z, }); } else if (o is LocalPlayerArgument) { list.Add((LocalPlayerArgument)o); } else if (o is OpponentPedHandleArgument) { list.Add((OpponentPedHandleArgument)o); } else if (o is LocalGamePlayerArgument) { list.Add((LocalGamePlayerArgument)o); } else if (o is EntityArgument) { list.Add((EntityArgument)o); } else if (o is EntityPointerArgument) { list.Add((EntityPointerArgument)o); } else if (o is NetHandle) { list.Add(new EntityArgument(((NetHandle)o).Value)); } else if (o is LocalHandle) { list.Add(new EntityArgument(NetEntityHandler.EntityToNet(((LocalHandle)o).Value))); } else if (o is IList) { var larg = new ListArgument(); var l = ((IList)o); object[] array = new object[l.Count]; l.CopyTo(array, 0); larg.Data = new List <NativeArgument>(ParseNativeArguments(array)); list.Add(larg); } else { list.Add(null); } } return(list); }