public void CreateTable_NotCreate_Verify(string dbName, string tableName) { var dataAccessMock = new Mock <IDataAccess>(); var queryProviderMock = new Mock <IQueryProvider>(); var creator = new NgramsDataBaseCreator(dataAccessMock.Object, queryProviderMock.Object); creator.CreateTables(dbName, tableName, -1); dataAccessMock.Verify(m => m.ExecuteNonQueryServer(It.IsAny <string>()), Times.Never); }
public void CreateTable_Verify(string dbName, string tableName) { const string commandText = "b"; const string commandText2 = "c"; var dataAccessMock = new Mock <IDataAccess>(); dataAccessMock.Setup(m => m.ExecuteNonQueryServer(commandText)).Verifiable(); dataAccessMock.Setup(m => m.ExecuteNonQueryServer(commandText2)).Verifiable(); var queryProviderMock = new Mock <IQueryProvider>(); queryProviderMock.Setup(m => m.CreateNgramsTableString(dbName, tableName, 1)).Returns(commandText); queryProviderMock.Setup(m => m.CreateAddProcedureString(dbName, tableName, 1)).Returns(commandText2); var creator = new NgramsDataBaseCreator(dataAccessMock.Object, queryProviderMock.Object); creator.CreateTables(dbName, tableName, 1); dataAccessMock.Verify(m => m.ExecuteNonQueryServer(It.IsAny <string>()), Times.Exactly(2)); }