public void Create_UnknownType_ArgumentOutOfRangeException()
        {
            // Arrange

            var bucketFactory = new BucketFactory(
                new ClusterContext(),
                new Mock <IScopeFactory>().Object,
                new Mock <IRetryOrchestrator>().Object,
                new Mock <IVBucketKeyMapperFactory>().Object,
                new Mock <IKetamaKeyMapperFactory>().Object,
                new Mock <ILogger <CouchbaseBucket> >().Object,
                new Mock <ILogger <MemcachedBucket> >().Object,
                new TypedRedactor(RedactionLevel.None),
                new Mock <IBootstrapperFactory>().Object,
                NoopRequestTracer.Instance,
                new Mock <IOperationConfigurator>().Object,
                new BestEffortRetryStrategy(),
                new Mock <IHttpClusterMapFactory>().Object);

            // Act/Assert

            var ex = Assert.Throws <ArgumentOutOfRangeException>(() =>
                                                                 bucketFactory.Create("bucket_name", (BucketType)500, new BucketConfig()));

            Assert.Equal("bucketType", ex.ParamName);
        }
Example #2
0
        public void Create_GivenType_ExpectedType(BucketType bucketType, Type expectedType)
        {
            // Arrange

            var bucketFactory = new BucketFactory(
                new ClusterContext(),
                new Mock <IScopeFactory>().Object,
                new Mock <IRetryOrchestrator>().Object,
                new Mock <IVBucketKeyMapperFactory>().Object,
                new Mock <IKetamaKeyMapperFactory>().Object,
                new Mock <ILogger <CouchbaseBucket> >().Object,
                new Mock <ILogger <MemcachedBucket> >().Object,
                new Mock <IRedactor>().Object,
                new Mock <IBootstrapperFactory>().Object,
                NullRequestTracer.Instance);

            // Act

            var result = bucketFactory.Create("bucket_name", bucketType);

            // Assert

            Assert.IsAssignableFrom(expectedType, result);
            Assert.Equal("bucket_name", result.Name);
        }
        public void Create_GivenType_ExpectedType(BucketType bucketType, Type expectedType)
        {
            // Arrange

            var bucketFactory = new BucketFactory(
                new ClusterContext(),
                new Mock <IScopeFactory>().Object,
                new Mock <IRetryOrchestrator>().Object,
                new Mock <IVBucketKeyMapperFactory>().Object,
                new Mock <IKetamaKeyMapperFactory>().Object,
                new Mock <ILogger <CouchbaseBucket> >().Object,
                new Mock <ILogger <MemcachedBucket> >().Object,
                new TypedRedactor(RedactionLevel.None),
                new Mock <IBootstrapperFactory>().Object,
                NoopRequestTracer.Instance,
                new Mock <IOperationConfigurator>().Object,
                new BestEffortRetryStrategy(),
                new Mock <IHttpClusterMapFactory>().Object);

            // Act

            var result = bucketFactory.Create("bucket_name", bucketType, new BucketConfig());

            // Assert

            Assert.IsAssignableFrom(expectedType, result);
            Assert.Equal("bucket_name", result.Name);
        }
Example #4
0
        public void Create_UnknownType_ArgumentOutOfRangeException()
        {
            // Arrange

            var bucketFactory = new BucketFactory(
                new ClusterContext(),
                new Mock <IScopeFactory>().Object,
                new Mock <IRetryOrchestrator>().Object,
                new Mock <ILogger <CouchbaseBucket> >().Object,
                new Mock <ILogger <MemcachedBucket> >().Object);

            // Act/Assert

            var ex = Assert.Throws <ArgumentOutOfRangeException>(() =>
                                                                 bucketFactory.Create("bucket_name", (BucketType)500));

            Assert.Equal("bucketType", ex.ParamName);
        }