Example #1
0
        public void AddPart()
        {
            var currentlyBuilding = new Dictionary <Type, TypeIdentity>();
            var repository        = new PluginRepository();

            Func <Type, TypeIdentity> identityGenerator = TypeIdentityBuilder.IdentityFactory(repository, currentlyBuilding);
            PartDefinition            definition        = new PartDefinition
            {
                Identity = identityGenerator(typeof(ExportOnProperty)),
            };

            var fileInfo = new PluginFileInfo("a", DateTimeOffset.Now);

            repository.AddPart(definition, fileInfo);

            var parts = repository.Parts();

            Assert.AreEqual(1, parts.Count());
            Assert.AreSame(definition, parts.First());
            Assert.AreSame(definition, repository.Part(TypeIdentity.CreateDefinition(typeof(ExportOnProperty))));

            var files = repository.KnownPluginFiles();

            Assert.AreEqual(1, files.Count());
            Assert.AreSame(fileInfo, files.First());
        }
        public void AddPart()
        {
            var currentlyBuilding = new Dictionary<Type, TypeIdentity>();
            var repository = new PluginRepository();

            Func<Type, TypeIdentity> identityGenerator = TypeIdentityBuilder.IdentityFactory(repository, currentlyBuilding);
            PartDefinition definition = new PartDefinition
                {
                    Identity = identityGenerator(typeof(ExportOnProperty)),
                };

            var fileInfo = new PluginFileInfo("a", DateTimeOffset.Now);
            repository.AddPart(definition, fileInfo);

            var parts = repository.Parts();
            Assert.AreEqual(1, parts.Count());
            Assert.AreSame(definition, parts.First());
            Assert.AreSame(definition, repository.Part(TypeIdentity.CreateDefinition(typeof(ExportOnProperty))));

            var files = repository.KnownPluginFiles();
            Assert.AreEqual(1, files.Count());
            Assert.AreSame(fileInfo, files.First());
        }