Exemplo n.º 1
0
        public void KeyManager_Put_ReturnsValue()
        {
            DataProvider         data    = Substitute.For <DataProvider>();
            FakeKeyManagerReader reader  = new FakeKeyManagerReader();
            KeyManager           manager = new KeyManager(data, reader);

            manager.Put();

            Assert.AreEqual("KEY:w.key", reader.NewFileName);
        }
Exemplo n.º 2
0
        public void KeyManager_Fetch_ReturnsValue()
        {
            DataProvider         data    = Substitute.For <DataProvider>();
            FakeKeyManagerReader reader  = new FakeKeyManagerReader();
            KeyManager           manager = new KeyManager(data, reader);

            manager.Fetch();

            Assert.AreEqual("abc", data.APIKey);
        }
Exemplo n.º 3
0
        public void KeyManager_Put_CallsEvent()
        {
            DataProvider         data    = Substitute.For <DataProvider>();
            FakeKeyManagerReader reader  = new FakeKeyManagerReader();
            KeyManager           manager = new KeyManager(data, reader);

            Called = false;
            KeyManager.MapKeyChangedEvent += KeyManager_MapKeyChangedEvent;

            manager.Put();

            KeyManager.MapKeyChangedEvent -= KeyManager_MapKeyChangedEvent;

            Assert.IsTrue(Called);
        }