Exemple #1
0
        public void Add_Exists_Throws()
        {
            var manager = new GenericObjectManager <TaskActivity>();

            manager.Add(new ActivityObjectCreator(s_descriptor));

            Action act = () => manager.Add(new ActivityObjectCreator(s_descriptor));

            act.Should().Throw <InvalidOperationException>();
        }
Exemple #2
0
        public void Create_OpenGeneric_NotNull(Type type)
        {
            var manager = new GenericObjectManager <TaskActivity>();

            manager.Add(new ActivityObjectCreator(new TaskActivityDescriptor(typeof(TestActivity <>))));
            TaskActivity activity = manager.GetObject(TypeShortName.ToString(type, false), string.Empty);

            activity.Should().NotBeNull();
            activity.As <WrapperActivity>().Descriptor.Type.Should().Be(type);
        }
Exemple #3
0
        public void Create_Exists_NotNull()
        {
            var manager = new GenericObjectManager <TaskActivity>();

            manager.Add(new ActivityObjectCreator(s_descriptor));
            TaskActivity activity = manager.GetObject(s_descriptor.Name, s_descriptor.Version);

            activity.Should().NotBeNull();
            activity.As <WrapperActivity>().Descriptor.Type.Should().Be(s_descriptor.Type);
        }
Exemple #4
0
        public void Create_ClosedGeneric_NotNull()
        {
            var descriptor = TaskActivityDescriptor.Create <TestActivity <object> >();
            var manager    = new GenericObjectManager <TaskActivity>();

            manager.Add(new ActivityObjectCreator(descriptor));
            TaskActivity activity = manager.GetObject(descriptor.Name, descriptor.Version);

            activity.Should().NotBeNull();
            activity.As <WrapperActivity>().Descriptor.Type.Should().Be(descriptor.Type);

            TaskActivity activity2 = manager.GetObject(typeof(TestActivity <int>).FullName, descriptor.Version);

            activity2.Should().BeNull();
        }
Exemple #5
0
        public void Add_NotExists_Succeeds()
        {
            var manager = new GenericObjectManager <TaskActivity>();

            manager.Add(new ActivityObjectCreator(s_descriptor));
        }