コード例 #1
0
ファイル: ConfigTest.cs プロジェクト: comsechq/sugar
        public void TestGetConfigLineMixedCase()
        {
            config = Config.FromText("[Section]\r\nKey=bob");

            var result = config.GetValue("section", "key", "default");

            Assert.AreEqual("bob", result);
        }
コード例 #2
0
ファイル: AliasServiceTest.cs プロジェクト: Olezhka/Hipbot
        public void TestSetAliasWithSingleQuotes()
        {
            var config = new Config();

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

            service.SetAlias("test", "alias 'three four'");

            Assert.AreEqual(@"alias ""three four""", config.GetValue("Aliases", "test", string.Empty));
        }
コード例 #3
0
ファイル: AliasServiceTest.cs プロジェクト: Olezhka/Hipbot
        public void TestSetAlias()
        {
            var config = new Config();

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

            service.SetAlias("test", "alias");
            
            Assert.AreEqual("alias", config.GetValue("Aliases", "test", string.Empty));
        }
コード例 #4
0
        public void TestStoreCredentials()
        {
            var config = new Config();

            var credentials = new Credentials
            {
                Name = "Bob",
                JabberId = "123",
                Password = "******",
                ApiToken = "123456"
            };

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

            service.SetCredentials(credentials);

            Assert.AreEqual("123456", config.GetValue("Credentials", "ApiToken", string.Empty));
            Assert.AreEqual("123", config.GetValue("Credentials", "JabberID", string.Empty));
            Assert.AreEqual("Bob", config.GetValue("Credentials", "Name", string.Empty));
            Assert.AreEqual("Password", config.GetValue("Credentials", "Password", string.Empty));
        }
コード例 #5
0
        public void TestStoreCredentials()
        {
            var config = new Config();

            var credentials = new Credentials
            {
                Server = "irc.example.com",
                Port = 123,
                Password = "******"
            };

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

            service.SetCredentials(credentials);

            Assert.AreEqual("123", config.GetValue("Credentials", "Port", string.Empty));
            Assert.AreEqual("irc.example.com", config.GetValue("Credentials", "Server", string.Empty));
            Assert.AreEqual("Password", config.GetValue("Credentials", "Password", string.Empty));
        }