Exemple #1
0
        public IEnumerator SavingCustomVariableStruct(int expectedValue, int newValue)
        {
            //Arrange
            var temp = Resources.Load <TestStructCustomVariable>(StructSO);

            yield return(null);

            //Act
            var t = temp.Value;

            t.clang    = newValue;
            t.cpp      = newValue;
            t.csharp   = newValue;
            temp.Value = t;

            UnityRuntimeHelper.onApplicationFocusLost();
            yield return(null);

            temp.Reset();

            Resources.UnloadAsset(temp);
            temp = Resources.Load <TestStructCustomVariable>(StructSO);
            yield return(null);


            //Assert
            Assert.IsTrue(temp.AutoSave);
            Assert.AreEqual(expectedValue, temp.Value.clang);
            Assert.AreEqual(expectedValue, temp.Value.cpp);
            Assert.AreEqual(expectedValue, temp.Value.csharp);
            Assert.IsNotNull(temp);
        }