Esempio n. 1
0
            public async Task ensure_default_projectFileChooser_take_the_right_File()
            {
                var projectHelper = new ProjectHelper(SampleProjectHelper.WorkFolder());
                var resultContext = await projectHelper.BuildProjectAssembly();

                Check.That(resultContext).HasNoErrors();
                Check.That(resultContext.ProjectFile).IsEqualTo(Path.Combine(SampleProjectHelper.WorkFolder(), "Sample.csproj"));
                Check.That(resultContext.ProjectName).IsEqualTo("Sample");
            }
Esempio n. 2
0
            public async Task ensure_default_projectBinaryLoader_loads_assembly()
            {
                var projectHelper = new ProjectHelper(SampleProjectHelper.WorkFolder());
                var resultContext = await projectHelper.BuildProjectAssembly();

                Check.That(resultContext).HasNoErrors();
                Check.That(resultContext.AssemblyLength).IsGreaterThan(1000);
                Check.That(resultContext.ResultingAssembly).IsNotNull();
            }
Esempio n. 3
0
            public async Task ensure_projectFileChooser_is_called_in_build()
            {
                Action <ConventionsSetter> setconventions = overload =>
                {
                    overload.SetProjectFileChooser(new FakeProjectFileChooser());
                };
                var projectHelper = new ProjectHelper(SampleProjectHelper.WorkFolder(), setconventions);
                var resultContext = await projectHelper.BuildProjectAssembly();

                Check.That(resultContext.ProjectFile).IsEqualTo("/path/to/csproj");
            }
Esempio n. 4
0
            ensure_projectBuilder_is_called()
            {
                Action <ConventionsSetter> setconventions = overload =>
                {
                    overload.SetProjectBuilder(new FakeProjectBuilder());
                };
                var projectHelper = new ProjectHelper(SampleProjectHelper.WorkFolder(), setconventions);
                var resultContext = await projectHelper.BuildProjectAssembly();

                Check.That(resultContext.ResultingAssemblyFile).IsEqualTo("/path/to/resulting/dll");
                Check.That(resultContext.BinFolder).IsEqualTo("/path/to/resulting/dll/bin/folder");
            }
Esempio n. 5
0
            public async Task ensure_default_projectBinaryLoader_loads_assembly_and_get_types_with_dependencies()
            {
                var projectHelper = new ProjectHelper(SampleProjectHelper.WorkFolder());
                var resultContext = await projectHelper.BuildProjectAssembly();

                var asm       = resultContext.ResultingAssembly;
                var type      = asm.GetType("Sample.Greetings");
                var greetings = Activator.CreateInstance(type);
                var toHtml    = type.GetMethod("ToHtml");
                var result    = toHtml.Invoke(greetings, new [] { "# Hello!" });

                Check.That(result).IsEqualTo($"<h1>Hello!</h1>{Environment.NewLine}");
            }
Esempio n. 6
0
            ensure_projectBinaryLoader_is_called()
            {
                Action <ConventionsSetter> setconventions = overload =>
                {
                    overload.SetProjectBuilder(new FakeProjectBuilder());
                    overload.SetProjectBinaryLoader(new FakeProjectBinaryLoader());
                };
                var projectHelper = new ProjectHelper(SampleProjectHelper.WorkFolder(), setconventions);
                var resultContext = await projectHelper.BuildProjectAssembly();

                Check.That(resultContext).HasNoErrors();
                Check.That(resultContext.AssemblyLength).IsEqualTo(1000);
            }
Esempio n. 7
0
            ensure_default_project_builder_builds_the_project_when_it_exists()
            {
                var projectHelper = new ProjectHelper(SampleProjectHelper.WorkFolder());
                var resultContext = await projectHelper.BuildProjectAssembly();

                var expectedBuildFile =
                    Path.Combine(SampleProjectHelper.WorkFolder(), "bin/Debug/netstandard2.0/Sample.dll");
                var expectedBinFolder =
                    Path.Combine(SampleProjectHelper.WorkFolder(), "bin/Debug/netstandard2.0");

                Check.That(resultContext.ResultingAssemblyFile).IsEqualTo(expectedBuildFile);
                Check.That(resultContext.BinFolder).IsEqualTo(expectedBinFolder);
                Check.That(resultContext.AssemblyLength).IsGreaterThan(0);
            }
Esempio n. 8
0
            public async Task ensure_default_projectBinaryLoader_loads_assembly_and_get_types()
            {
                var projectHelper = new ProjectHelper(SampleProjectHelper.WorkFolder());
                var resultContext = await projectHelper.BuildProjectAssembly();

                Check.That(resultContext).HasNoErrors();

                var asm  = resultContext.ResultingAssembly;
                var type = asm.GetType("Sample.Greetings");

                Check.That(type).IsNotNull();

                var greetings = Activator.CreateInstance(type);
                var sayHello  = type.GetMethod("SayHello");
                var result    = sayHello.Invoke(greetings, null);

                Check.That(result).IsEqualTo("Hello World");
            }
Esempio n. 9
0
        public async Task get_access_to_resulting_assembly_on_a_project_folder()
        {
            var projectHelper = new ProjectHelper(SampleProjectHelper.WorkFolder());

            var resultContext = await projectHelper.BuildProjectAssembly();

            var asm       = resultContext.ResultingAssembly;
            var greetType = asm.GetType("Greetings");

            Check.That(greetType).IsNotNull();

            var helloProperty = greetType.GetProperty("Hello");

            Check.That(helloProperty).IsNotNull();

            var greet = Activator.CreateInstance(greetType);

            Check.That(greet).IsNotNull();

            var hello = helloProperty.GetValue(greet);

            Check.That(hello).IsEqualTo("Hello World");
        }
Esempio n. 10
0
            public async Task ensure_working_directoty_is_set()
            {
                var projectHelper = new ProjectHelper(SampleProjectHelper.WorkFolder());

                Check.That(projectHelper.WorkingDirectory).IsEqualTo(SampleProjectHelper.WorkFolder());
            }