コード例 #1
0
 public void Save_When_KeyAttribute_Is_Not_Defined_Throw_DocumentIdMissingException()
 {
     var brewery = new Brewery();
        var bucket = new Mock<IBucket>();
        var result = new Mock<IOperationResult<Brewery>>();
        result.Setup(x => x.Status).Returns(ResponseStatus.Success);
        bucket.Setup(x => x.Upsert(It.IsAny<string>(), It.IsAny<Brewery>())).Returns(result.Object);
        var ctx = new BucketContext(bucket.Object);
        Assert.Throws<KeyAttributeMissingException>(()=>ctx.Save(brewery));
 }
コード例 #2
0
        public void Remove_When_DocId_Is_Not_Defined_Throw_DocumentIdMissingException()
        {
            //arrange
            var brewery = new Brewery();
            var bucket = new Mock<IBucket>();
            var ctx = new BucketContext(bucket.Object);

            //act-assert
            Assert.Throws<KeyAttributeMissingException>(() => ctx.Remove(brewery));
        }