public void Insert_ThrowsArgumentException_WhenPathIsEmpty(string path) { var mockedInvoker = new Mock<ISubdocInvoker>(); var builder = new MutateInBuilder<dynamic>(mockedInvoker.Object, () => new DefaultSerializer(), "thekey"); Assert.Throws<ArgumentException>(() => builder.Insert(path, "somevalue", false)); }
public void Insert_ThrowsArgumentException_WhenPathIsEmpty(string path) { var mockedInvoker = new Mock <ISubdocInvoker>(); var builder = new MutateInBuilder <dynamic>(mockedInvoker.Object, () => new DefaultSerializer(), "thekey"); builder.Insert(path, "somevalue", false); }
public void Insert_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.Insert("path", "value", flags) .Execute(); Assert.AreSame(mockResult.Object, result); mockedInvoker.Verify( invoker => invoker.Invoke(It.Is <MutateInBuilder <dynamic> >( builder => builder.FirstSpec().OpCode == OperationCode.SubDictAdd && builder.FirstSpec().Path == "path" && builder.FirstSpec().Flags == expected && (string)builder.FirstSpec().Value == "value" ) ), Times.Once ); }