예제 #1
0
            protected override void Given()
            {
                entity1 = new Employee {
                    Name = "Bob", Login = "******"
                };
                entity1Type      = entity1.GetType();
                identityProperty = entity1Type.GetProperty("Id");
                identityType     = identityProperty.PropertyType;
                id = Guid.NewGuid();

                documentConvention = Fake <ICouchDocumentConvention>();
                documentConvention.GetIdentityPropertyFor(entity1Type).Returns(identityProperty);
                documentConvention.GenerateIdentityFor(identityType).Returns(id);

                bulkDocsResults    = new BulkDocsResult[1];
                bulkDocsResults[0] = new BulkDocsResult {
                    Id = id.ToString(), Rev = "123456"
                };
                couchProxy = Fake <ICouchProxy>();
                couchProxy.Execute <BulkDocsResult[]>(Arg.Any <BulkDocsCommand>()).Returns(bulkDocsResults);

                couchDatabase = Fake <ICouchDatabase>();
                couchDatabase.CouchDocumentConvention.Returns(documentConvention);
                couchDatabase.Name.Returns("ottoman-test-database");
                couchDatabase.CouchProxy.Returns(couchProxy);
            }
예제 #2
0
            protected override void Given()
            {
                documentId       = Guid.NewGuid();
                entity1Type      = typeof(Employee);
                identityProperty = entity1Type.GetProperty("Id");

                documentConvention = Fake <ICouchDocumentConvention>();
                documentConvention.GetIdentityPropertyFor(entity1Type).Returns(identityProperty);

                var couchDocument = new CouchDocument();

                couchDocument.Add("_id", documentId.ToString());
                couchDocument.Add("_rev", "123456");
                couchDocument.Add("Type", entity1Type.Name);
                couchDocument.Add("Name", "Bob");
                couchDocument.Add("Login", "boblogin");

                bulkDocsResults    = new BulkDocsResult[1];
                bulkDocsResults[0] = new BulkDocsResult {
                    Id = documentId.ToString(), Rev = "123456"
                };
                couchProxy = Fake <ICouchProxy>();
                couchProxy.Execute <CouchDocument>(Arg.Any <GetDocumentCommand>()).Returns(couchDocument);
                couchProxy.Execute <BulkDocsResult[]>(Arg.Any <BulkDocsCommand>()).Returns(bulkDocsResults);

                couchDatabase = Fake <ICouchDatabase>();
                couchDatabase.Name.Returns("ottoman-test-database");
                couchDatabase.CouchProxy.Returns(couchProxy);
                couchDatabase.CouchDocumentConvention.Returns(documentConvention);
            }
예제 #3
0
 private CouchClient(ICouchProxy couchProxy, string serverVersion)
 {
     CouchProxy    = couchProxy;
     ServerVersion = serverVersion;
 }