Пример #1
0
        public void UseCase1_GivenCSVFilePathCorrect_TypeIsIncorrect_whenAnalyse_ItThrowsException()
        {
            DelegateCSVDirector delegateCSV = bb.CSVDirector;
            var actual   = Assert.Throws <CensusAnalyseException>(() => delegateCSV(ff.createInstance("AdapterClass"), ErrorTypeFilePath_Usecase1));
            var expected = MyEnum.INCORRECT_TYPE.ToString();

            Assert.AreEqual(actual.Message, expected);
        }
Пример #2
0
        public void UseCase1_GivenCSVFilePath_Imroper_whenAnalyse_ItThrowsException()
        {
            DelegateCSVDirector delegateCSV = bb.CSVDirector;
            var actual   = Assert.Throws <CensusAnalyseException>(() => delegateCSV(ff.createInstance("AdapterClass"), IncorrectFilePath_Usecase1));
            var expected = MyEnum.ERROR_IN_FILE_READING.ToString();

            Assert.AreEqual(actual.Message, expected);
        }
Пример #3
0
        public void UseCase2_GivenCSVFilePathCorrect_CSVHeaderIsIncorrect_whenAnalyse_ItThrowsException()
        {
            DelegateCSVDirector delegateCSV = bb.CSVDirector;
            var actual   = Assert.Throws <CensusAnalyseException>(() => delegateCSV(ff.createInstance("AdapterClass"), FilePath_EmptyHeader_Usecase2));
            var expected = MyEnum.HEADER_IS_NOT_FOUND.ToString();

            Assert.AreEqual(actual.Message, expected);
        }
Пример #4
0
        public void UseCase2_GivenCSVFilePathCorrect_DelimiterIsIncorrect_whenAnalyse_ItThrowsException()
        {
            DelegateCSVDirector delegateCSV = bb.CSVDirector;
            var actual   = Assert.Throws <CensusAnalyseException>(() => delegateCSV(ff.createInstance("AdapterClass"), CorrectFilePath_Usecase2, '.'));
            var expected = MyEnum.INVALID_DELIMITER.ToString();

            Assert.AreEqual(actual.Message, expected);
        }
Пример #5
0
        public void UseCase2_GivenCSVFilePathProper_whenAnalyse_ItMatchesTheRecord()
        {
            DelegateCSVDirector delegateCSV = bb.CSVDirector;
            object Iteratoritems            = delegateCSV(ff.createInstance("AdapterClass"), CorrectFilePath_Usecase2);

            string[] myitems = File.ReadAllLines(@"C:\Users\Bridge Labz\source\repos\CensusAnalyserLibrary\StateCode.csv");
            int      item    = (int)myitems.Length - 1;

            Assert.AreEqual(item, Iteratoritems);
        }
Пример #6
0
        public void UseCase1_GivenCSVFilePathProper_whenAnalyse_ItMatchesTheRecord()
        {
            StateCensusAnalyser obj         = new StateCensusAnalyser();
            DelegateCSVDirector delegateCSV = bb.CSVDirector;
            var obj1 = delegateCSV(ff.createInstance("AdapterClass"), CorrectFilePath_Usecase1);

            string[] myitems = File.ReadAllLines(@"C:\Users\Bridge Labz\Desktop\censusdata\StateCensusData.CSV");
            int      item    = (int)myitems.Length - 1;

            Assert.AreEqual(item, obj1);
        }