Пример #1
0
        public void UnityTypesTest()
        {
            UnityTypes data = UnityTypes.GenerateRandomValues();

            var result = JSON.ToJson(data, true);
            var test   = JSON.FromJson <UnityTypes>(result);

            test.Should().BeEquivalentTo(data);
        }
Пример #2
0
        public static UnityTypes GenerateRandomValues()
        {
            UnityTypes value  = new UnityTypes();
            var        random = new Random(0);

            value.Vector2Field = new Vector2((float)random.NextDouble(), (float)random.NextDouble());
            value.Vector3Field = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());

            value.ListVector2Field = new List <Vector2>();
            for (int i = 0; i < 3; i++)
            {
                value.ListVector2Field.Add(new Vector2((float)random.NextDouble(), (float)random.NextDouble()));
            }

            return(value);
        }