Exemple #1
0
        public void Net45ShouldUseImmutableCollection()
        {
            var testFolder = "../../../../../../../common/mac/TestProjects/ImmutableCollection_Test/ImmutableCollection_Test";

            StringBuilder restoreOutput = new StringBuilder();

            int code = Driver.RunCommand("mono", String.Format("/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore {0}/packages.config", testFolder), output: restoreOutput);

            if (code != 0)
            {
                Assert.Fail("Net45ShouldUseImmutableCollection failed to restore nuget packages");
            }

            TI.BuildProject(testFolder + "/ImmutableCollection_Test.csproj", true);

            TI.RunAndAssert(testFolder + "/bin/Debug/ImmutableCollection_Test.app/Contents/MacOS/ImmutableCollection_Test", (string)null, "Run");
        }
Exemple #2
0
        public void Net45ShouldUseImmutableCollection()
        {
            var testFolder = Path.Combine(TI.FindRootDirectory(), "../tests/common/mac/TestProjects/ImmutableCollection_Test/ImmutableCollection_Test");

            StringBuilder restoreOutput = new StringBuilder();

            int code = Driver.RunCommand("mono", new [] { "/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe", "restore", $"{testFolder}/packages.config", "-PackagesDirectory", Configuration.NuGetPackagesDirectory }, output: restoreOutput);

            if (code != 0)
            {
                Assert.Fail("Net45ShouldUseImmutableCollection failed to restore nuget packages");
            }

            TI.BuildProject(testFolder + "/ImmutableCollection_Test.csproj");

            TI.RunAndAssert(testFolder + "/bin/Debug/ImmutableCollection_Test.app/Contents/MacOS/ImmutableCollection_Test", Array.Empty <string> (), "Run");
        }
Exemple #3
0
        public void BasicPCLTest()
        {
            var testFolder  = Path.Combine(TI.FindRootDirectory(), "../tests/common/mac/TestProjects/BasicPCLTest/BasicPCLTest");
            var testResults = testFolder + "/TestResult.txt";

            if (File.Exists(testResults))
            {
                File.Delete(testResults);
            }

            TI.BuildProject(testFolder + "/BasicPCLTest.csproj");

            TI.RunAndAssert(testFolder + "/bin/Debug/BasicPCLTest.app/Contents/MacOS/BasicPCLTest", Array.Empty <string> (), "Run");
            Assert.True(File.Exists(testResults));

            using (TextReader reader = File.OpenText(testResults)) {
                var output = reader.ReadToEnd();

                Assert.AreEqual("{\n  \"MyArray\": [\n    \"Manual text\",\n    \"2000-05-23T00:00:00\"\n  ]\n}\n", output);
            }

            File.Delete(testResults);
        }
Exemple #4
0
        public void ProtobufShouldSerializeAndDeserialize()
        {
            var testFolder  = Path.Combine(TI.FindRootDirectory(), "../tests/common/mac/TestProjects/Protobuf_Test/Protobuf_Test");
            var testResults = testFolder + "/TestResult.txt";

            if (File.Exists(testResults))
            {
                File.Delete(testResults);
            }

            TI.BuildProject(testFolder + "/Protobuf_Test.csproj");

            TI.RunAndAssert(testFolder + "/bin/Debug/Protobuf_Test.app/Contents/MacOS/Protobuf_Test", Array.Empty <string> (), "Run");
            Assert.True(File.Exists(testResults));

            using (TextReader reader = File.OpenText(testResults)) {
                var output = reader.ReadLine();

                Assert.AreEqual("Test Passed", output);
            }

            File.Delete(testResults);
        }
Exemple #5
0
        public void ServiceModelShouldCreateCommunicationException()
        {
            var testFolder  = Path.Combine(TI.FindRootDirectory(), "../tests/common/mac/TestProjects/ServiceModel_Test/ServiceModel_Test");
            var testResults = testFolder + "/TestResult.txt";

            if (File.Exists(testResults))
            {
                File.Delete(testResults);
            }

            TI.BuildProject(testFolder + "/ServiceModel_Test.csproj");

            TI.RunAndAssert(testFolder + "/bin/Debug/ServiceModel_Test.app/Contents/MacOS/ServiceModel_Test", Array.Empty <string> (), "Run");
            Assert.True(File.Exists(testResults));

            using (TextReader reader = File.OpenText(testResults)) {
                var output = reader.ReadLine();

                Assert.AreEqual("Test Passed: System.ServiceModel.CommunicationException: System error.", output);
            }

            File.Delete(testResults);
        }