コード例 #1
0
        public void LoadTest()
        {
            var expected = new ChatUserInfo();
            target.Load();

            if (target.Alias != null)Assert.AreNotEqual(expected.Alias, target.Alias);
            if (target.HostName != null) Assert.AreNotEqual(expected.HostName, target.HostName);
            if (target.Language != null) Assert.AreNotEqual(expected.Language, target.Language);
            if (target.SubnetMask != null) Assert.AreNotEqual(expected.SubnetMask, target.SubnetMask);
            if (target.TextColor != null) Assert.AreNotEqual(expected.TextColor, target.TextColor);
            if (target.UserName != null) Assert.AreNotEqual(expected.UserName, target.UserName);
            if (target.DefaultPort != null) Assert.AreNotEqual(expected.DefaultPort, target.DefaultPort);
            if (target.FontName != null) Assert.AreNotEqual(expected.FontName, target.FontName);

            Settings.Default.UserName = "******";
            Settings.Default.Alias = "Alias";
            Settings.Default.UserNameOrAlias = true;
            target.Load();
            Assert.AreEqual(target.Alias, "Alias");
            Assert.AreEqual(target.UserName, Environment.UserName);

            Settings.Default.UserName = "******";
            Settings.Default.UserNameOrAlias = false;
            Settings.Default.TextColor = null;
            target.Load();
            Assert.AreEqual(target.UserName, "User");
            Assert.AreEqual(target.TextColor, "Black");
            Assert.IsNull(target.Alias);

            Settings.Default.TextColor = "Red";
            target.Load();
            Assert.AreEqual(target.TextColor, "Red");

            foreach (var property in target.GetType().GetProperties())
            {
                if(!property.CanRead) return;
                expected.GetType().GetProperty(property.Name).SetValue(expected, property.GetValue(target, null),null);//Member(member.Name).SetValue(expected, );
            }

            Assert.AreEqual(expected.Alias, target.Alias);
            Assert.AreEqual(expected.Hidden, target.Hidden);
            Assert.AreEqual(expected.HostName, target.HostName);
            Assert.AreEqual(expected.Ignore, target.Ignore);
            Assert.AreEqual(expected.IsMainUser, target.IsMainUser);
            Assert.AreEqual(expected.Language, target.Language);
            Assert.AreEqual(expected.MainUserHasChanges, target.MainUserHasChanges);
            Assert.AreEqual(expected.SubnetMask, target.SubnetMask);
            Assert.AreEqual(expected.TextColor, target.TextColor);
            Assert.AreEqual(expected.UserName, target.UserName);
            Assert.AreEqual(expected.UserNameOrAlias, target.UserNameOrAlias);
            Assert.AreEqual(expected.DefaultPort, target.DefaultPort);
            Assert.AreEqual(expected.FontName, target.FontName);
            Assert.AreEqual(expected.FontSize, target.FontSize);
        }
コード例 #2
0
        public void DefaultPortTest()
        {
            var info = new ChatUserInfo();
            info.Load();
            //Something went wrong with loading the settings
            if (Convert.ToInt32(info.DefaultPort) == 0)
                info.DefaultPort = "8080";

            Globals.DefaultPort = Convert.ToInt32(info.DefaultPort);
            var actual = Globals.DefaultPort;
            Assert.AreEqual(8080, actual);
        }
コード例 #3
0
 public void MainUserTest()
 {
     var expected = new ChatUserInfo
                                 {
                                     DefaultPort = "8080",
                                     HostName = "local",
                                     Hidden = false,
                                     Language = "Dutch"
                                 };
     Globals.MainUser = null;
     var actual = Globals.MainUser;
     Assert.IsNotNull(actual);
     Globals.MainUser = expected;
     actual = Globals.MainUser;
     Assert.AreEqual(expected, actual);
 }
コード例 #4
0
 public void ChatUserInfoConstructorTest()
 {
     var expectedUserInfo = new ChatUserInfo();
     Assert.AreEqual(target.GetType(), expectedUserInfo.GetType());
 }
コード例 #5
0
 public void MyTestInitialize()
 {
     target = new ChatUserInfo();
 }
コード例 #6
0
 public void MyTestCleanup()
 {
     target = null;
 }
コード例 #7
0
 public bool SaveUserInfo(ChatUserInfo userInfo, string password)
 {
     throw new NotImplementedException();
 }