Ejemplo n.º 1
0
        public void ConflictsSettingsDefaults()
        {
            ConflictProperties conflictSettings = new ConflictProperties();

            Assert.IsNull(conflictSettings.ResourceType);
            Assert.AreEqual(Cosmos.OperationKind.Invalid, conflictSettings.OperationKind);
            Assert.IsNull(conflictSettings.Id);

            SettingsContractTests.TypeAccessorGuard(typeof(ConflictProperties), "Id", "OperationKind", "ResourceType", "SourceResourceId");
        }
Ejemplo n.º 2
0
        public void DatabaseSettingsDefaults()
        {
            DatabaseProperties dbSettings = new DatabaseProperties();

            Assert.IsNull(dbSettings.LastModified);
            Assert.IsNull(dbSettings.ResourceId);
            Assert.IsNull(dbSettings.Id);
            Assert.IsNull(dbSettings.ETag);

            SettingsContractTests.TypeAccessorGuard(typeof(DatabaseProperties), "Id");
        }
Ejemplo n.º 3
0
        public void StoredProecdureSettingsDefaults()
        {
            StoredProcedureProperties dbSettings = new StoredProcedureProperties();

            Assert.IsNull(dbSettings.LastModified);
            Assert.IsNull(dbSettings.ResourceId);
            Assert.IsNull(dbSettings.Id);
            Assert.IsNull(dbSettings.ETag);

            SettingsContractTests.TypeAccessorGuard(typeof(StoredProcedureProperties), "Id", "Body");
        }
        public void ContainerSettingsDefaults()
        {
            string id     = Guid.NewGuid().ToString();
            string pkPath = "/partitionKey";

            SettingsContractTests.TypeAccessorGuard(typeof(ContainerProperties),
                                                    "Id",
                                                    "UniqueKeyPolicy",
                                                    "DefaultTimeToLive",
                                                    "AnalyticalStoreTimeToLiveInSeconds",
                                                    "IndexingPolicy",
                                                    "GeospatialConfig",
                                                    "TimeToLivePropertyPath",
                                                    "PartitionKeyPath",
                                                    "PartitionKeyDefinitionVersion",
                                                    "ConflictResolutionPolicy");

            // Two equivalent definitions
            ContainerProperties cosmosContainerSettings = new ContainerProperties(id, pkPath);

            Assert.AreEqual(id, cosmosContainerSettings.Id);
            Assert.AreEqual(pkPath, cosmosContainerSettings.PartitionKeyPath);

            Assert.IsNull(cosmosContainerSettings.ResourceId);
            Assert.IsNull(cosmosContainerSettings.LastModified);
            Assert.IsNull(cosmosContainerSettings.ETag);
            Assert.IsNull(cosmosContainerSettings.DefaultTimeToLive);

            Assert.IsNotNull(cosmosContainerSettings.IndexingPolicy);
            Assert.IsNotNull(cosmosContainerSettings.ConflictResolutionPolicy);
            Assert.IsTrue(object.ReferenceEquals(cosmosContainerSettings.IndexingPolicy, cosmosContainerSettings.IndexingPolicy));
            Assert.IsNotNull(cosmosContainerSettings.IndexingPolicy.IncludedPaths);
            Assert.IsTrue(object.ReferenceEquals(cosmosContainerSettings.IndexingPolicy.IncludedPaths, cosmosContainerSettings.IndexingPolicy.IncludedPaths));

            Cosmos.IncludedPath ip = new Cosmos.IncludedPath();
            Assert.IsNotNull(ip.Indexes);

            Assert.IsNotNull(cosmosContainerSettings.UniqueKeyPolicy);
            Assert.IsTrue(object.ReferenceEquals(cosmosContainerSettings.UniqueKeyPolicy, cosmosContainerSettings.UniqueKeyPolicy));
            Assert.IsNotNull(cosmosContainerSettings.UniqueKeyPolicy.UniqueKeys);
            Assert.IsTrue(object.ReferenceEquals(cosmosContainerSettings.UniqueKeyPolicy.UniqueKeys, cosmosContainerSettings.UniqueKeyPolicy.UniqueKeys));

            Cosmos.UniqueKey uk = new Cosmos.UniqueKey();
            Assert.IsNotNull(uk.Paths);
        }