예제 #1
0
        public void Getconfig_Uses_Paramater_Transcoder()
        {
            var contentTranscoder = new Mock <ITypeTranscoder>();
            var operation         = new FakeOperation(contentTranscoder.Object);

            var config           = new BucketConfig();
            var configTranscoder = new Mock <ITypeTranscoder>();

            configTranscoder
            .Setup(transcoder => transcoder.Decode <BucketConfig>(It.IsAny <byte[]>(), It.IsAny <int>(),
                                                                  It.IsAny <int>(), It.IsAny <Flags>(), It.IsAny <OperationCode>()))
            .Returns(config);

            var result = operation.GetConfig(configTranscoder.Object);

            Assert.AreSame(config, result);

            // make sure the transcoder for decoding document content is not used
            configTranscoder.Verify(
                t => t.Decode <BucketConfig>(It.IsAny <byte[]>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <Flags>(),
                                             It.IsAny <OperationCode>()), Times.Once);
            contentTranscoder.Verify(
                t => t.Decode <BucketConfig>(It.IsAny <byte[]>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <Flags>(),
                                             It.IsAny <OperationCode>()), Times.Never);
        }