public void Counter_ThrowsArgumentException_WhenPathIsEmpty(string path) { var mockedInvoker = new Mock<ISubdocInvoker>(); var builder = new MutateInBuilder<dynamic>(mockedInvoker.Object, () => new DefaultSerializer(), "thekey"); Assert.Throws<ArgumentException>(() => builder.Counter(path, 0, false)); }
public void Counter_ThrowsArgumentException_WhenPathIsEmpty(string path) { var mockedInvoker = new Mock <ISubdocInvoker>(); var builder = new MutateInBuilder <dynamic>(mockedInvoker.Object, () => new DefaultSerializer(), "thekey"); builder.Counter(path, 0, false); }
public void Counter_For_Xattr_Sets_Correct_Flag(SubdocMutateFlags flags, byte expected) { var mockResult = new Mock <IDocumentFragment <dynamic> >(); var mockedInvoker = new Mock <ISubdocInvoker>(); mockedInvoker.Setup(x => x.Invoke(It.IsAny <MutateInBuilder <dynamic> >())) .Returns(mockResult.Object); var mutateBuilder = new MutateInBuilder <dynamic>(mockedInvoker.Object, () => new DefaultSerializer(), "mykey"); var result = mutateBuilder.Counter("path", 100, flags) .Execute(); Assert.AreSame(mockResult.Object, result); mockedInvoker.Verify( invoker => invoker.Invoke(It.Is <MutateInBuilder <dynamic> >( builder => builder.FirstSpec().OpCode == OperationCode.SubCounter && builder.FirstSpec().Path == "path" && builder.FirstSpec().Flags == expected && (long)builder.FirstSpec().Value == 100 ) ), Times.Once ); }