Ejemplo n.º 1
0
            public void Setup()
            {
                AssemblyBuilder builder = new AssemblyBuilder();
                assemblyOne = builder.AssemblyName("TestAssembly1")
                                        .WithClassAndMethods("Class1", new Dictionary<string, string>
                                                                        {
                                                                            {"Method1", "System.Console.WriteLine(\"Test\");"}
                                                                        })
                                        .Build();

                AssemblyBuilder builder2 = new AssemblyBuilder();
                assemblyTwo = builder2.AssemblyName("TestAssembly1.Tests")
                                        .References(Path.GetFileName(assemblyOne.Path))
                                        .WithClassAndMethods("Class1Tests", new Dictionary<string, string>
                                                                        {
                                                                            {"Method1Test", "var c = new Class1();" + Environment.NewLine +
                                                                                            "c.Method1();"},
                                                                        })
                                        .Build();

                AssemblyBuilder builder3 = new AssemblyBuilder();
                assemblyThree = builder3.AssemblyName("TestAssembly1.Tests")
                                        .References(Path.GetFileName(assemblyOne.Path))
                                        .WithClassAndMethods("Class1Tests", new Dictionary<string, string>
                                                                        {
                                                                            {"Method1Test", "var c = new Class1();" + Environment.NewLine +
                                                                                            "c.Method1();"},
                                                                            {"Method1Test2", "var c = new Class1();" + Environment.NewLine +
                                                                            "c.Method1();"},
                                                                        })
                                        .Build();
            }
Ejemplo n.º 2
0
        public void Example_of_how_to_build_an_assembly()
        {
            AssemblyBuilder builder = new AssemblyBuilder();
            AssemblyBuilderResult result = builder.AssemblyName("TestAssembly1")
                .WithClassAndMethods("Class1", new Dictionary<string, string>
                                                   {
                                                       { "Method1", "System.Console.WriteLine(\"Test\");" }
                                                   })
                .Build();

            Assert.IsTrue(File.Exists(result.Path));
        }
Ejemplo n.º 3
0
            public void Setup()
            {
                AssemblyBuilder builder = new AssemblyBuilder();
                assemblyOne = builder.AssemblyName("TestAssembly1")
                                        .WithClassAndMethods("Class1", new Dictionary<string, string>
                                                                        {
                                                                            {"Method1", "System.Console.WriteLine(\"Test\");"},
                                                                        })
                                        .Build();

                AssemblyBuilder builder2 = new AssemblyBuilder();
                assemblyTwo = builder2.AssemblyName("TestAssembly2")
                                        .WithClassAndMethods("Class1", new Dictionary<string, string>
                                                                        {
                                                                            {"Method1", "System.Console.WriteLine(\"Test\");"}
                                                                        })
                                        .WithClassAndMethods("NewClass", new Dictionary<string, string>
                                                                        {
                                                                            {"Method1", "System.Console.WriteLine(\"Test\");"}
                                                                        })
                                        .Build();
            }