public void GeneratePattern_ExpectedDimensions(int seed, int width, int height, int numMarkers)
        {
            var random  = new Random(seed);
            var service = new InterferenceService();

            var pattern = service.Generate(random, width, height, numMarkers);

            Assert.NotNull(pattern);

            var display = pattern.ToString();

            Assert.NotNull(display);

            var displayLines = display.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

            Assert.Equal(height * 4 + 2, displayLines.Length);
            Assert.Equal(string.Empty, displayLines.Last());

            foreach (var line in displayLines.Take(displayLines.Length - 1))
            {
                Assert.Equal(width * 4 + 1, line.Length);
            }

            Assert.Equal(numMarkers, pattern.MarkerSequence.Count);
            Assert.Equal(numMarkers, pattern.SolutionSequence.Count);
            Assert.Equal(numMarkers, pattern.Arrows.Count);
        }
示例#2
0
 public void TestStatValueGetColor_TaExcessRate(double taExcessRate, string expectedColor)
 {
     _field.FieldName = "邻区距离分析";
     _service = new RuInterferenceTaService(_stat);
     _field.AutoGenerateIntervals(8);
     AsserOriginalColors();
     _stat.TaExcessRate = taExcessRate;
     string colorString = _service.GetColor(_field);
     Assert.AreEqual(colorString, expectedColor);
 }
        public void TestStatValueGetColor_TaExcessRate(double taExcessRate, string expectedColor)
        {
            _field.FieldName = "邻区距离分析";
            _service         = new RuInterferenceTaService(_stat);
            _field.AutoGenerateIntervals(8);
            AsserOriginalColors();
            _stat.TaExcessRate = taExcessRate;
            string colorString = _service.GetColor(_field);

            Assert.AreEqual(colorString, expectedColor);
        }
示例#4
0
 public void TestStatValueGetColor_InterferenceSource(double ratio, int victimCells,
     string expectedColor)
 {
     _field.FieldName = "干扰源分析";
     _service = new RuInterferenceSourceService(_stat);
     _field.AutoGenerateIntervals(8);
     AsserOriginalColors();
     _stat.InterferenceRatio = ratio;
     _stat.VictimCells = victimCells;
     string colorString = _service.GetColor(_field);
     Assert.AreEqual(colorString, expectedColor);
 }
示例#5
0
 public void TestStatValueGetColor_InterferenceDistance(double taAverage, double averageRtd,
     string expectedColor)
 {
     _field.FieldName = "干扰距离分析";
     _service = new RuInterferenceDistanceService(_stat);
     _field.AutoGenerateIntervals(8);
     AsserOriginalColors();
     _stat.TaAverage = taAverage;
     _stat.AverageRtd = averageRtd;
     string colorString = _service.GetColor(_field);
     Assert.AreEqual(colorString, expectedColor, "colorString");
 }
        public void TestStatValueGetColor_InterferenceDistance(double taAverage, double averageRtd,
                                                               string expectedColor)
        {
            _field.FieldName = "干扰距离分析";
            _service         = new RuInterferenceDistanceService(_stat);
            _field.AutoGenerateIntervals(8);
            AsserOriginalColors();
            _stat.TaAverage  = taAverage;
            _stat.AverageRtd = averageRtd;
            string colorString = _service.GetColor(_field);

            Assert.AreEqual(colorString, expectedColor, "colorString");
        }
        public void TestStatValueGetColor_InterferenceSource(double ratio, int victimCells,
                                                             string expectedColor)
        {
            _field.FieldName = "干扰源分析";
            _service         = new RuInterferenceSourceService(_stat);
            _field.AutoGenerateIntervals(8);
            AsserOriginalColors();
            _stat.InterferenceRatio = ratio;
            _stat.VictimCells       = victimCells;
            string colorString = _service.GetColor(_field);

            Assert.AreEqual(colorString, expectedColor);
        }
示例#8
0
        public void GeneratePattern(int seed, string expectedSequence, string expectedLayout)
        {
            var random  = new Random(seed);
            var service = new InterferenceService();

            var pattern = service.Generate(random, 4, 8, 6);

            Assert.NotNull(pattern);

            var display = pattern.ToString();

            Assert.NotNull(display);
            Assert.Equal(expectedLayout.Trim(), display.Trim());

            string actualSequence = string.Join(string.Empty, pattern.SolutionSequence);

            Assert.Equal(expectedSequence, actualSequence);
        }