Exemplo n.º 1
0
        public void Should_convert_from_InsertRequest_to_Class()
        {
            var document = new TestClass { a = 1 };
            var request = new InsertRequest(new BsonDocumentWrapper(document));

            var result = WriteModel<TestClass>.FromCore(request);

            result.Should().BeOfType<InsertOneModel<TestClass>>();
            var model = (InsertOneModel<TestClass>)result;
            model.Document.Should().BeSameAs(document);
        }
Exemplo n.º 2
0
        public void Should_convert_from_InsertRequest_to_BsonDocument()
        {
            var document = BsonDocument.Parse("{a:1}");
            var request = new InsertRequest(new BsonDocumentWrapper(document));

            var result = WriteModel<BsonDocument>.FromCore(request);

            result.Should().BeOfType<InsertOneModel<BsonDocument>>();
            var insertModel = (InsertOneModel<BsonDocument>)result;
            insertModel.Document.Should().BeSameAs(document);
        }