Beispiel #1
0
        public void Test_Meta_Fakeable()
        {
            // Confirms that the N1QlFunctions.Meta operation can be faked for unit testing in a client application

            var metadata = new DocumentMetadata()
            {
                Id = "testid"
            };

            var mockObject = new Mock<Brewery>();

            var mockMetadataProvider = mockObject.As<IDocumentMetadataProvider>();
            mockMetadataProvider.Setup(p => p.GetMetadata()).Returns(metadata);

            var data = (new List<Brewery> {mockObject.Object}).AsQueryable();

            var query = from p in data select N1QlFunctions.Meta(p).Id;

            Assert.AreEqual(metadata.Id, query.First());
        }
 public DocumentNode()
 {
     Metadata = new DocumentMetadata();
 }
 /// <summary>
 /// Used by intercepted __metadata property generated on the proxy.  We use this special
 /// setter so that it isn't serialized back to the data store.
 /// </summary>
 /// <param name="metadata"></param>
 public void SetMetadata(DocumentMetadata metadata)
 {
     _documentNode.Metadata = metadata;
 }