示例#1
0
        public void IsDocumentInCollection_DocumentDoesNotExist_ReturnsFalse()
        {
            // Arrange
            var db         = new DocumentDb(location, key, database);
            var documentId = Guid.NewGuid().ToString();

            // Act
            var exists = db.DocumentExists(CollectionId, documentId);

            // Assert
            exists.Should().BeFalse();
        }
示例#2
0
        public void IsDocumentInCollection_DocumentIdIsNull_ThrowsException(string documentId)
        {
            // Arrange
            var db = new DocumentDb(location, key, database);

            // Act
            var ex = Record.Exception(() => db.DocumentExists(CollectionId, documentId));

            //Assert
            ex.Should().NotBeNull();
            ex.Should().BeOfType <ArgumentNullException>();
        }
示例#3
0
        public async Task IsDocumentInCollection_DocumentDoesExist_ReturnsTrue()
        {
            // Arrange
            var db         = new DocumentDb(location, key, database);
            var documentId = Guid.NewGuid().ToString();
            var person     = new PersonTest
            {
                PersonId = Guid.NewGuid(),
                Name     = "Barney Rubble",
                Age      = 87
            };
            var personEnvelope = new DocumentBase <PersonTest> {
                VM = person
            };
            await db.UpsertDocument(CollectionId, documentId, personEnvelope);

            // Act
            var exists = db.DocumentExists(CollectionId, documentId);

            // Assert
            exists.Should().BeTrue();
        }