예제 #1
0
        public Task <bool> ExistsBlobAsync(string containerName, string blobName)
        {
            // We invoke this Coyote API to explicitly insert a "scheduling point" during the test execution
            // where the Coyote scheduler should explore a potential interleaving with another concurrently
            // executing operation. As this is a read operation we invoke the 'Read' scheduling point with
            // the corresponding container name, which can help Coyote optimize exploration.
            SchedulingPoint.Read(containerName);
            bool result = this.Containers.TryGetValue(containerName, out Dictionary <string, byte[]> container);

            return(Task.FromResult(result && container.ContainsKey(blobName)));
        }
예제 #2
0
        public Task <byte[]> GetBlobAsync(string containerName, string blobName)
        {
            // We invoke this Coyote API to explicitly insert a "scheduling point" during the test execution
            // where the Coyote scheduler should explore a potential interleaving with another concurrently
            // executing operation. As this is a read operation we invoke the 'Read' scheduling point with
            // the corresponding container name, which can help Coyote optimize exploration.
            SchedulingPoint.Read(containerName);
            var result = this.Containers[containerName][blobName];

            return(Task.FromResult(result));
        }
예제 #3
0
        public Task <T> GetItem <T>(string partitionKey, string id)
            where T : DbItem
        {
            // We invoke this Coyote API to explicitly insert a "scheduling point" during the test execution
            // where the Coyote scheduler should explore a potential interleaving with another concurrently
            // executing operation. As this is a read operation we invoke the 'Read' scheduling point with
            // the corresponding container name, which can help Coyote optimize exploration.
            SchedulingPoint.Read(this.ContainerName);
            if (this.EmitRandomizedFaults && this.Generator.NextBoolean())
            {
                throw new SimulatedDatabaseFaultException();
            }

            var item     = this.State.GetItem(this.ContainerName, partitionKey, id);
            var itemCopy = TestHelper.Clone((T)item);

            return(Task.FromResult(itemCopy));
        }