Exemplo n.º 1
0
        public void CreateValidationReport_SetReference_HasNoErrors()
        {
            OptionalAttributeSample sample = CreateTestObject();

            sample.requiredReference = new GameObject("MyRequiredReference");

            ValidationReport report = RunValidation();

            Assert.IsFalse(report.HasErrors, "Error report contains errors.");

            Object.DestroyImmediate(sample.requiredReference);
            Object.DestroyImmediate(sample.gameObject);
        }
Exemplo n.º 2
0
        public void CreateValidationReport_UnsetReference_HasErrorWithMessage()
        {
            OptionalAttributeSample sample = CreateTestObject();

            ValidationReport report = RunValidation();

            Assert.IsTrue(report.HasErrors, "Error report contains errors.");

            report.HandleErrors(error =>
            {
                Assert.IsTrue(error.message.Contains("Missing required reference"));
                Assert.IsTrue(error.message.Contains("TestGameObject"));
            });

            Object.DestroyImmediate(sample.gameObject);
        }