From 0d2c37ebfe8f1b4e80050b13d21301414981f160 Mon Sep 17 00:00:00 2001 From: bicijinlian Date: Tue, 19 Jun 2018 19:53:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=B8=8D=E8=83=BD=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=EF=BC=8C=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RedisStudyTest/RedisHashStudyTest.cs | 90 ---------------------------- 1 file changed, 90 deletions(-) diff --git a/RedisStudyTest/RedisHashStudyTest.cs b/RedisStudyTest/RedisHashStudyTest.cs index 8287637..4e3ea0d 100644 --- a/RedisStudyTest/RedisHashStudyTest.cs +++ b/RedisStudyTest/RedisHashStudyTest.cs @@ -177,44 +177,6 @@ namespace RedisStudyTest Assert.False(redisDatabase.KeyDelete(preHashKey + studentId)); } - [Fact] - public void QueryOneStudentTest() - { - //hashStudy.AddStudent(this.student); - - //var queryStudent = hashStudy.QueryOneStudent(this.student.Id); - - //Assert.NotNull(queryStudent); - //Assert.True(this.student.Id==queryStudent.Id); - //Assert.True(this.student.Name == queryStudent.Name); - //Assert.True(this.student.Age == queryStudent.Age); - } - - [Fact] - public void ExistStudentTest() - { - //Assert.True(hashStudy.ExistStudent(students[0].Id)); - //Assert.True(hashStudy.ExistStudent(students[1].Id)); - //Assert.True(hashStudy.ExistStudent(students[2].Id)); - //Assert.True(hashStudy.ExistStudent(students[3].Id)); - //Assert.True(hashStudy.ExistStudent(students[4].Id)); - - //Assert.False(hashStudy.ExistStudent(-1000)); - //Assert.False(hashStudy.ExistStudent(-2000)); - } - - /// - /// 查询所有学生 - /// - [Fact] - public void QueryAllStudent() - { - //List students = hashStudy.QueryAllStudents(); - - //Assert.NotNull(students); - //Assert.Equal(students.Count(), students.Count); - } - /// /// 清理 /// @@ -230,57 +192,5 @@ namespace RedisStudyTest redisDatabase.KeyDelete(preHashKey + temp.Id); } } - - #region 辅助方法 - public HashEntry[] StudentsToHashEntrys(Student student) - { - if (student == null) - { - return null; - } - - var entrys = new List() - { - new HashEntry("Id",student.Id), - new HashEntry("Name",student.Name), - new HashEntry("Age",student.Age), - }; - return entrys.ToArray(); - } - - public Student HashEntrysToStudent(HashEntry[] hashEntrys) - { - if (hashEntrys == null) - { - return null; - } - - if (hashEntrys.Length <= 0) - { - return null; - } - - var student = new Student(); - foreach (var entry in hashEntrys) - { - switch (entry.Name) - { - case "Id": - student.Id = entry.Value.IsInteger ? (int)entry.Value : default(int); ; - break; - case "Name": - student.Name = entry.Value.ToString(); - break; - case "Age": - student.Age = entry.Value.IsInteger ? (int)entry.Value : default(int); - break; - default: - break; - } - } - - return student; - } - #endregion } }