public void CosmosPartitionKeyPathProviderCorrectlyGetsPathWhenAttributeIsDefined()
        {
            ICosmosPartitionKeyPathProvider provider = new DefaultCosmosPartitionKeyPathProvider(_options.Object);

            string path = provider.GetPartitionKeyPath <PickleChipsItem>();

            Assert.Equal("/pickles", path);
            Assert.Equal("[\"Hey, where's the chips?!\"]", new Cosmos.PartitionKey(((IItem) new PickleChipsItem()).PartitionKey).ToString());
        }
Beispiel #2
0
        public void CosmosPartitionKeyPathProviderCorrectlyGetsPath()
        {
            ICosmosPartitionKeyPathProvider provider = new DefaultCosmosPartitionKeyPathProvider();

            string path = provider.GetPartitionKeyPath <PickleChipsItem>();

            Assert.Equal("/pickles", path);
            Assert.Equal("[\"Hey, where's the chips?!\"]", ((IItem) new PickleChipsItem()).PartitionKey.ToString());
        }
        public void CosmosCosmosPartitionKeyPathProviderCorrectlyGetsPathWhenOptionsAreDefinedButNull()
        {
            _repositoryOptions.ContainerBuilder.Configure <Person>(options => options.WithPartitionKey(""));

            ICosmosPartitionKeyPathProvider provider = new DefaultCosmosPartitionKeyPathProvider(_options.Object);

            string path = provider.GetPartitionKeyPath <AnotherPerson>();

            Assert.Equal("/email", path);
        }