Ejemplo n.º 1
0
		public void Should_enqueue_to_pending_if_work_of_the_same_type_but_with_different_etag_is_active()
		{
			transactionalStorage.Batch(accessor => accessor.PutFile(FileName, 0, EmptyETagMetadata));

			queue.EnqueueSynchronization(Destination,
			                             new MetadataUpdateWorkItem(FileName, "http://localhost:12345", new NameValueCollection(),
			                                                        transactionalStorage));

			SynchronizationWorkItem work;

			queue.TryDequePendingSynchronization(Destination, out work);
			queue.SynchronizationStarted(work, Destination);

			transactionalStorage.Batch(accessor => accessor.UpdateFileMetadata(FileName, new NameValueCollection
				                                                                             {
					                                                                             {"ETag", "\"" + Guid.NewGuid() + "\""}
				                                                                             }));

			var metadataUpdateWorkItem = new MetadataUpdateWorkItem(FileName, "http://localhost:12345", new NameValueCollection(),
			                                                        transactionalStorage);

			metadataUpdateWorkItem.RefreshMetadata();

			queue.EnqueueSynchronization(Destination, metadataUpdateWorkItem);

			Assert.Equal(1, queue.Active.Count());
			Assert.Equal(1, queue.Pending.Count());
		}
Ejemplo n.º 2
0
 public bool Equals(MetadataUpdateWorkItem other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other.FileName, FileName) && Equals(other.FileETag, FileETag));
 }
Ejemplo n.º 3
0
		public bool Equals(MetadataUpdateWorkItem other)
		{
			if (ReferenceEquals(null, other)) return false;
			if (ReferenceEquals(this, other)) return true;
			return Equals(other.FileName, FileName) && Equals(other.FileETag, FileETag);
		}