예제 #1
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            var       build = new GeomBuild();
            MgPolygon geom1 = build.CreatePolygon(2.0);
            MgPolygon geom2 = build.CreatePolygon(12.0);
            MgPolygon geom3 = build.CreatePolygon(2.0);

            MgPolygonCollection coll = new MgPolygonCollection();

            coll.Add(geom1);
            coll.Add(geom2);
            coll.Add(geom3);

            Assert.AreEqual(3, coll.Count);
            Assert.IsTrue(geom1.Equals(coll[0]));
            Assert.IsTrue(coll[0].Equals(coll[2]));
            Assert.IsFalse(coll[0].Equals(coll[1]));
            coll[0] = coll[1];
            Assert.IsTrue(coll[0].Equals(coll[1]));

            double width = 0.0;

            foreach (MgPolygon geom in coll)
            {
                width += geom.Envelope().GetWidth();
            }
            Assert.AreEqual(geom1.Envelope().GetWidth() * 3.0, width);
        }
예제 #2
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgDataPropertyDefinition def1 = new MgDataPropertyDefinition("def1");
            MgDataPropertyDefinition def2 = new MgDataPropertyDefinition("def2");
            MgDataPropertyDefinition def3 = new MgDataPropertyDefinition("def3");
            MgDataPropertyDefinition def4 = new MgDataPropertyDefinition("def4");

            MgPropertyDefinitionCollection coll = new MgPropertyDefinitionCollection();

            coll.Add(def1);
            coll.Add(def2);
            coll.Insert(2, def4);
            coll.Insert(2, def3);

            Assert.AreEqual(4, coll.Count);
            Assert.AreEqual("def1", coll[0].GetName());

            MgPropertyDefinition tmp = coll[0];

            coll.Remove(def1);
            Assert.AreEqual(3, coll.Count);
            coll.Insert(0, tmp);


            string txt = "";

            foreach (MgPropertyDefinition def in coll)
            {
                txt += "[" + def.GetName() + "]";
            }
            Assert.AreEqual("[def1][def2][def3][def4]", txt);
        }
예제 #3
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            string     coordsys = "GEOGCS[\"LL84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]]";
            MgEnvelope env      = new MgEnvelope(10, 10, 20, 20);



            MgMapBase map1 = factory.CreateMap(coordsys, env, "map1");
            MgMapBase map2 = factory.CreateMap(coordsys, env, "map2");
            MgMapBase map3 = factory.CreateMap(coordsys, env, "map3");
            MgMapBase map4 = factory.CreateMap(coordsys, env, "map4");

            MgMapCollection coll = new MgMapCollection();

            coll.Add(map1);
            coll.Insert(1, map2);
            coll.Add(map3);

            Assert.AreEqual(3, coll.Count);
            Assert.AreEqual(coll[2].GetName(), "map3");

            coll[1] = map4;


            string txt = "";

            foreach (MgMapBase map in coll)
            {
                txt += "[" + map.GetName() + "]";
            }
            Assert.AreEqual("[map1][map4][map3]", txt);
        }
예제 #4
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            var     wkt   = new MgWktReaderWriter();
            MgPoint geom1 = wkt.Read("POINT XY (1.0 1.0)") as MgPoint;
            MgPoint geom2 = wkt.Read("POINT XY (2.0 2.0)") as MgPoint;
            MgPoint geom3 = wkt.Read("POINT XY (1.0 1.0)") as MgPoint;

            MgPointCollection coll = new MgPointCollection();

            coll.Add(geom1);
            coll.Add(geom2);
            coll.Add(geom3);

            Assert.AreEqual(3, coll.Count);
            Assert.IsTrue(geom1.Equals(coll[0]));
            Assert.IsTrue(coll[0].Equals(coll[2]));
            Assert.IsFalse(coll[0].Equals(coll[1]));
            coll[0] = coll[1];
            Assert.IsTrue(coll[0].Equals(coll[1]));

            double x = 0.0;

            foreach (MgPoint geom in coll)
            {
                x += geom.GetCoordinate().GetX();
            }
            Assert.AreEqual(5.0, x);
        }
예제 #5
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            logger.WriteLine("Skipping CollectionTestsLayerCollection: MgLayerGroupCollection constructor not visible");

            /*
             * MgLayerGroup group1 = new MgLayerGroup("group1");
             * MgLayerGroup group2 = new MgLayerGroup("group2");
             * MgLayerGroup group3 = new MgLayerGroup("group3");
             * MgLayerGroup group4 = new MgLayerGroup("group4");
             *
             * MgLayerGroupCollection coll = new MgLayerGroupCollection();
             * coll.Add(group1);
             * coll.Insert(1, group2);
             * coll.Add(group3);
             * coll.Insert(3, group4);
             *
             * Assert.AreEqual(4, coll.Count);
             * Assert.AreEqual(coll[2].GetName(), "group3");
             *
             * coll[1] = coll[2];
             *
             * string txt = "";
             * foreach (MgLayerGroup group in coll)
             * {
             *  txt += "[" + group.GetName() + "]";
             * }
             * Assert.AreEqual("[group1][group3][group3][group4]", txt);
             */
        }
예제 #6
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgPropertyCollection propVals = new MgPropertyCollection();
            MgInt32Property      prop     = new MgInt32Property("prop", 1);

            propVals.Add(prop);
            MgUpdateFeatures update = new MgUpdateFeatures("class2", propVals, "where cat < dog");
            MgInsertFeatures insert = new MgInsertFeatures("class3", propVals);
            MgDeleteFeatures del    = new MgDeleteFeatures("class1", "where cat > dog");

            MgFeatureCommandCollection coll = new MgFeatureCommandCollection();

            coll.Add(update);
            coll.Add(insert);
            coll.Add(del);

            Assert.AreEqual(3, coll.Count);
            Assert.AreEqual(MgFeatureCommandType.DeleteFeatures, coll[2].GetCommandType());
            coll[0] = coll[1];

            string txt = "";

            foreach (MgFeatureCommand cmd in coll)
            {
                txt += "[" + cmd.GetCommandType() + "]";
            }
            Assert.AreEqual("[0][0][2]", txt);
        }
예제 #7
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgGeometryFactory gf = new MgGeometryFactory();
            MgCoordinate      c1 = gf.CreateCoordinateXY(1.0, 1.0);
            MgCoordinate      c2 = gf.CreateCoordinateXY(2.0, 2.0);
            MgCoordinate      c3 = gf.CreateCoordinateXY(3.0, 3.0);
            MgCoordinate      c4 = gf.CreateCoordinateXY(4.0, 4.0);

            MgCoordinateCollection coll = new MgCoordinateCollection();

            coll.Add(c1);
            coll.Insert(1, c2);
            coll.Add(c3);
            coll.Add(c4);

            Assert.AreEqual(4, coll.Count);
            Assert.AreEqual(1.0, coll[0].GetX());
            coll[3] = coll[2];
            Assert.AreEqual(3.0, coll[3].GetX());

            double sum = 0.0;

            foreach (MgCoordinate coord in coll)
            {
                sum += coord.GetX();
            }
            Assert.AreEqual(9.0, sum);
        }
예제 #8
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            StringCollection strColl = new StringCollection();

            strColl.Add("string1");
            strColl.Add("string2");
            strColl.Add("string3");
            strColl.Add("string3");

            MgStringCollection coll1 = new MgStringCollection();

            coll1.Add("Hello");

            MgStringCollection coll2 = new MgStringCollection(strColl);

            Assert.AreEqual(4, coll2.GetCount());
            StringCollection coll3 = coll2;

            Assert.AreEqual(4, coll3.Count);
            for (int i = 0; i < 4; i++)
            {
                Assert.AreEqual(strColl[i], coll2.GetItem(i));
                Assert.AreEqual(strColl[i], coll3[i]);
            }
        }
예제 #9
0
        public static int Execute(IPlatformFactory factory, ITestLogger logger, ref int testsRun)
        {
            int failures = 0;
            var types    = typeof(MapGuideTests).Assembly.GetTypes();

            foreach (var type in types)
            {
                if (typeof(IExternalTest).IsAssignableFrom(type) && type.IsClass && !type.IsAbstract)
                {
                    var test = (IExternalTest)Activator.CreateInstance(type);
                    try
                    {
                        logger.WriteLine("****** Executing MapGuide test: " + type.Name + " *********");
                        Console.WriteLine("Executing external MapGuide test: " + type.Name);
                        test.Execute(factory, logger);
                    }
                    catch (AssertException ex)
                    {
                        logger.WriteLine("Assertion failure: " + ex.Message);
                        failures++;
                    }
                    catch (Exception ex)
                    {
                        logger.WriteLine("General failure: " + ex.ToString());
                        failures++;
                    }
                    finally
                    {
                        testsRun++;
                    }
                }
            }
            return(failures);
        }
예제 #10
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgStringProperty prop1 = new MgStringProperty("prop1", "val1");
            MgStringProperty prop2 = new MgStringProperty("prop2", "val2");
            MgStringProperty prop3 = new MgStringProperty("prop3", "val3");
            MgStringProperty prop4 = new MgStringProperty("prop4", "val4");

            MgStringPropertyCollection coll = new MgStringPropertyCollection();

            coll.Add(prop1);
            coll.Add(prop2);
            coll.Remove(prop3);
            coll.Remove(coll[1]);
            Assert.AreEqual(1, coll.Count);
            coll.Add(prop3);
            coll[1] = prop2;
            coll.Insert(2, prop3);
            Assert.AreEqual(2, coll.IndexOf(prop3));
            coll.Add(prop4);

            string txt = "";

            foreach (MgStringProperty prop in coll)
            {
                txt += "[" + prop.GetName() + "]";
            }
            Assert.AreEqual("[prop1][prop2][prop3][prop4]", txt);
        }
예제 #11
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgGeometryFactory      gf          = new MgGeometryFactory();
            MgCoordinate           pt1         = gf.CreateCoordinateXY(0, 0);
            MgCoordinate           pt2         = gf.CreateCoordinateXY(0, 10);
            MgCoordinate           pt3         = gf.CreateCoordinateXY(10, 10);
            MgCoordinate           pt4         = gf.CreateCoordinateXY(10, 0);
            MgCoordinateCollection coordinates = new MgCoordinateCollection();

            coordinates.Add(pt1);
            coordinates.Add(pt2);
            coordinates.Add(pt3);
            coordinates.Add(pt4);
            MgLinearSegment          linearSegment = gf.CreateLinearSegment(coordinates);
            MgCurveSegmentCollection curveSegments = new MgCurveSegmentCollection();

            curveSegments.Add(linearSegment);
            MgCurveString curveString = gf.CreateCurveString(curveSegments);

            Assert.AreEqual(1, curveString.Count);
            Assert.AreEqual(pt1.ToString(), curveString.StartCoordinate.ToString());
            Assert.AreEqual(pt4.ToString(), curveString.EndCoordinate.ToString());
            Assert.AreEqual(MgGeometryType.CurveString, curveString.GeometryType);
            Assert.AreEqual(1, curveString.Dimension);
        }
        public TeamCityAndTrxLogger()
        {
            _teamCityLogger = new TeamCityLogger();
            var trxLoggerType = Type.GetType("Microsoft.VisualStudio.TestPlatform.Extensions.TrxLogger, Microsoft.VisualStudio.TestPlatform.Extensions.TrxLogger, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");

            _trxLogger = (ITestLogger)Activator.CreateInstance(trxLoggerType, true);
        }
예제 #13
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgGeometryFactory      gf          = new MgGeometryFactory();
            MgCoordinate           pt1         = gf.CreateCoordinateXY(0, 0);
            MgCoordinate           pt2         = gf.CreateCoordinateXY(0, 10);
            MgCoordinate           pt3         = gf.CreateCoordinateXY(10, 10);
            MgCoordinate           pt4         = gf.CreateCoordinateXY(10, 0);
            MgCoordinateCollection coordinates = new MgCoordinateCollection();

            coordinates.Add(pt1);
            coordinates.Add(pt2);
            coordinates.Add(pt3);
            coordinates.Add(pt4);
            MgLinearSegment          linearSegment = gf.CreateLinearSegment(coordinates);
            MgCurveSegmentCollection curveSegments = new MgCurveSegmentCollection();
            MgCurveRing              curveRing     = gf.CreateCurveRing(curveSegments);
            MgCurvePolygon           cp            = gf.CreateCurvePolygon(curveRing, null);
            MgCurvePolygonCollection cpc           = new MgCurvePolygonCollection();

            cpc.Add(cp);
            MgMultiCurvePolygon mcp = gf.CreateMultiCurvePolygon(cpc);

            Assert.AreEqual(1, mcp.Count);
            Assert.AreEqual(MgGeometryType.MultiCurvePolygon, mcp.GeometryType);
            Assert.AreEqual(2, mcp.Dimension);
        }
예제 #14
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgGeometryFactory      gf          = new MgGeometryFactory();
            MgCoordinate           pt1         = gf.CreateCoordinateXY(0, 0);
            MgCoordinate           pt2         = gf.CreateCoordinateXY(0, 10);
            MgCoordinate           pt3         = gf.CreateCoordinateXY(10, 10);
            MgCoordinate           pt4         = gf.CreateCoordinateXY(10, 0);
            MgCoordinateCollection coordinates = new MgCoordinateCollection();

            coordinates.Add(pt1);
            coordinates.Add(pt2);
            coordinates.Add(pt3);
            coordinates.Add(pt4);
            MgLinearSegment          linearSegment = gf.CreateLinearSegment(coordinates);
            MgCurveSegmentCollection curveSegments = new MgCurveSegmentCollection();

            curveSegments.Add(linearSegment);
            MgCurveString           curveString = gf.CreateCurveString(curveSegments);
            MgCurveStringCollection csc         = new MgCurveStringCollection();

            csc.Add(curveString);
            MgMultiCurveString mcs = gf.CreateMultiCurveString(csc);

            Assert.AreEqual(1, mcs.Count);
            Assert.AreEqual(MgGeometryType.MultiCurveString, mcs.GeometryType);
            Assert.AreEqual(1, mcs.Dimension);
        }
예제 #15
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgGeometryFactory      gf          = new MgGeometryFactory();
            MgCoordinate           pt1         = gf.CreateCoordinateXY(0, 0);
            MgCoordinate           pt2         = gf.CreateCoordinateXY(0, 10);
            MgCoordinate           pt3         = gf.CreateCoordinateXY(10, 10);
            MgCoordinate           pt4         = gf.CreateCoordinateXY(10, 0);
            MgCoordinateCollection coordinates = new MgCoordinateCollection();

            coordinates.Add(pt1);
            coordinates.Add(pt2);
            coordinates.Add(pt3);
            coordinates.Add(pt4);
            MgLinearSegment          linearSegment = gf.CreateLinearSegment(coordinates);
            MgCurveSegmentCollection curveSegments = new MgCurveSegmentCollection();

            curveSegments.Add(linearSegment);
            MgCurveRing    outerRing = gf.CreateCurveRing(curveSegments);
            MgCurvePolygon cp        = gf.CreateCurvePolygon(outerRing, null);

            Assert.AreEqual(outerRing.ToString(), cp.ExteriorRing.ToString());
            Assert.AreEqual(0, cp.InteriorRingCount);
            Assert.AreEqual(MgGeometryType.CurvePolygon, cp.GeometryType);
            Assert.AreEqual(2, cp.Dimension);
        }
예제 #16
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgStringProperty sp = new MgStringProperty("TestStringName", "TestStringValue");

            Assert.AreEqual("TestStringValue", sp.Value);
            Assert.AreEqual("TestStringName", sp.Name);
        }
예제 #17
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgDeleteFeatures df = new MgDeleteFeatures("dfClassName", "dfFilterText");

            Assert.AreEqual("dfClassName", df.FeatureClassName);
            Assert.AreEqual("dfFilterText", df.FilterText);
        }
예제 #18
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            ByteReaderTestData.Init();
            var nBytes      = ByteReaderTestData.nBytes;
            var nBlocks     = ByteReaderTestData.nBlocks;
            var testBytes   = ByteReaderTestData.testBytes;
            var infileName  = ByteReaderTestData.infileName;
            var outfileName = ByteReaderTestData.outfileName;

            byte[]       buf    = new byte[nBytes];
            MgByteReader reader = new MgByteReader(infileName, "png", false);

            Assert.AreEqual(nBlocks * nBytes, reader.GetLength());
            reader.Read(buf, nBytes);
            Assert.AreEqual(buf, testBytes);
            Assert.AreEqual((nBlocks - 1) * nBytes, reader.GetLength());
            reader.Rewind();
            Assert.AreEqual(nBlocks * nBytes, reader.GetLength());
            reader.ToFile(outfileName);
            reader.Rewind();

            byte[] buf2             = new byte[nBytes];
            System.IO.FileStream fp = System.IO.File.OpenRead(outfileName);
            for (int j = 0; j < nBlocks; j++)
            {
                fp.Read(buf2, 0, nBytes);
                reader.Read(buf, nBytes);
                Assert.AreEqual(buf, buf2);
            }
            fp.Close();
        }
예제 #19
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgLayerGroup lg = new MgLayerGroup("TestLayerGroupName");

            Assert.AreEqual("TestLayerGroupName", lg.Name);
            Assert.AreEqual(MgLayerGroupType.Normal, lg.LayerGroupType);

            lg.Group = new MgLayerGroup("AnotherTestLayerGroupName");
            Assert.AreEqual("AnotherTestLayerGroupName", lg.Group.Name);

            lg.Visible = true;
            Assert.IsTrue(lg.Visible);
            lg.Visible = false;
            Assert.IsFalse(lg.Visible);

            lg.DisplayInLegend = true;
            Assert.IsTrue(lg.DisplayInLegend);
            lg.DisplayInLegend = false;
            Assert.IsFalse(lg.DisplayInLegend);

            Assert.IsFalse(lg.ExpandInLegend);

            lg.LegendLabel = "TestLegendLabel";
            Assert.AreEqual("TestLegendLabel", lg.LegendLabel);
        }
예제 #20
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgFileFeatureSourceParams csp = new MgFileFeatureSourceParams();

            csp.ProviderName = "OSGeo.SDF";
            Assert.AreEqual("OSGeo.SDF", csp.ProviderName);

            csp.SpatialContextName = "TestSpatialContextName";
            Assert.AreEqual("TestSpatialContextName", csp.SpatialContextName);

            csp.SpatialContextDescription = "TestSpatialContextDescription";
            Assert.AreEqual("TestSpatialContextDescription", csp.SpatialContextDescription);

            csp.CoordinateSystemWkt = "TestCoordSysWkt";
            Assert.AreEqual("TestCoordSysWkt", csp.CoordinateSystemWkt);

            csp.XYTolerance = 0.0001;
            Assert.AreEqual(0.0001, csp.XYTolerance);

            csp.ZTolerance = 0.01;
            Assert.AreEqual(0.01, csp.ZTolerance);

            MgFeatureSchema schema = new MgFeatureSchema("SchemaName", "SchemaDescription");

            csp.FeatureSchema = schema;
            Assert.AreEqual(schema.Name, csp.FeatureSchema.Name);
            Assert.AreEqual(schema.Description, csp.FeatureSchema.Description);
        }
예제 #21
0
        public Settings(string name, string configFile, Func<string, bool> fileExists, string baseDirectory, ITestLogger logger)
        {
            Name = name;
            Logger = logger;

            try
            {
                Directory = Path.GetDirectoryName(configFile);
                SettingsFile = configFile;
                Json.PopulateFromFile(SettingsFile, this);

                Name = Name ?? name;
                BatchInterval = BatchInterval ?? 250;

                if (AreValid)
                {
                    LogDirectory = GetFullPath(LogDirectory ?? "");
                    if (LogToFile)
                    {
                        logger.AddLogger(LogFilePath);
                    }
                }
                else
                {
                    LogDirectory = "";
                    LogToFile = false;
                }
            }
            catch (Exception ex)
            {
                _validator.Validate(false, "Could not read settings: {0}", ex.Message);
                logger.Error(ex, "Could not read settings");
            }
        }
예제 #22
0
 public static void AddLogger(this ITestLogger logger, ITestLogger childLogger)
 {
     if (logger != null)
     {
         logger.AddLogger(l => l == childLogger, () => childLogger);
     }
 }
예제 #23
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            string tmp = Path.GetTempFileName();

            try
            {
                File.WriteAllText(tmp, "Hello World");

                MgByteSource bs     = new MgByteSource(tmp);
                MgByteReader reader = bs.GetReader();

                MgGeometryProperty gp      = new MgGeometryProperty("GeomPropName", reader);
                MgByteSource       bs2     = new MgByteSource("../../TestData/DrawingService/SpaceShip.dwf");
                MgByteReader       reader2 = bs2.GetReader();

                gp.Value = reader2;
                Assert.AreEqual(reader2.GetLength(), gp.Value.GetLength());

                Assert.AreEqual(MgPropertyType.Geometry, gp.PropertyType);
            }
            finally
            {
                try
                {
                    File.Delete(tmp);
                }
                catch { }
            }
        }
예제 #24
0
        /// <summary>
        /// Executes the Unit Test
        /// </summary>
        /// <param name="logger">The logger.</param>
        public void Test(ITestLogger logger)
        {
            Logger = logger;
            var timer = new TestActionTimer(logger);

            LoadConfigurationSettingsOnce(this);
            InitializeEntityIds();
            if (EntityIdsByLogicalName != null && EntityIdsByLogicalName.Count > 0)
            {
                timer.Time(PopulateEntityReferences, "Initialization Entity Reference (ms): ");
            }
            using (var internalService = GetInternalOrganizationServiceProxy())
            {
                // ReSharper disable once AccessToDisposedClosure
                timer.Time(() => CleanupTestData(internalService, false), "Cleanup PreTestData (ms): ");

                try
                {
                    // ReSharper disable once AccessToDisposedClosure
                    timer.Time(() => AssumedEntities = AssumedEntities.Load(internalService, GetType()), "Load Assumptions (ms): ");

                    var service = GetIOrganizationService();
                    AssertCrm = new AssertCrm(service);

                    timer.Time(() => InitializeTestData(service), "Initialize TestData (ms): ");
                    timer.Time(() => Test(service), "Run Test (ms): ");
                }
                finally
                {
                    // ReSharper disable once AccessToDisposedClosure
                    timer.Time(() => CleanupTestData(internalService, true), "Cleanup PostTestData (ms): ");
                }
            }
        }
예제 #25
0
 private async Task<int> DiscoverTests(TestSourceSettings settings, ITestLogger logger, ITestCaseDiscoverySink discoverySink)
 {
     logger = new TestLogger(logger, settings.Name, "Discover");
     var count = 0;
     var tests = new ConcurrentBag<Guid>();
     if (settings.Port > 0)
     {
         logger.Debug("Start");
         var discoverCommand = new DiscoverCommand(settings.Port);
         await discoverCommand.Run(spec =>
         {
             var testCase = CreateTestCase(settings, spec);
             tests.Add(testCase.Id);
             discoverySink.SendTestCase(testCase);
             count += 1;
         });
         await new RequestRunCommand(settings.Port).Run(tests);
         logger.Debug("Complete: {0} tests", count);
     }
     else
     {
         logger.Error("Not connected to {0}", TestAdapterInfo.Name);
     }
     return count;
 }
예제 #26
0
        public void SaveTestRun(
            Guid buildId,
            Guid suiteRunId,
            string suiteType,
            string testName,
            string clientConfig,
            string serverConfig,
            string backendType,
            int executionTimeSecs,
            string status,
            string log,
            bool isRepeated)
        {
            ITestLogger logger = (ITestLogger)
                                 Activator.GetObject(typeof(ITestLogger), mServerLoggerUrl);

            logger.SaveTestRun(
                buildId,
                suiteRunId,
                suiteType,
                testName,
                clientConfig,
                serverConfig,
                backendType,
                executionTimeSecs,
                status,
                log,
                isRepeated);
        }
예제 #27
0
        public Guid SaveBuild(string type, string name, string changeset, string comment)
        {
            ITestLogger logger = (ITestLogger)
                                 Activator.GetObject(typeof(ITestLogger), mServerLoggerUrl);

            return(logger.SaveBuild(type, name, changeset, comment));
        }
예제 #28
0
        public bool CheckConnection()
        {
            ITestLogger logger = (ITestLogger)
                                 Activator.GetObject(typeof(ITestLogger), mServerLoggerUrl);

            return(logger.CheckConnection());
        }
예제 #29
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgPropertyCollection coll     = new MgPropertyCollection();
            MgDoubleProperty     dblProp  = new MgDoubleProperty("DoubleProp", 1.1111);
            MgInt32Property      intProp  = new MgInt32Property("IntProp", 1);
            MgDateTime           dateTime = new MgDateTime(2006, 9, 21);
            MgDateTimeProperty   dateProp = new MgDateTimeProperty("DateProp", dateTime);
            MgSingleProperty     single   = new MgSingleProperty("SingleProp", (float)2.2222);

            coll.Add(dblProp);
            coll.Add(intProp);
            coll.Add(dateProp);
            coll[2] = single;

            Assert.AreEqual(1.1111, (coll[0] as MgDoubleProperty).GetValue());
            Assert.AreEqual(MgPropertyType.Double, coll[0].GetPropertyType());
            Assert.AreEqual(MgPropertyType.Int32, coll[1].GetPropertyType());
            Assert.AreEqual(MgPropertyType.Single, coll[2].GetPropertyType());
            Assert.AreEqual((float)2.2222, (coll[2] as MgSingleProperty).GetValue());
            Assert.AreEqual(3, coll.Count);

            Assert.AreEqual(MgPropertyType.Double, coll[0].GetPropertyType());

            string str = "";

            foreach (MgProperty prop in coll)
            {
                str = str + "[" + prop.GetName() + "]";
            }
            Assert.AreEqual("[DoubleProp][IntProp][SingleProp]", str);
        }
예제 #30
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgDataPropertyDefinition dpd = new MgDataPropertyDefinition("DataPropDefName");

            dpd.DataType = MgPropertyType.Int32;
            Assert.AreEqual(MgPropertyType.Int32, dpd.DataType);

            dpd.Length = 0;
            Assert.AreEqual(0, dpd.Length);

            dpd.Precision = 0;
            Assert.AreEqual(0, dpd.Precision);

            dpd.Scale = 0;
            Assert.AreEqual(0, dpd.Scale);

            dpd.DefaultValue = "123";
            Assert.AreEqual("123", dpd.DefaultValue);

            dpd.Nullable = true;
            Assert.IsTrue(dpd.Nullable);

            dpd.ReadOnly = false;
            Assert.IsFalse(dpd.ReadOnly);
        }
예제 #31
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgFeatureProperty fp = new MgFeatureProperty("FeatureProp", null);

            Assert.AreEqual("FeatureProp", fp.Name);
            Assert.AreEqual(MgPropertyType.Feature, fp.PropertyType);
            Assert.IsNull(fp.Value);
        }
예제 #32
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgSingleProperty sp = new MgSingleProperty("SinglePropName", 4.251973f);

            Assert.AreEqual("SinglePropName", sp.Name);
            Assert.AreEqual(MgPropertyType.Single, sp.PropertyType);
            Assert.AreEqual(4.251973f, sp.Value);
        }
예제 #33
0
        public void Execute(IPlatformFactory factory, ITestLogger logger)
        {
            MgRasterProperty rp = new MgRasterProperty("RasterPropName", null);

            Assert.AreEqual("RasterPropName", rp.Name);
            Assert.AreEqual(MgPropertyType.Raster, rp.PropertyType);
            Assert.IsNull(rp.Value);
        }
 public JasmineServer(Settings settings, ITestLogger logger)
     : base(logger)
 {
     if (!settings.AreValid)
     {
         throw new ArgumentException("Settings are not valid", "settings");
     }
     Settings = settings;
 }
예제 #35
0
 public GTestRunner(ITestLogger logger, bool async = true)
 {
     _async = async;
     _logger = logger;
     _worker = new BackgroundWorker();
     _worker.WorkerSupportsCancellation = true;
     _worker.DoWork += WorkerDoWork;
     _worker.RunWorkerCompleted += WorkerCompleted;
 }
예제 #36
0
        public IEnumerable<ITestSuite> ConvertToGTest(TestCase[] cases, ITestLogger logger)
        {
            logger.Information("Converting Visual Studio TestCases to TestSuite");
            Dictionary<string, ITestSuite> testSuites = new Dictionary<string, ITestSuite>();

            foreach (var testCase in cases)
            {
                logger.Information(string.Format("Processing TestCase {0}", testCase.FullyQualifiedName));
                if (!testSuites.ContainsKey(testCase.Source))
                {
                    logger.Information(string.Format("No existing source for {0}.  Creating one...", testCase.Source));
                    testSuites[testCase.Source] = _factory.BuildTestSuite(testCase.Source, testCase.Source);
                }

                ITestSuite suite = testSuites[testCase.Source];

                string[] splits = testCase.FullyQualifiedName.Split('.');
                string caseName = splits[0];
                string testName = splits[1];

                logger.Information(string.Format("Searching for test case {0}...", caseName));

                ITestCase foundCase = null;
                foreach (var @case in suite.TestCases)
                {
                    if (@case.Name == caseName)
                    {
                        logger.Information(string.Format("Found test case {0}.", caseName));
                        foundCase = @case;
                    }
                }
                if (foundCase == null)
                {
                    logger.Information(string.Format("Did not find test case {0}.  Creating it now...", caseName));
                    foundCase = _factory.BuildTestCase(suite, caseName);
                    suite.AddTestCase(foundCase);
                }

                logger.Information(string.Format("Adding test {0}...", testName));
                foundCase.AddTest(_factory.BuildTest(foundCase, testName));
            }

            logger.Information("Preparing conversion result...");
            var suites = testSuites.Values;

            logger.Information(string.Format("Conversion complete.  Converted {0} suites.", suites.Count));
            return suites;
        }
예제 #37
0
        public KarmaSettings(string name, string configFile, Func<string, bool> fileExists, string baseDirectory, ITestLogger logger)
        {
            HasSettingsFile = false;
            Name = name;
            Logger = logger;

            try
            {
                Directory = Path.GetDirectoryName(configFile);
                SettingsFile = GetFullPath(Globals.SettingsFilename);
                KarmaConfigFile = GetFullPath(Globals.KarmaConfigFilename);

                if (PathUtils.PathHasFileName(configFile, Globals.SettingsFilename))
                {
                    Json.PopulateFromFile(configFile, this);
                    KarmaConfigFile = string.IsNullOrWhiteSpace(KarmaConfigFile) ? GetFullPath(Globals.KarmaConfigFilename) : GetFullPath(KarmaConfigFile);
                    _validator.Validate(fileExists(SettingsFile), "Settings file not found: {0}", PathUtils.GetRelativePath(baseDirectory, SettingsFile));
                    _validator.Validate(fileExists(KarmaConfigFile), "Karma configuration file not found: {0}", PathUtils.GetRelativePath(baseDirectory, KarmaConfigFile));
                    HasSettingsFile = true;
                }
                else
                {
                    KarmaConfigFile = GetFullPath(configFile);
                    _validator.Validate(fileExists(KarmaConfigFile), "Karma configuration file not found: {0}", PathUtils.GetRelativePath(baseDirectory, KarmaConfigFile));
                }

                Name = Name ?? name;

                if (AreValid)
                {
                    LogDirectory = GetFullPath(LogDirectory ?? "");
                    if (LogToFile)
                    {
                        logger.AddLogger(LogFilePath);
                    }
                }
                else
                {
                    LogDirectory = "";
                    LogToFile = false;
                }
            }
            catch (Exception ex)
            {
                _validator.Validate(false, "Could not read settings: {0}", ex.Message);
                logger.Error(ex, "Could not read settings");
            }
        }
예제 #38
0
        public int RunTests(string testName, ITestLogger logger, ref int testsRun)
        {
            TestResult actualResult = null;
            int exitStatus = 0;
            try
            {
                //Add the test in the log file
                string msg = "\n\n************************************************************\n" +
                             string.Format("Executing {0}\n", testName) +
                             "************************************************************\n\n";

                logger.Write(msg);

                //Get the list of operations to be executed for this test. This list should comma separated, no spaces.
                _unitTestVm.Execute("Select ParamSets from TestCase where TestName=\"{0}\"", testName);
                string sets = _unitTestVm.GetString("ParamSets");

                //Extract the paramset ids
                int[] paramSet = sets.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => Convert.ToInt32(x)).ToArray();
                foreach (int paramSetId in paramSet)
                {
                    _unitTestVm.Execute("Select ParamValue from Params where ParamSet={0} AND ParamName=\"OPERATION\"", paramSetId);
                    string paramValue = _unitTestVm.GetString("ParamValue");

                    testsRun++;

                    //Add the operation to the log file
                    AddLogFileEntry(logger, paramValue, paramSetId, _unitTestResultVm);

                    var exec = _executors.GetTestExecutor(paramValue);
                    actualResult = exec.Execute(paramSetId);

                    exitStatus += _executors.ValidateRequest(_unitTestDb, testName, paramSetId, paramValue, actualResult, logger);
                }

                return exitStatus;
            }
            catch (MgException ex)
            {
                throw new UnitTestException(string.Format("Exception from MapGuide:\n{0}", ex.GetDetails()));
            }
        }
        protected TestContainerDiscoverer(
            IServiceProvider serviceProvider,
            ITestsService testsService,
            TestSettingsProvider testSettingsProvider,
            ITestLogger logger
            )
        {
            Logger = logger;
            try
            {
                TestSettingsProvider = testSettingsProvider;
                TestAdapterInfo = CreateTestAdapterInfo();

                Containers = new TestContainerList(this);

                ServiceProvider = serviceProvider;
                _testsService = testsService;

                SolutionListener = new SolutionListener(serviceProvider);
                SolutionListener.SolutionLoaded += OnSolutionLoaded;
                SolutionListener.SolutionUnloaded += OnSolutionUnloaded;
                SolutionListener.ProjectChanged += OnSolutionProjectChanged;
                SolutionListener.StartListening();

                ProjectListener = new ProjectListener(serviceProvider, Logger);
                ProjectListener.FileAdded += (source, e) => OnProjectFileAdded(e.Project, e.File);
                ProjectListener.FileRemoved += (source, e) => OnProjectFileRemoved(e.Project, e.File);
                ProjectListener.FileRenamed += (source, e) => OnProjectFileRenamed(e.Project, e.OldFile, e.NewFile);
                ProjectListener.StartListening();

                RunScheduler = new Scheduler(250, RunTestsInternal);
                RefreshTestContainersScheduler = new Scheduler<string>(250, RefreshTestContainersInternal);

                Logger.Debug("TestContainerDiscoverer created");
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw;
            }
        }
예제 #40
0
        public GTestRunOutputParser(ITestSuite testSuite, ITestLogger logger)
        {
            _expectedTests = new Dictionary<string, ITest>();
            foreach (var testCase in testSuite.TestCases)
            {
                foreach (var test in testCase.Tests)
                {
                    var runName = GTestNameFormatter.GetRunName(test);
                    if (!_expectedTests.ContainsKey(runName))
                    {
                        _expectedTests.Add(GTestNameFormatter.GetRunName(test), test);
                    }
                    else
                    {
                        logger.Warning(string.Format("Seem to have multiple test cases with the same name... Skipping {0}", runName));
                    }
                }
            }

            _currentTestRun = new StringBuilder();
            _logger = logger;
        }
예제 #41
0
        private static void AddLogFileEntry(ITestLogger logger, string operation, int paramSetId, SqliteVm vm)
        {
            logger.Write("\nParamSet: {0}\n", paramSetId);
            int status = vm.Execute("Select * from Params where ParamSet={0}", paramSetId);

            while (status == Sqlite.Row)
            {
                string paramName = vm.GetString("ParamName");
                string paramValue = vm.GetString("ParamValue");

                logger.Write("{0}: {1}\n", paramName, paramValue);
                status = vm.NextRow();
            }
        }
예제 #42
0
        public override int ValidateRequest(SqliteDotNet.SqliteDb db, string testName, int paramSetId, string operation, TestResult actualResult, ITestLogger logger)
        {
            int exitStatus = 0;
            string outcome = "pass";
            SqliteVm vm = new SqliteVm(db, false);

            object expectedResult = null;

            //If we have an exception we need to remove the stack trace because different line numbers will fail the test
            object resultData = CommonUtility.RemoveStackTraceFromResult(actualResult.ResultData);
            //Get the mime type based on the content type in the result
            string mimeType = actualResult.ContentType;
            //If we have exception message we need to remove any parts that may contain system dependent information
            //Ex. file paths
            resultData = CommonUtility.ProcessExceptionMessage(resultData);
            //Get the file extension that will be used for a dump
            string actualExtension = CommonUtility.GetExtensionFromMimeType(mimeType);

            //If we have an ALWAYSPASS parameter defined for the operation then skip the whole validation process
            //This parameter should only be used for clean up operations that are no related with the tests
            if (vm.Execute("Select ParamValue from Params where ParamName=\"ALWAYSPASS\" and ParamSet={0}", paramSetId) != Sqlite.Row)
            {
                //TestName is Test_[ServiceType]
                string type = testName.Substring(testName.IndexOf("_") + 1);
                string filePath = CommonUtility.GetPath(string.Format("../../TestData/{0}/DumpFiles/{0}ApiTest", type));
                string fileName = string.Format("{0}_{1}.{2}", filePath, paramSetId, actualExtension);

                if (this.TestExecutionMode == "dump")
                {
                    //File.WriteAllText(fileName, resultData);
                    throw new NotImplementedException("The .net test runner does not support dumping of test results. Please use the PHP test runner for this purpose");
                }
                else
                {
                    //This section is special case handling for the operations that return different data after each call
                    resultData = CommonUtility.SpecialDataHandling(operation, resultData, mimeType);

                    if (this.TestExecutionMode == "generate")
                    {
                        throw new NotImplementedException("The .net test runner does not support test update/generation. Please use the PHP test runner for this purpose");
                        /*
                        //Get the sample result that is stored in the database. If we are using file on disk for validation
                        //then do not overwrite the filename in the database
                        //To distinguish between sample data and filename all filenames should be prefixed with "@@"
                        int status = vm.Execute("Select Result from ApiTestResults where ParamSet={0}", paramSetId);
                        string sampleResult = vm.GetString("Result");

                        if (!sampleResult.StartsWith("@@"))
                        {
                            //Insert the sample data as a BLOB
                            //Update the row for that param set or create a new row if we do not have it yet

                            string responseBody = "";
                            if (status == Sqlite.Row)
                            {
                                vm.Prepare("update ApiTestResults set Result = :blob where ParamSet={0}", paramSetId);
                            }
                            else
                            {
                                Console.WriteLine("A new row has been created in ApiTestResults table to store the result for operation {0}", paramSetId);
                                Console.WriteLine("Please update the description field for that row later");
                                vm.Prepare("INSERT INTO ApiTestResults(ParamSet, Result) VALUES({0}, :blob)", paramSetId);
                            }

                            byte[] bytes = Encoding.UTF8.GetBytes(resultData);
                            vm.BindBlob(":blob", bytes);
                            vm.Execute();

                            if (mimeType != null)
                            {
                                vm.Execute("UPDATE ApiTestResults SET ContentType=\"{0}\" WHERE ParamSet={1}", mimeType, paramSetId);
                            }

                            File.WriteAllText(fileName, resultData);
                        }
                         */
                    }
                    else if (this.TestExecutionMode == "validate" || this.TestExecutionMode == "show")
                    {
                        string resultContent = "";

                        //Get the sample result and the expected content type from the database
                        int status = vm.Execute("Select Result, ContentType from ApiTestResults where ParamSet={0}", paramSetId);
                        string expectedContentType = vm.GetString("ContentType");
                        string expectedExtension = CommonUtility.GetExtensionFromMimeType(expectedContentType);
                        SqliteGcBlob blob = vm.GetBlob("Result");

                        byte[] b = blob.Read();
                        if (b != null)
                        {
                            if (expectedExtension == "xml" || expectedExtension == "txt" || expectedExtension == "html")
                                expectedResult = Encoding.UTF8.GetString(b);
                            else
                                expectedResult = b;
                        }
                        else
                        {
                            if (expectedExtension == "xml" || expectedExtension == "txt" || expectedExtension == "html")
                                expectedResult = string.Empty;
                            else
                                expectedResult = null;
                        }
                        string strExpectedResult = expectedResult as string;
                        //If we are validating from a file then get the contents of that file
                        //File names should be prefixed with "@@" to distinguish them from BLOB data
                        if (strExpectedResult != null && strExpectedResult.StartsWith("@@"))
                        {
                            string sampleDataFile = strExpectedResult.Substring(2);
                            sampleDataFile = CommonUtility.GetPath(sampleDataFile);
                            expectedResult = File.ReadAllText(sampleDataFile);
                        }

                        if (this.TestExecutionMode == "validate")
                        {
                            bool bEqual = false;
                            byte[] bExpected = expectedResult as byte[];
                            byte[] bActual = resultData as byte[];
                            string strResultData = resultData as string;

                            //FIXME: We're not processing DWF content properly to do this check properly. So just
                            //pass these for now
                            if (operation == "GETDRAWINGLAYER" || operation == "GETDRAWINGSECTION")
                            {
                                bEqual = true;
                            }
                            else
                            {
                                if (strExpectedResult != null && strResultData != null)
                                {
                                    bEqual = strResultData.Equals(strExpectedResult, StringComparison.InvariantCultureIgnoreCase);
                                }
                                else if (bExpected != null && bActual != null)
                                {
                                    bEqual = CommonUtility.ByteArraysEqual(bExpected, bActual, operation, testName);
                                }
                                else
                                {
                                    System.Diagnostics.Debug.WriteLine(string.Format("[MgTestRunner]: {0} - {1} - Encountered disparate data types between expected and actual results. Expecting test failure :(", testName, operation));
                                }
                            }
                            //If the results are different and special validation fails then the operation failed ->mark it red
                            if (!bEqual && !CommonUtility.SpecialValidation(operation, resultData, expectedResult))
                            {
                                outcome = "fail";
                                exitStatus = 1;

                                if (expectedExtension != "xml" && expectedExtension != "html" && expectedExtension != "txt")
                                {
                                    expectedResult = "Unable to display binary data";
                                }

                                if (actualExtension != "xml" && actualExtension != "html" && actualExtension != "txt")
                                {
                                    resultData = "Unable to display binary data";
                                }
                            }
                        }
                        else
                        {
                            throw new NotImplementedException("The .net test runner does not support the given test execution mode (" + this.TestExecutionMode + "). Please use the PHP test runner for this purpose");
                            /*
                            type = testName.Substring(testName.IndexOf("_") + 1);
                            string showPath = CommonUtility.GetPath(string.Format("../../TestData/{0}/ShowFiles/{0}ApiTest", type));
                            string showName = string.Format("{0}_{1}.{2}", showPath, paramSetId, actualExtension);
                            File.WriteAllText(showName, expectedResult);
                             */
                        }
                    }
                }
            }

            if (outcome == "fail")
            {
                Console.WriteLine("****{0} {1} {2} failed.\n", testName, paramSetId, operation);
                string str = string.Format("\n****ACTUAL RESULT****\n{0}\n****EXPECTED RESULT****\n{1}\n********\n\n\n", resultData, expectedResult);
                //Console.WriteLine(str);
                //Console.WriteLine("<FAIL>");
                logger.Write(str);
            }

            vm.SqlFinalize();
            vm = null;

            return exitStatus;
        }
예제 #43
0
 public static bool HasLogger(this ITestLogger logger, ITestLogger childLogger)
 {
     return logger.HasLogger<ITestLogger>(l => l == childLogger);
 }
 public FakeIOrganizationService(IOrganizationService service, ITestLogger logger)
     : base(service)
 {
     Timer = new TestActionTimer(logger);
     RedirectExecuteRequestsToOrganizationServiceRequest = true;
 }
예제 #45
0
 public ITestRunner BuildRunner(ITestLogger logger)
 {
     return new GTestRunner(logger);
 }
예제 #46
0
        public int Execute(ref int testsRun, ITestLogger logger, bool isEnterprise)
        {
            int exitStatus = 0;
            string dbPath = CommonUtility.GetDbPath(this.DumpFile);
            string dbName = CommonUtility.GetPath(dbPath);

            if (File.Exists(dbName))
            {
                var db = new SqliteDb();
                db.Open(dbName);

                var vm = new SqliteVm(db, true);

                int status = vm.Execute("Select TestName, TestType from TestCase where TestType=\"{0}\" order by ExecuteSequence", this.ApiType);

                //NOTE: We can't share the SqliteVm instance among our executor objects as this messes up query results
                //we must be able to re-create a new SqliteVm for each executor, so we pass down the db path
                SetupExecutors(dbName);

                while (status == Sqlite.Row)
                {
                    string testName = vm.GetString("TestName");
                    string testType = vm.GetString("TestType");

                    Console.WriteLine("Executing {0} test: {1}", testType, testName);
                    using (var run = new TestExecutionRun(dbPath, this))
                    {
                        try
                        {
                            exitStatus += run.RunTests(testName, logger, ref testsRun);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                            exitStatus += 1;
                        }
                    }
                    status = vm.NextRow();
                }
                vm.SqlFinalize();
                vm = null;
                db = null;
            }
            return exitStatus;
        }
예제 #47
0
 public TestServerLogger(ITestLogger logger, params string[] context)
     : base(logger, context)
 {
 }
예제 #48
0
 public void RequestRun(ITestCase cCase, ITestLogger logger)
 {
     TestCount = cCase.Tests.Length;
     TestsCompleted = 0;
     TestsFailed = 0;
     TestsIgnored = 0;
     TestsPassed = 0;
     GTestRunner runner = new GTestRunner(logger);
     runner.TestCompleted += RunnerOnTestCompleted;
     runner.RunCompleted += RunnerOnRunCompleted;
     runner.Run(cCase);
 }
        public void Test(ITestLogger logger)
        {
            Logger = logger;
            var timer = new TestActionTimer(logger);
            LoadConfigurationSettingsOnce(this);
            InitializeEntityIds();
            if (EntityIds != null && EntityIds.Count > 0)
            {
                timer.Time(PopulateEntityReferences, "Initialization Entity Reference (ms): ");
            }
            using (var internalService = GetInternalOrganizationServiceProxy())
            {
                // ReSharper disable once AccessToDisposedClosure
                timer.Time(() => CleanupTestData(internalService, false), "Cleanup PreTestData (ms): ");

                try
                {
                    // ReSharper disable once AccessToDisposedClosure
                    timer.Time(() => ValidateAssumptions(internalService), "Validate Assumptions (ms): ");

                    var service = GetIOrganizationService();
                    AssertCrm = new AssertCrm(service);

                    timer.Time(() => InitializeTestData(service), "Initialize TestData (ms): ");
                    timer.Time(() => Test(service), "Run Test (ms): ");
                }
                finally
                {
                    // ReSharper disable once AccessToDisposedClosure
                    timer.Time(() => CleanupTestData(internalService, true), "Cleanup PostTestData (ms): ");
                }
            }
        }
        public void SetUp()
        {
            _rootSuiteName = "C:\\Program Files\\NUnit 2.2.9\\bin\\mock-assembly.dll";
            _passingTestName = "NUnit.Tests.Assemblies.MockTestFixture.MockTest1";

            _logger = MockRepository.GenerateMock<IMessageLogger>();
            _suiteLogger = MockRepository.GenerateMock<ITestSuiteMessageLogger>();
            _testLogger = MockRepository.GenerateMock<ITestLogger>();
            _logger.Stub(x => x.WriteTestSuiteStarted(Arg<string>.Is.Anything)).Return(_suiteLogger);
            _suiteLogger.Stub(x => x.WriteTestStarted(Arg<string>.Is.Anything)).Return(_testLogger);
            _subject = new NunitMessageProcessor(_logger);
        }
 public KarmaServerTestLogger(ITestLogger logger)
     : base(logger)
 {
 }
예제 #52
0
 public BaseFixture()
 {
     Logger = new TestKarmaLogger(message => Console.WriteLine("[{0:0.0}] {1}", Elapsed, message));
 }
예제 #53
0
 public ProjectListener([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, ITestLogger logger)
 {
     ValidateArg.NotNull(serviceProvider, "serviceProvider");
     _projectDocTracker = serviceProvider.GetService(typeof(SVsTrackProjectDocuments)) as IVsTrackProjectDocuments2;
     Logger = new TestLogger(logger, "ProjectListener");
 }
예제 #54
0
 public static void RemoveLogger(this ITestLogger logger, ITestLogger childLogger)
 {
     logger.RemoveLogger<ITestLogger>(l => l == childLogger);
 }
예제 #55
0
 public void RequestRun(ITest test, ITestLogger logger)
 {
     TestCount = 1;
     TestsCompleted = 0;
     TestsFailed = 0;
     TestsIgnored = 0;
     TestsPassed = 0;
     GTestRunner runner = new GTestRunner(logger);
     runner.TestCompleted += RunnerOnTestCompleted;
     runner.RunCompleted += RunnerOnRunCompleted;
     runner.Run(test);
 }
예제 #56
0
 public void Add(ITestLogger log)
 {
     children.Add(log);
 }
예제 #57
0
        public void RequestRun(ITestSuite suite, ITestLogger logger)
        {
            int testCount = 0;
            foreach (var testCase in suite.TestCases)
            {
                testCount += testCase.Tests.Length;
            }
            TestCount = testCount;
            TestsCompleted = 0;
            TestsFailed = 0;
            TestsIgnored = 0;
            TestsPassed = 0;

            GTestRunner runner = new GTestRunner(logger);
            runner.TestCompleted += RunnerOnTestCompleted;
            runner.RunCompleted += RunnerOnRunCompleted;
            runner.Run(suite);
        }
예제 #58
0
 private async Task<int> RunTests(TestSourceSettings settings, ITestLogger logger, IRunContext runContext, IFrameworkHandle frameworkHandle)
 {
     logger = new TestLogger(logger, settings.Name, "Run");
     var count = 0;
     if (settings.Port > 0)
     {
         logger.Debug("Start");
         var discoverCommand = new DiscoverCommand(settings.Port);
         await discoverCommand.Run(spec =>
         {
             RunTest(settings, logger, runContext, frameworkHandle, spec);
             count += 1;
         });
         logger.Debug("Complete: {0} tests", count);
     }
     else
     {
         logger.Error("Not connected to {0}", TestAdapterInfo.Name);
     }
     return count;
 }
예제 #59
0
 public abstract int ValidateRequest(SqliteDb db, string testName, int paramSetId, string operation, TestResult actualResult, ITestLogger logger);
예제 #60
0
        private void RunTest(TestSourceSettings settings, ITestLogger logger, IRunContext runContext, IFrameworkHandle frameworkHandle, Spec spec)
        {
            var testCase = CreateTestCase(settings, spec);
            var outcome = TestOutcome.None;

            frameworkHandle.RecordStart(testCase);
            foreach (var result in spec.Results)
            {
                if (result.Skipped && outcome != TestOutcome.Failed)
                {
                    outcome = TestOutcome.Skipped;
                }

                if (result.Success && outcome == TestOutcome.None)
                {
                    outcome = TestOutcome.Passed;
                }

                if (!result.Success && !result.Skipped)
                {
                    outcome = TestOutcome.Failed;
                }

                frameworkHandle.RecordResult(GetResult(testCase, result, frameworkHandle));
            }
            frameworkHandle.RecordEnd(testCase, outcome);
        }