示例#1
0
        public void GetMembers_ValidMembers_ReturnsCorrectMembers()
        {
            string   filePath        = @"C:\Users\Prime Time Pauly G\Documents\ProgHackNight TestAddresses.xlsx";
            FileInfo spreadsheetFile = new FileInfo(filePath);
            string   expectedFirst   = "Aegon";
            string   expectedLast    = "Targaryen";
            string   expectedZip     = "10003";
            int      expectedCount   = 4;

            string expectedAddress = "51-38 Codwise Pl";

            Standardizer standardizer = new Standardizer();

            List <Member> members = new List <Member>();

            using (ExcelPackage package = new ExcelPackage(spreadsheetFile)) {
                members = standardizer.GetMembers(package, 0);
            }

            Assert.Equal(expectedFirst, members[0].FirstName);
            Assert.Equal(expectedLast, members[0].LastName);
            Assert.Equal(expectedZip, members[0].ZipCode);
            Assert.Equal(expectedAddress, members[1].Address);
            Assert.Equal(expectedCount, members.Count);
        }
示例#2
0
        public void GetMembers_MissingFields_ReturnsCorrectMembers()
        {
            string   filePath        = @"C:\Users\Prime Time Pauly G\Documents\ProgHackNight TestAddresses.xlsx";
            FileInfo spreadsheetFile = new FileInfo(filePath);
            string   expectedFirst   = "Tony";
            string   expectedLast    = "Stark";
            string   expectedZip     = null;
            int      expectedCount   = 4;

            Standardizer standardizer = new Standardizer();

            List <Member> members = new List <Member>();

            using (ExcelPackage package = new ExcelPackage(spreadsheetFile)) {
                members = standardizer.GetMembers(package, 1);
            }

            Assert.Equal(expectedFirst, members[2].FirstName);
            Assert.Equal(expectedLast, members[2].LastName);
            Assert.Equal(expectedZip, members[2].ZipCode);
            Assert.Equal(expectedCount, members.Count);
        }