コード例 #1
0
        public void Should_translate_category_correctly(int code, ServerErrorCategory expectedCategory)
        {
            var coreError = new Core.Operations.BulkWriteOperationError(0, code, "blah", new BsonDocument());
            var subject = BulkWriteError.FromCore(coreError);

            subject.Category.Should().Be(expectedCategory);
        }
コード例 #2
0
        public void Should_translate_category_correctly(int code, ServerErrorCategory expectedCategory)
        {
            var coreError = new Core.Operations.BulkWriteOperationError(0, code, "blah", new BsonDocument());
            var subject   = BulkWriteError.FromCore(coreError);

            subject.Category.Should().Be(expectedCategory);
        }
コード例 #3
0
 // constructors
 internal WriteError(ServerErrorCategory category, int code, string message, BsonDocument details)
 {
     _category = category;
     _code     = code;
     _details  = details;
     _message  = message;
 }
コード例 #4
0
ファイル: WriteError.cs プロジェクト: RavenZZ/MDRelation
 // constructors
 internal WriteError(ServerErrorCategory category, int code, string message, BsonDocument details)
 {
     _category = category;
     _code = code;
     _details = details;
     _message = message;
 }
コード例 #5
0
        public void ToString_should_return_expected_result(
            ServerErrorCategory category,
            int code,
            string message,
            string detailsJson,
            string expectedResult)
        {
            var details    = detailsJson == null ? null : BsonDocument.Parse(detailsJson);
            var writeError = new WriteError(category, code, message, details);

            var result = writeError.ToString();

            result.Should().Be(expectedResult);
        }
コード例 #6
0
        /// <summary>
        /// 从给定的 <see cref="ServerErrorCategory"/> 枚举值创建相应的 <see cref="RepositoryErrorCode"/> 枚举值。
        /// </summary>
        /// <param name="category"><see cref="ServerErrorCategory"/> 枚举值</param>
        /// <returns>
        /// 从给定的 <see cref="ServerErrorCategory"/> 枚举值创建的 <see cref="RepositoryErrorCode"/> 枚举值。
        /// </returns>
        public static RepositoryErrorCode FromMongoServerErrorCategory(ServerErrorCategory category)
        {
            switch (category)
            {
            case ServerErrorCategory.DuplicateKey:
                return(RepositoryErrorCode.DuplicateKey);

            case ServerErrorCategory.ExecutionTimeout:
                return(RepositoryErrorCode.Timeout);

            default:
                return(RepositoryErrorCode.Unknown);
            }
        }
コード例 #7
0
 public void Should_return_correct_error_category(int code, ServerErrorCategory expectedCategory)
 {
     var subject = new BulkWriteOperationError(0, code, "something", new BsonDocument());
     subject.Category.Should().Be(expectedCategory);
 }
コード例 #8
0
 // constructors
 internal BulkWriteError(int index, ServerErrorCategory category, int code, string message, BsonDocument details)
     : base(category, code, message, details)
 {
     _index = index;
 }
コード例 #9
0
 // constructors
 internal BulkWriteError(int index, ServerErrorCategory category, int code, string message, BsonDocument details)
     : base(category, code, message, details)
 {
     _index = index;
 }
コード例 #10
0
        public void Should_return_correct_error_category(int code, ServerErrorCategory expectedCategory)
        {
            var subject = new BulkWriteOperationError(0, code, "something", new BsonDocument());

            subject.Category.Should().Be(expectedCategory);
        }