public void GenerateBusinessObjectAssembly_RedirectsCallToValidAssemblyGenerator()
        {
            var clientAsmGen = Mock.Create<IAssemblyGenerator>();
            Mock.Arrange(() => clientAsmGen.GenerateBusinessObjectAssembly(Arg.IsAny<AssemblyGeneratorContext>())).Returns(new List<ErrorInfo>());
            var serverAsmGen = Mock.Create<IAssemblyGenerator>();
            Mock.Arrange(() => serverAsmGen.GenerateBusinessObjectAssembly(Arg.IsAny<AssemblyGeneratorContext>())).Returns(new List<ErrorInfo>());

            var generators = new[]
                                 {
                                     new Lazy<IAssemblyGenerator, IAssemblyGeneratorMetadata>(() => clientAsmGen, new AssemblyGeneratorMetadata(AssemblyType.Client, "SqlServer")),
                                     new Lazy<IAssemblyGenerator, IAssemblyGeneratorMetadata>(() => serverAsmGen, new AssemblyGeneratorMetadata(AssemblyType.Server, "SqlServer"))
                                 };

            var pb = new ProcessPublisher { AssemblyGenerators = generators };

            pb.GenerateBusinessObjectAssembly(new ProcessDefinition(string.Empty), AssemblyType.Client);

            Mock.Assert(() => clientAsmGen.GenerateBusinessObjectAssembly(Arg.Matches<AssemblyGeneratorContext>(m => m.AssemblyType == AssemblyType.Client)), Occurs.Once());
            Mock.Assert(() => serverAsmGen.GenerateBusinessObjectAssembly(Arg.Matches<AssemblyGeneratorContext>(m => m.AssemblyType == AssemblyType.Client)), Occurs.Never());

            pb.GenerateBusinessObjectAssembly(new ProcessDefinition(string.Empty), AssemblyType.Server);
            Mock.Assert(() => clientAsmGen.GenerateBusinessObjectAssembly(Arg.Matches<AssemblyGeneratorContext>(m => m.AssemblyType == AssemblyType.Client)), Occurs.Once());
            Mock.Assert(() => serverAsmGen.GenerateBusinessObjectAssembly(Arg.Matches<AssemblyGeneratorContext>(m => m.AssemblyType == AssemblyType.Client)), Occurs.Never()); // wrong db type

            pb.DatabaseType = "SqlServer";
            pb.GenerateBusinessObjectAssembly(new ProcessDefinition(string.Empty), AssemblyType.Server);
            Mock.Assert(() => clientAsmGen.GenerateBusinessObjectAssembly(Arg.Matches<AssemblyGeneratorContext>(m => m.AssemblyType == AssemblyType.Client)), Occurs.Once());
            Mock.Assert(() => serverAsmGen.GenerateBusinessObjectAssembly(Arg.Matches<AssemblyGeneratorContext>(m => m.AssemblyType == AssemblyType.Client)), Occurs.Never());
        }
        public void GenerateBusinessObjectAssembly_ErrorListCanBeNull()
        {
            var serverAsmGen = Mock.Create<IAssemblyGenerator>();
            Mock.Arrange(() => serverAsmGen.GenerateBusinessObjectAssembly(Arg.IsAny<AssemblyGeneratorContext>())).DoNothing();

            var generators = new[] { new Lazy<IAssemblyGenerator, IAssemblyGeneratorMetadata>(() => serverAsmGen, new AssemblyGeneratorMetadata(AssemblyType.Server, "SqlServer")) };

            var pb = new ProcessPublisher { AssemblyGenerators = generators, DatabaseType = "SqlServer" };
            pb.GenerateBusinessObjectAssembly(new ProcessDefinition(string.Empty), AssemblyType.Server);
        }