public void Raise_Updated_event()
 {
     using (var sut = new PackageContainer <IDisposable>())
     {
         var raisedUpdated = false;
         sut.Updated += (s, e) => { raisedUpdated = true; };
         sut.Update();
         raisedUpdated.Should().BeTrue();
     }
 }
        public void Add_and_remove_directories()
        {
            var dir = GetRandomDirectory();

            Directory.CreateDirectory(dir);

            try
            {
                var dirs = new List <string> {
                    dir
                };

                var assemblyResolver = Substitute.For <IResolveAssembly>();
                assemblyResolver.Directories.Returns(dirs);


                using (var sut = new PackageContainer <IDisposable>(assemblyResolver))
                {
                    sut.Update();
                    // ReSharper disable once NotAccessedVariable
                    var dummy = assemblyResolver.Received(2).Directories;

                    sut.Update();
                    // ReSharper disable once RedundantAssignment
                    dummy = assemblyResolver.Received(4).Directories;

                    var otherDir = GetRandomDirectory();
                    sut.AddDirectory(otherDir);
                    dirs.Should().BeEquivalentTo(dir, otherDir);

                    sut.AddDirectory(dir);
                    dirs.Should().BeEquivalentTo(dir, otherDir);

                    sut.RemoveDirectory(dir);
                    dirs.Should().BeEquivalentTo(otherDir);

                    sut.RemoveDirectory(otherDir);
                    dirs.Should().BeEmpty();
                }
            }
            finally { Directory.Delete(dir); }
        }
        public void Compose_on_Update()
        {
            using (var sut = new PackageContainer <IDisposable>())
            {
                var dummy = Substitute.For <IDisposable>();
                sut.Batch.AddExportedValue(dummy);

                sut.Update();
                sut.Items.Single().Should().Be(dummy);
            }
        }