public void CreateCommand_should_return_expected_result(
            [Values(null, false, true)] bool?authorizedDatabases,
            [Values(null, "cake")] string filterString,
            [Values(null, false, true)] bool?nameOnly)
        {
            var filter = filterString != null
                ? BsonDocument.Parse($"{{ name : \"{filterString}\" }}")
                : null;

            var subject = new ListDatabasesOperation(_messageEncoderSettings)
            {
                AuthorizedDatabases = authorizedDatabases,
                NameOnly            = nameOnly,
                Filter = filter
            };

            var expectedResult = new BsonDocument
            {
                { "listDatabases", 1 },
                { "filter", filter, filterString != null },
                { "nameOnly", nameOnly, nameOnly != null },
                { "authorizedDatabases", authorizedDatabases, authorizedDatabases != null }
            };


            var result = subject.CreateCommand();

            result.Should().Be(expectedResult);
        }
Пример #2
0
        public void CreateCommand_should_return_expected_result()
        {
            var subject        = new ListDatabasesOperation(_messageEncoderSettings);
            var expectedResult = new BsonDocument
            {
                { "listDatabases", 1 }
            };

            var result = subject.CreateCommand();

            result.Should().Be(expectedResult);
        }