public static void IgnoredMissingOutlet_ReturnsNoErrors()
        {
            ValidatorIgnoredNamespaceProvider.SetCurrentProvider(IgnoredOutletComponentNamespaceProvider);
            ValidatorWhitelistedNamespaceProvider.SetCurrentProvider(() => new ValidatorWhitelistedNamespace[0]);

            GameObject gameObject = new GameObject();

            var outletComponent = gameObject.AddComponent <IgnoredOutletComponent>();

            outletComponent.Outlet = null;

            IList <IValidationError> errors = Validator.Validate(gameObject);

            Assert.That(errors, Is.Null);

            ValidatorIgnoredNamespaceProvider.ClearCurrentProvider();
            ValidatorWhitelistedNamespaceProvider.ClearCurrentProvider();
        }
Example #2
0
        public static void WhitelistedMissingOutlet_AndIgnored_DefaultsToWhitelisted()
        {
            ValidatorWhitelistedNamespaceProvider.SetCurrentProvider(WhitelistedOutletComponentNamespaceProvider);
            ValidatorIgnoredNamespaceProvider.SetCurrentProvider(IgnoredOutletComponentNamespaceProvider);
            Debug.logger.logEnabled = false;

            GameObject gameObject = new GameObject();

            var outletComponent = gameObject.AddComponent <WhitelistedOutletComponent>();

            outletComponent.Outlet = null;

            IList <IValidationError> errors = Validator.Validate(gameObject);

            Assert.That(errors, Is.Not.Null);

            Debug.logger.logEnabled = true;
            ValidatorWhitelistedNamespaceProvider.ClearCurrentProvider();
            ValidatorIgnoredNamespaceProvider.ClearCurrentProvider();
        }