Пример #1
0
        void SuccessfulBuild_RunTest(TestProjectInfo testInfo, bool many, bool dtb, LocalBuilder builder)
        {
            string[] parameters = GetBuildProperties(many, dtb);
            bool     success    = builder.Build(testInfo.SlnPath, GetBuildTarget(dtb), parameters);

            CopyLogs(testInfo, true);
            Assert.That(success, Is.True, "Build should have succeeded");

            CopyGeneratedFiles(testInfo);

            foreach (SourceFile src in generated_sources)
            {
                foreach (SourceFileMember member in src)
                {
                    string generatedFile = Path.Combine(testInfo.GeneratedPath, src.Path);
                    if (member.IsMethod)
                    {
                        Assert.That(SourceHasMethod(generatedFile, member.Visibility, member.Type, member.Name, member.Arguments), Is.True, $"Method {member.Name} must exist in {generatedFile}");
                    }
                    else
                    {
                        Assert.That(SourceHasProperty(generatedFile, member.Visibility, member.Type, member.Name, member.IsExpressionBody), Is.True, $"Property {member.Name} must exist in {generatedFile}");
                    }
                }
            }

            if (dtb)
            {
                return;                 // DTB doesn't produce binaries
            }
            foreach (string binaryName in produced_binaries)
            {
                AssertExists(testInfo.TestName, Path.Combine(testInfo.BinPath, binaryName));
            }
        }
Пример #2
0
        void SuccessfulBuild_RunTest(string testName, bool many, LocalBuilder builder)
        {
            string[] parameters = GetBuildProperties(many);
            bool     success    = builder.Build(TestProjectPath, "SignAndroidPackage", parameters);

            CopyLogs(testName, true);
            Assert.That(success, Is.True, "Build should have succeeded");

            CopyGeneratedFiles(testName);

            foreach (SourceFile src in generated_sources)
            {
                foreach (SourceFileMember member in src)
                {
                    if (member.IsMethod)
                    {
                        Assert.That(SourceHasMethod(Path.Combine(TestProjectRootDirectory, src.Path), member.Visibility, member.Type, member.Name, member.Arguments), Is.True, $"Method {member.Name} must exist in {src.Path}");
                    }
                    else
                    {
                        Assert.That(SourceHasProperty(Path.Combine(TestProjectRootDirectory, src.Path), member.Visibility, member.Type, member.Name, member.IsExpressionBody), Is.True, $"Property {member.Name} must exist in {src.Path}");
                    }
                }
            }

            foreach (string binPath in produced_binaries)
            {
                AssertExists(testName, Path.Combine(TestProjectRootDirectory, binPath));
            }
        }
Пример #3
0
		void FailedBuild_ConflictingRelativeLayout_RunTest (string testName, bool many, bool dtb, LocalBuilder builder)
		{
			string[] parameters = GetBuildProperties (many, dtb, "NOT_CONFLICTING_RELATIVELAYOUT");
			bool success = builder.Build (TestProjectPath, GetBuildTarget (dtb), parameters);

			CopyLogs (testName, true);
			Assert.That (success, Is.False, "Build should have failed");

			string logPath = GetTestLogPath (testName);
			bool haveError = HaveCompilerError_CS0266 (logPath, "OnboardingActivityPartial.cs", 43, "Android.Views.View", "Android.Widget.RelativeLayout");
			AssertHaveCompilerError (haveError, "OnboardingActivityPartial.cs", 43);

			haveError = HaveCompilerError_CS0266 (logPath, "OnboardingActivity.cs", 38, "Android.Views.View", "Android.Widget.RelativeLayout");
			AssertHaveCompilerError (haveError, "OnboardingActivity.cs", 38);
		}
Пример #4
0
		void FailedBuild_ConflictingFragment_RunTest (string testName, bool many, bool dtb, LocalBuilder builder)
		{
			string[] parameters = GetBuildProperties (many, dtb, "NOT_CONFLICTING_FRAGMENT");
			bool success = builder.Build (TestProjectPath, GetBuildTarget (dtb), parameters);

			CopyLogs (testName, true);
			Assert.That (success, Is.False, "Build should have failed");

			string logPath = GetTestLogPath (testName);
			bool haveError = HaveCompilerError_CS0266 (logPath, "MainActivity.cs", 26, "Android.App.Fragment", "CommonSampleLibrary.LogFragment");
			AssertHaveCompilerError (haveError, "MainActivity.cs", 26);

			haveError = HaveCompilerError_CS0266 (logPath, "AnotherMainActivity.cs", 23, "Android.App.Fragment", "CommonSampleLibrary.LogFragment");
			AssertHaveCompilerError (haveError, "AnotherMainActivity.cs", 23);
		}
Пример #5
0
        void FailedBuild_ConflictingLinearLayout_RunTest(TestProjectInfo testInfo, bool many, bool dtb, LocalBuilder builder)
        {
            string[] parameters = GetBuildProperties(many, dtb, "NOT_CONFLICTING_LINEARLAYOUT");
            bool     success    = builder.Build(testInfo.SlnPath, GetBuildTarget(dtb), parameters);

            CopyLogs(testInfo, true);
            Assert.That(success, Is.False, "Build should have failed");

            string logPath   = GetTestLogPath(testInfo);
            bool   haveError = HaveCompilerError_CS0266(logPath, "OnboardingActivityPartial.cs", 41, "Android.Views.View", "Android.Widget.LinearLayout");

            AssertHaveCompilerError(haveError, "OnboardingActivityPartial.cs", 41);

            haveError = HaveCompilerError_CS0266(logPath, "OnboardingActivity.cs", 36, "Android.Views.View", "Android.Widget.LinearLayout");
            AssertHaveCompilerError(haveError, "OnboardingActivity.cs", 36);
        }
Пример #6
0
        void FailedBuild_ConflictingButton_RunTest(string testName, bool many, LocalBuilder builder)
        {
            string[] parameters = GetBuildProperties(many, "NOT_CONFLICTING_BUTTON");
            bool     success    = builder.Build(TestProjectPath, "SignAndroidPackage", parameters);

            CopyLogs(testName, true);
            Assert.That(success, Is.False, "Build should have failed");

            string logPath   = GetTestLogPath(testName);
            bool   haveError = HaveCompilerError_CS0266(logPath, "OnboardingActivityPartial.cs", 34, "Android.Views.View", "Android.Widget.Button");

            AssertHaveCompilerError(haveError, "OnboardingActivityPartial.cs", 34);

            haveError = HaveCompilerError_CS0266(logPath, "OnboardingActivity.cs", 29, "Android.Views.View", "Android.Widget.Button");
            AssertHaveCompilerError(haveError, "OnboardingActivity.cs", 29);
        }