Ejemplo n.º 1
0
        public void TestAbs(int input, int expect)
        {
            if (expect < 0)
            {
                throw new ArgumentException("expect is positive");
            }

            Assert.Equal(expect, SomeUtil.SomeAbs(input));
        }
    public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
    {
        JToken  jToken       = JToken.FromObject(value);
        JObject jObject      = (JObject)jToken;
        A       aInfo        = (A)value;
        string  statusString = aInfo.Status == null ? string.Empty : SomeUtil.GetStateString((State)aInfo.Status.State, aInfo.Status.Downloading);

        jObject.AddFirst(new JProperty("MachineState", statusString));
        if (aInfo.UploadTime == DateTime.MinValue)
        {
            jObject.Remove("UploadTime");
            jObject.Add(new JProperty("UploadTime", null));
        }
        jObject.WriteTo(writer);
    }