public void CreateAlreadyExistingItemResultsInException() { var downloadMappingProvider = new DownloadMappingProvider(this._container); var downloadMapping = new DownloadMapping { Guid = Guid.NewGuid(), Uri = new Uri("http://www.silkveil.net") }; downloadMappingProvider.Create(downloadMapping); Assert.That(() => downloadMappingProvider.Create(downloadMapping), Throws.Exception.TypeOf(typeof(DuplicateMappingException))); }
public void ReadAllReturnsNonEmptyCollectionAfterCreate() { var downloadMappingProvider = new DownloadMappingProvider(this._container); var downloadMapping = new DownloadMapping { Guid = Guid.NewGuid(), Uri = new Uri("http://www.silkveil.net") }; int count = 0; downloadMappingProvider.MappingsAvailable += d => { Assert.That(d, Is.InstanceOf(typeof(IEnumerable <IDownloadMapping>))); Assert.That(d.Count(), Is.EqualTo(1)); Assert.That(d.First().Guid, Is.EqualTo(downloadMapping.Guid)); Assert.That(d.First().Uri, Is.EqualTo(downloadMapping.Uri)); count++; }; downloadMappingProvider.Create(downloadMapping); downloadMappingProvider.ReadAll(); Assert.That(count, Is.EqualTo(1)); }
public void Update() { var downloadMappingProvider = new DownloadMappingProvider(this._container); var downloadMapping = new DownloadMapping { Guid = Guid.NewGuid(), Uri = new Uri("http://www.google.de") }; int count = 0; downloadMappingProvider.MappingAvailable += d => { Assert.That(d.Uri, Is.EqualTo(downloadMapping.Uri)); count++; }; downloadMappingProvider.Create(downloadMapping); downloadMapping.Uri = new Uri("http://www.silkveil.net"); downloadMappingProvider.Update(downloadMapping); downloadMappingProvider.ReadById(downloadMapping.Guid); Assert.That(count, Is.EqualTo(1)); }
public void DeleteByMapping() { var downloadMappingProvider = new DownloadMappingProvider(this._container); var downloadMapping = new DownloadMapping { Guid = Guid.NewGuid(), Uri = new Uri("http://www.silkveil.net") }; int count = 0; downloadMappingProvider.MappingsAvailable += m => { Assert.That(m.Count(), Is.EqualTo(0)); count++; }; downloadMappingProvider.Create(downloadMapping); downloadMappingProvider.Delete(downloadMapping); downloadMappingProvider.ReadAll(); Assert.That(count, Is.EqualTo(1)); }
public void DeleteByGuid() { var downloadMappingProvider = new DownloadMappingProvider(this._container); var downloadMapping = new DownloadMapping { Guid = Guid.NewGuid(), Uri = new Uri("http://www.silkveil.net") }; int count = 0; downloadMappingProvider.MappingsAvailable += m => { Assert.That(m.Count(), Is.EqualTo(0)); count++; }; downloadMappingProvider.Create(downloadMapping); downloadMappingProvider.Delete(downloadMapping.Guid); downloadMappingProvider.ReadAll(); Assert.That(count, Is.EqualTo(1)); }
public void ReadAllReturnsNonEmptyCollectionAfterCreate() { var downloadMappingProvider = new DownloadMappingProvider(this._container); var downloadMapping = new DownloadMapping { Guid = Guid.NewGuid(), Uri = new Uri("http://www.silkveil.net") }; int count = 0; downloadMappingProvider.MappingsAvailable += d => { Assert.That(d, Is.InstanceOf(typeof(IEnumerable<IDownloadMapping>))); Assert.That(d.Count(), Is.EqualTo(1)); Assert.That(d.First().Guid, Is.EqualTo(downloadMapping.Guid)); Assert.That(d.First().Uri, Is.EqualTo(downloadMapping.Uri)); count++; }; downloadMappingProvider.Create(downloadMapping); downloadMappingProvider.ReadAll(); Assert.That(count, Is.EqualTo(1)); }