コード例 #1
0
        public void TestInsertManyWithStaticTypeObjectWithEnum()
        {
            var person1 = new PersonWithEnum
            {
                Name    = "Zaphod",
                Surname = "zarquon",
                Age     = AgeDescription.Old
            };
            var person2 = new PersonWithEnum
            {
                Name    = "Zaphod2",
                Surname = "zarquon2",
                Age     = AgeDescription.Young
            };

            List <PersonWithEnum> actual = _db.Persons.Insert(new[] { person1, person2 }).ToList <PersonWithEnum>();

            Assert.NotNull(actual[0]);
            Assert.NotEqual(0, actual[0].Id);
            Assert.Equal("Zaphod", actual[0].Name);
            Assert.Equal("zarquon", actual[0].Surname);
            Assert.Equal(80, (int)actual[0].Age);
            Assert.Equal(AgeDescription.Old, actual[0].Age);

            Assert.NotNull(actual[1]);
            Assert.NotEqual(0, actual[1].Id);
            Assert.Equal("Zaphod2", actual[1].Name);
            Assert.Equal("zarquon2", actual[1].Surname);
            Assert.Equal(1, (int)actual[1].Age);
            Assert.Equal(AgeDescription.Young, actual[1].Age);
        }
コード例 #2
0
        public void TestInsertWithStaticTypeObjectWithEnum()
        {
            var person = new PersonWithEnum
            {
                Name    = "Zaphod",
                Surname = "zarquon",
                Age     = AgeDescription.Old
            };

            PersonWithEnum actual = _db.Persons.Insert(person);

            Assert.NotNull(person);
            Assert.NotEqual(0, actual.Id);
            Assert.Equal("Zaphod", actual.Name);
            Assert.Equal("zarquon", actual.Surname);
            Assert.Equal(80, (int)actual.Age);
            Assert.Equal(AgeDescription.Old, actual.Age);
        }