Esempio n. 1
0
        public void TestFirstColumnIsId()
        {
            //Read a test excel file as a byte array
            FileStream fileStream = new FileStream(testFilePath, FileMode.Open, FileAccess.Read);
            ExcelFile file = new ExcelFile(fileStream, dynamicProvider);

            //verify the types were created successfully.
            Assert.AreEqual("100024", file.GetInstances(ModelContext.Current.GetModelType("Data")).ElementAt(0).Id );
            Assert.AreEqual("101707", file.GetInstances(ModelContext.Current.GetModelType("Data")).ElementAt(1).Id);
            Assert.AreEqual("101708", file.GetInstances(ModelContext.Current.GetModelType("Data")).ElementAt(2).Id);
            Assert.AreEqual("101713", file.GetInstances(ModelContext.Current.GetModelType("Data")).ElementAt(3).Id);
        }
Esempio n. 2
0
        public void TestInstanceDataCreation()
        {
            //Read a test excel file as a byte array
            FileStream fileStream = new FileStream(testFilePath, FileMode.Open, FileAccess.Read);
            ExcelFile file = new ExcelFile(fileStream, dynamicProvider);

            //verify the first instance was created
            //need to use the translated property name
            Assert.AreEqual("KELLER", file.GetInstances(ModelContext.Current.GetModelType("Data")).ElementAt(0)["_LastName"]);
            Assert.AreEqual("RHONDA", file.GetInstances(ModelContext.Current.GetModelType("Data")).ElementAt(0)["_FirstName"]);
            Assert.AreEqual("513826", file.GetInstances(ModelContext.Current.GetModelType("Data")).ElementAt(0)["_Customer__"]);
            Assert.AreEqual("100024", file.GetInstances(ModelContext.Current.GetModelType("Data")).ElementAt(0)["_Location__"]);
        }