示例#1
0
            public void HasParams_ReturnsSqlErrorCollectionWithErrors()
            {
                // Arrange
                var sqlError = SqlClientUtil.CreateSqlError(0);

                // Act
                var errorCollection = SqlClientUtil.CreateSqlErrorCollection(sqlError);

                // Assert
                Assert.Contains(sqlError, errorCollection.OfType <SqlError>());
            }
示例#2
0
            public void HasParams_ReturnsSqlExceptionWithErrors()
            {
                // Arrange
                var sqlError = SqlClientUtil.CreateSqlError(0);

                // Act
                var ex = SqlClientUtil.CreateSqlException(message, innerException, conId, sqlError);

                // Assert
                Assert.Contains(sqlError, ex.Errors.OfType <SqlError>());
            }
示例#3
0
            public void ReturnsSqlError()
            {
                // Arrange
                int infoNumber = 0;

                // Act
                var error = SqlClientUtil.CreateSqlError(infoNumber);

                // Assert
                Assert.IsAssignableFrom <SqlError>(error);
            }
            public void ExIsSqlCommandExceptionAndDoesNotContainSqlErrorWithNumberIs2_ReturnsFalse()
            {
                // Arrange
                var sqlError     = SqlClientUtil.CreateSqlError(0);
                var sqlException = SqlClientUtil.CreateSqlException(sqlError);
                var ex           = new SqlCommandException(null, sqlException, null);

                // Act
                var isTransient = LeaderboardsStoreClient.IsTransient(ex);

                // Assert
                Assert.False(isTransient);
            }
示例#5
0
            public void ReturnsSqlError()
            {
                // Arrange
                int    infoNumber     = 0;
                byte   errorState     = 0;
                byte   errorClass     = 0;
                string server         = "server";
                string errorMessage   = "errorMessage";
                string procedure      = "procedure";
                int    lineNumber     = 0;
                uint   win32ErrorCode = 0;

                // Act
                var error = SqlClientUtil.CreateSqlError(infoNumber, errorState, errorClass, server, errorMessage, procedure, lineNumber, win32ErrorCode);

                // Assert
                Assert.IsAssignableFrom <SqlError>(error);
            }
示例#6
0
            public void AddsError()
            {
                // Arrange
                var    errorCollection = SqlClientUtil.CreateSqlErrorCollection();
                int    infoNumber      = 0;
                byte   errorState      = 0;
                byte   errorClass      = 0;
                string server          = "server";
                string errorMessage    = "errorMessage";
                string procedure       = "procedure";
                int    lineNumber      = 0;
                uint   win32ErrorCode  = 0;
                var    error           = SqlClientUtil.CreateSqlError(infoNumber, errorState, errorClass, server, errorMessage, procedure, lineNumber, win32ErrorCode);

                // Act
                errorCollection.Add(error);

                // Assert
                Assert.Same(error, errorCollection[0]);
            }