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 ReadAllReturnsEmptyCollection()
        {
            var downloadMappingProvider = new DownloadMappingProvider(this._container);

            int count = 0;

            downloadMappingProvider.MappingsAvailable += d =>
            {
                Assert.That(d, Is.InstanceOf(typeof(IEnumerable <IDownloadMapping>)));
                Assert.That(d.Count(), Is.EqualTo(0));
                count++;
            };

            downloadMappingProvider.ReadAll();

            Assert.That(count, Is.EqualTo(1));
        }
        public void InitializeCreatesMappingForSilkveilWebsite()
        {
            var downloadMappingProvider = new DownloadMappingProvider(this._container);

            int count = 0;

            downloadMappingProvider.MappingsAvailable += d =>
            {
                Assert.That(d.Count(), Is.EqualTo(1));
                Assert.That(d.First().Guid, Is.EqualTo(Guid.Empty));
                Assert.That(d.First().Uri, Is.EqualTo(new Uri("http://www.silkveil.net")));
                count++;
            };

            downloadMappingProvider.Initialize();
            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 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));
        }
        public void ReadAllReturnsEmptyCollection()
        {
            var downloadMappingProvider = new DownloadMappingProvider(this._container);

            int count = 0;
            downloadMappingProvider.MappingsAvailable += d =>
                                                     {
                                                         Assert.That(d, Is.InstanceOf(typeof(IEnumerable<IDownloadMapping>)));
                                                         Assert.That(d.Count(), Is.EqualTo(0));
                                                         count++;
                                                     };

            downloadMappingProvider.ReadAll();

            Assert.That(count, Is.EqualTo(1));
        }
        public void InitializeCreatesMappingForSilkveilWebsite()
        {
            var downloadMappingProvider = new DownloadMappingProvider(this._container);

            int count = 0;
            downloadMappingProvider.MappingsAvailable += d =>
                                                     {
                                                         Assert.That(d.Count(), Is.EqualTo(1));
                                                         Assert.That(d.First().Guid, Is.EqualTo(Guid.Empty));
                                                         Assert.That(d.First().Uri, Is.EqualTo(new Uri("http://www.silkveil.net")));
                                                         count++;
                                                     };

            downloadMappingProvider.Initialize();
            downloadMappingProvider.ReadAll();

            Assert.That(count, Is.EqualTo(1));
        }