Exemplo n.º 1
0
        public void ToListObjectTest()
        {
            // Arrange
            FormCollection Stub           = CreateTestDataSet();
            string         PrimaryKeyName = "Name";
            // Act
            List <TestModel> Test = Stub.ToListObject <TestModel>(PrimaryKeyName);

            //Assert
            Assert.AreEqual(Test.Count, ListCount);

            foreach (var i in Test)
            {
                Assert.AreEqual(i.Name.ToString(), TestData.Name.ToString());
                Assert.AreEqual(i.age, TestData.age);
                Assert.AreEqual(i.PhoneNumber, TestData.PhoneNumber);
                Assert.AreEqual(i.Married, TestData.Married);
                Assert.AreEqual(i.CreatedDateTime, TestData.CreatedDateTime);
            }
        }
Exemplo n.º 2
0
        public void ToListObjectWithDictionary()
        {
            // Arrange
            FormCollection Stub = CreateTestDataSetWithDifferentNaming();
            Dictionary <string, string> MappingDictionary = CreateMappingDictionary();
            string PrimaryKeyName = "Name111";

            // Act
            List <TestModel> Test = Stub.ToListObject <TestModel>(MappingDictionary, PrimaryKeyName);

            // Assert
            foreach (var i in Test)
            {
                Assert.AreEqual(i.Name.ToString(), TestData.Name.ToString());
                Assert.AreEqual(i.age, TestData.age);
                Assert.AreEqual(i.PhoneNumber, TestData.PhoneNumber);
                Assert.AreEqual(i.Married, TestData.Married);
                Assert.AreEqual(i.CreatedDateTime, TestData.CreatedDateTime);
            }
        }