当前位置: 首页>>代码示例>>C#>>正文


C# User.Equals方法代码示例

本文整理汇总了C#中User.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# User.Equals方法的具体用法?C# User.Equals怎么用?C# User.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在User的用法示例。


在下文中一共展示了User.Equals方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EqualsTest

        public void EqualsTest()
        {
            var user1 = new User("Hans", "Hansen", "Hanserik", "[email protected]");
            var user2 = new User("Hans", "Hansen", "Hanserik", "[email protected]");

            Assert.IsTrue(user1.Equals(user2));

            var user3 = new User("Hanss", "Hansen", "Hanserik", "[email protected]");

            Assert.IsFalse(user1.Equals(user3));
        }
开发者ID:Hejsil,项目名称:2.-Semester-Examen,代码行数:11,代码来源:UserTest.cs

示例2: Equals_should_work

        public void Equals_should_work()
        {
            var user1 = new User("UseRName", "opa");
            var user2 = new User("UserName", "op34a");
            var user3 = new User("Nick4Name", "op34a");

            Assert.IsTrue(user1.Equals(user2));
            Assert.IsFalse(user1.Equals(user3));
            Assert.IsFalse(user1.Equals(null));
            Assert.IsFalse(user1.Equals(4));
        }
开发者ID:PetrRostov,项目名称:PR.Chat,代码行数:11,代码来源:UserFixtures.cs

示例3: DrawProposalActions

        private static IWritable DrawProposalActions(Proposal proposal, User user)
        {
            List<IWritable> components = new List<IWritable>();

            if ( proposal.Status == ProposalStatus.Created )
            {
                if (user.Equals(proposal.User))
                {
                    components.Add(A(ResolveUri.ForEditProposal(proposal), "Edit"));
                }

                if (user.Role.Equals(Role.Administrator))
                {
                    components.Add(Form("post", ResolveUri.ForAcceptProposal(proposal), InputSubmit("Accept")));
                }

                components.Add(Form("post", ResolveUri.ForRejectProposal(proposal), InputSubmit("Reject")));
            }

            var elem = Div( "controls", "actions"
                          , components.ToArray()
                          );

            return elem;
        }
开发者ID:driverpt,项目名称:PI-1112SV,代码行数:25,代码来源:ProposalView.cs

示例4: EqualsTest

 public void EqualsTest()
 {
     var target = new User { Name = "Florian" };
     var obj = new User { Name = "Florian" };
     var expected = false; // The Key is never the same
     var actual = target.Equals(obj);
     Assert.AreEqual(expected, actual);
     Assert.IsNotNull(actual);
 }
开发者ID:famstutz,项目名称:YAEM,代码行数:9,代码来源:UserTest.cs

示例5: CompareToTest

        public void CompareToTest()
        {
            var userList = new List<User>();

            var user1 = new User("1Hans", "Hansen", "Hanserik", "[email protected]");
            var user2 = new User("2Hans", "Hansen", "Hanserik", "[email protected]");
            var user3 = new User("3Hans", "Hansen", "Hanserik", "[email protected]");

            userList.Add(user2);
            userList.Add(user1);
            userList.Add(user3);

            userList.Sort();

            Assert.IsTrue(user1.Equals(userList[0]));
            Assert.IsTrue(user2.Equals(userList[1]));
            Assert.IsTrue(user3.Equals(userList[2]));
        }
开发者ID:Hejsil,项目名称:2.-Semester-Examen,代码行数:18,代码来源:UserTest.cs

示例6: RemovePersonFromProject

 /// <summary>
 /// Removes the individual person in the given Project.
 /// There's no check whether the user or project exists or not.
 /// So checks should be made prior to executing this method.
 /// </summary>
 /// <param name="project">The project to remove the user from</param>
 /// <param name="user">THe user to be removed from the given project</param>
 /// <returns></returns>
 private bool RemovePersonFromProject(Project project, User user)
 {
     var t = from d in dbContext.ProjectUsers
             where project.Equals(d.Project) && user.Equals(d.User)
             select d;
     dbContext.ProjectUsers.DeleteOnSubmit(t.ToList().FirstOrDefault());
     try
     {
         dbContext.SubmitChanges();
         return true;
     }
     catch (Exception e)
     {
         Console.WriteLine("Something went wrong, when deleting the user id: " + user.Id + ", from the project id: " + project.Id + " Error Message: \n" + e);
         return false;
     }
 }
开发者ID:dmab0914-Gruppe-2,项目名称:3-Semester-Project-Share,代码行数:25,代码来源:DbProject.cs

示例7: lobbyClient_OnUserStatusChanged

 void lobbyClient_OnUserStatusChanged(UserStatus eve, User u)
 {
     Dispatcher.Invoke(new Action(() =>
     {
         if (u.Equals(Program.lobbyClient.Me))
         {
             tbUsername.Text = Program.lobbyClient.Me.DisplayName;
             tbStatus.Text = Program.lobbyClient.Me.CustomStatus;
             Registry.WriteValue("Nickname", Program.lobbyClient.Me.DisplayName);
         }
     }));
 }
开发者ID:YoshiEnVerde,项目名称:OCTGN,代码行数:12,代码来源:Main.xaml.cs

示例8: writeReview

 public void writeReview(User user, string review_text, int rating)
 {
     //Can't write a review of yourself, dummy
     if (!user.Equals(this))
     {
         user.addReview(this, review_text, rating);
     }
 }
开发者ID:cjdinofrio,项目名称:AuctionP,代码行数:8,代码来源:User.cs

示例9: UserEquality

 public void UserEquality()
 {
     var u1 = new User("Nick");
       var u2 = new User("Nick");
       Assert.IsTrue(u1.Equals(u2));
 }
开发者ID:destinygg,项目名称:bot,代码行数:6,代码来源:UtilityTools.cs

示例10: AddUpdateUser

        public void AddUpdateUser(User user)
        {
            int index = -1;
            bool equals = false;
            foreach (var user1 in users)
            {
                if (user1.MyID == user.MyID)
                {
                    if (user.Equals(user1))
                    {
                        equals = true;
                        break;
                    }
                    index = users.IndexOf(user1);

                }
            }

            if (index != -1)
            {

                users.RemoveAt(index);

            }

            if (equals == false)
            {
                users.Add(user);
            }
        }
开发者ID:GiladShoham,项目名称:RedRock,代码行数:30,代码来源:MangeUsers.cs


注:本文中的User.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。