Ejemplo n.º 1
0
        public void CanConvertImageCropperDataSetJObject()
        {
            // cropperJson3 - has not crops
            ImageCropperValue cropperValue = CropperJson3.DeserializeImageCropperValue();
            Attempt <JObject> serialized   = cropperValue.TryConvertTo <JObject>();

            Assert.IsTrue(serialized.Success);
            Assert.AreEqual(cropperValue, serialized.Result.ToObject <ImageCropperValue>());
        }
Ejemplo n.º 2
0
        public void CanConvertImageCropperDataSetSrcToString()
        {
            // cropperJson3 - has not crops
            ImageCropperValue cropperValue = CropperJson3.DeserializeImageCropperValue();
            Attempt <string>  serialized   = cropperValue.TryConvertTo <string>();

            Assert.IsTrue(serialized.Success);
            Assert.AreEqual("/media/1005/img_0672.jpg", serialized.Result);
        }
Ejemplo n.º 3
0
        public void CanConvertImageCropperDataSetJsonToString()
        {
            ImageCropperValue cropperValue = CropperJson1.DeserializeImageCropperValue();
            Attempt <string>  serialized   = cropperValue.TryConvertTo <string>();

            Assert.IsTrue(serialized.Success);
            Assert.IsTrue(serialized.Result.DetectIsJson());
            ImageCropperValue obj = JsonConvert.DeserializeObject <ImageCropperValue>(CropperJson1, new JsonSerializerSettings {
                Culture = CultureInfo.InvariantCulture, FloatParseHandling = FloatParseHandling.Decimal
            });

            Assert.AreEqual(cropperValue, obj);
        }