// Start is called before the first frame update void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
private EnvironmentSettingsCollection GetIsolatedEnvironmentSettingsCollection() { _source = new TestSource(); _setting = Isolate.Fake.Instance <ISetting>(); Isolate.WhenCalled(() => _source.Add(_setting)).CallOriginal(); _keyMan = Isolate.Fake.Instance <SecretKeyManager>(); Isolate.WhenCalled(() => _keyMan.GetKey()).WillReturn("secretkey"); var col = new EnvironmentSettingsCollection(_source); return(col); }
protected void SetupSecureSettingSource() { Configuration = Isolate.Fake.Instance <Configuration>(); Factory = new TestConfigurationFactory(Configuration); KeyManager = Isolate.Fake.Instance <SecretKeyManager>(); Key = "key"; Isolate.WhenCalled((() => KeyManager.GetKey())).WillReturn(Key); CryptoGraphy = Isolate.Fake.Instance <CryptoGraphy>(); Isolate.WhenCalled(() => CryptoGraphy.SetKey(Key)).IgnoreCall(); Name = "secret"; Encrypted = "[Secure]="; Isolate.WhenCalled((() => CryptoGraphy.Encrypt(Name))).WillReturn(Encrypted); Isolate.WhenCalled((() => CryptoGraphy.Decrypt(Encrypted))).WillReturn(Name); SecureSettingSource = new ConfigurationSettingSource(Factory); }