|
| 1 | +/* Copyright 2020-present MongoDB Inc. |
| 2 | +* |
| 3 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +* you may not use this file except in compliance with the License. |
| 5 | +* You may obtain a copy of the License at |
| 6 | +* |
| 7 | +* http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +* |
| 9 | +* Unless required by applicable law or agreed to in writing, software |
| 10 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +* See the License for the specific language governing permissions and |
| 13 | +* limitations under the License. |
| 14 | +*/ |
| 15 | + |
| 16 | +using System.Linq; |
| 17 | +using FluentAssertions; |
| 18 | +using MongoDB.Bson; |
| 19 | +using MongoDB.Bson.TestHelpers.XunitExtensions; |
| 20 | +using MongoDB.Driver.Core.Connections; |
| 21 | +using Xunit; |
| 22 | + |
| 23 | +namespace MongoDB.Driver.Legacy.Tests |
| 24 | +{ |
| 25 | + public class ClientDocumentHelperTests |
| 26 | + { |
| 27 | + [Fact] |
| 28 | + public void CreateDriverDocument_should_return_expected_result() |
| 29 | + { |
| 30 | + var result = ClientDocumentHelper.CreateDriverDocument(); |
| 31 | + |
| 32 | + result["name"].AsString.Should().Be("mongo-csharp-driver|legacy"); |
| 33 | + result["version"].BsonType.Should().Be(BsonType.String); |
| 34 | + } |
| 35 | + |
| 36 | + [Theory] |
| 37 | + [ParameterAttributeData] |
| 38 | + public void CreateDriverDocument_with_args_should_return_expected_result( |
| 39 | + [Values("2.4.0", "2.4.1")] |
| 40 | + string driverVersion) |
| 41 | + { |
| 42 | + var result = ClientDocumentHelper.CreateDriverDocument(driverVersion); |
| 43 | + |
| 44 | + result.Should().Be($"{{ name : 'mongo-csharp-driver|legacy', version : '{driverVersion}' }}"); |
| 45 | + } |
| 46 | + } |
| 47 | +} |
0 commit comments