Exemplo n.º 1
0
        public async Task CSVFile_GetPeople()
        {
            // Arrange
            readCSVMock.Setup(_ => _.GetCSVLines(It.IsAny <string>())).ReturnsAsync(csvLines);

            var csvFile = new CSVFile(readCSVMock.Object);

            // Act
            List <Person> people = await csvFile.GetPeople("MockedFileName.csv", 10);

            // Assert
            Assert.IsNotNull(people);
        }
Exemplo n.º 2
0
        public async Task QuickInsert_InsertListUsingBulkInsert()
        {
            //Arrange
            CSVFile csvFile = new CSVFile(readCSVMock.Object);
            var     people  = await csvFile.GetPeople("MockedFIleName.csv", 10);

            QuickInsert quickInsert = new QuickInsert(bulkInsertMock.Object);

            // Act
            long result = await quickInsert.InsertUsingBulkInsert(people);

            //Assert
            Assert.AreEqual(people.Count, result);
        }
Exemplo n.º 3
0
        public async Task Database_InsertUsingStoredProcedure_Test()
        {
            //Arrange
            CSVFile csvFile = new CSVFile(readCSVMock.Object);

            people = await csvFile.GetPeople("MockedFIleName.csv", 10);

            var database = new Database(iDbConnectionFactoryMock.Object);

            // Act
            int rowsAffected = database.InsertUsingStoredProcedure(people);

            // Assert
            Assert.AreEqual(rowsAffected, people.Count);
        }
Exemplo n.º 4
0
        public async Task BusinessLogic_InsertUsingBulkInsert()
        {
            // Arrange
            csvFile = new CSVFile(readCSVMock.Object);
            people  = await csvFile.GetPeople("MockedFileName.csv", numberOfRecords);

            csvFileMock.Setup(_ => _.GetPeople(It.IsAny <string>(), It.IsAny <int>())).ReturnsAsync(people);

            var businessLogic = new BusinessLogic(databaseMock.Object, csvFileMock.Object, quickInsertMock.Object);

            // Act
            int actual = await businessLogic.InsertUsingBulkInsert("TestFile.csv", numberOfRecords);

            // Assert
            Assert.AreEqual(numberOfRecords, actual);
        }