public async Task When_calling_resolve_async_on_a_srv_connection_string() { // NOTE: this requires SRV and TXT records in DNS as specified here: // https://github.com/mongodb/specifications/tree/master/source/initial-dns-seedlist-discovery var connectionString = "mongodb+srv://user%40GSSAPI.COM:[email protected]/funny?replicaSet=rs0"; var subject = new ConnectionString(connectionString); var resolved = await subject.ResolveAsync(); resolved.ToString().Should().Be("mongodb://user%40GSSAPI.COM:[email protected]:27017/funny/?authSource=thisDB&ssl=true&replicaSet=rs0"); }
public void Resolve_with_resolveHosts_should_return_expected_result(string connectionString, bool resolveHosts, string expectedResult, bool async) { var subject = new ConnectionString(connectionString); ConnectionString result; if (async) { result = subject.Resolve(resolveHosts); } else { result = subject.ResolveAsync(resolveHosts).GetAwaiter().GetResult(); } result.IsResolved.Should().BeTrue(); result.ToString().Should().Be(expectedResult); }