Esempio n. 1
0
        public void TestAddNickname()
        {
            var config = new Config();

            Mock<IConfigService>()
                .Setup(call => call.GetConfig())
                .Returns(config);

            service.Add("bob");

            var section = config.GetSection("Nicknames");

            Assert.AreEqual(1, section.Count);
            Assert.AreEqual("bob", section[0].Key);
        }
Esempio n. 2
0
        public void TestRemoveNickname()
        {
            var config = new Config();
            config.SetValue("Nicknames", "bob", string.Empty);
            config.SetValue("Nicknames", "alice", string.Empty);

            Mock<IConfigService>()
                .Setup(call => call.GetConfig())
                .Returns(config);

            service.Remove("bob");

            var section = config.GetSection("Nicknames");

            Assert.AreEqual(1, section.Count);
            Assert.AreEqual("alice", section[0].Key);
        }