Beispiel #1
0
        public void CreateFirstAndLastDefaultDiscoveredTest()
        {
            Stream inputStream = File.OpenRead(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\Common\Files\ComaWithoutFirstAndLast.csv"));

            inputParameters.UserHeader = "FirstName,LastName,Email";

            IUserImporter importer = new TextFileUserImporter(inputStream, inputParameters);

            var discoveredUsers = importer.GetDiscoveredUsers();

            Assert.AreEqual("testlocal", (string)discoveredUsers.ElementAt(2).FirstName);
            Assert.AreEqual("part", (string)discoveredUsers.ElementAt(2).LastName);
        }
Beispiel #2
0
        public void ComaDefaultDiscoveredTest()
        {
            Stream inputStream = File.OpenRead(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\Common\Files\Coma.csv"));

            inputParameters.UserHeader = "FirstName,LastName,Email";

            IUserImporter importer = new TextFileUserImporter(inputStream, inputParameters);

            var discoveredUsers = importer.GetDiscoveredUsers();

            Assert.AreEqual(headrersDefault.FirstName, discoveredUsers.ElementAt(0).FirstName);
            Assert.AreEqual(headrersDefault.LastName, discoveredUsers.ElementAt(0).LastName);
            Assert.AreEqual(headrersDefault.Email, discoveredUsers.ElementAt(0).Email);
            Assert.AreEqual(user.FirstName, discoveredUsers.ElementAt(1).FirstName);
            Assert.AreEqual(user.LastName, discoveredUsers.ElementAt(1).LastName);
            Assert.AreEqual(user.Email, discoveredUsers.ElementAt(1).Email);
        }
Beispiel #3
0
        public void SpaceWithHeaderSinglequoteDiscoveredTest()
        {
            Stream inputStream = File.OpenRead(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\Common\Files\Space_WH_SQ.csv"));

            inputParameters.Separator  = 4;
            inputParameters.Delimiter  = 1;
            inputParameters.Position   = 1;
            inputParameters.UserHeader = "FirstName,LastName,Email";

            IUserImporter importer = new TextFileUserImporter(inputStream, inputParameters);

            var discoveredUsers = importer.GetDiscoveredUsers();

            Assert.AreEqual(headrersUser.FirstName, discoveredUsers.ElementAt(0).FirstName);
            Assert.AreEqual(headrersUser.LastName, discoveredUsers.ElementAt(0).LastName);
            Assert.AreEqual(headrersUser.Email, discoveredUsers.ElementAt(0).Email);
            Assert.AreEqual(userQ.FirstName, discoveredUsers.ElementAt(1).FirstName);
            Assert.AreEqual(user.LastName, discoveredUsers.ElementAt(1).LastName);
            Assert.AreEqual(user.Email, discoveredUsers.ElementAt(1).Email);
        }