Пример #1
0
        public void Validate()
        {
            var markups = new[] {
                new MarkupConfig(address, 0, 100, 20),
                new MarkupConfig(address, 80, 200, 20)
            };

            Assert.AreEqual("Некорректно введены границы цен.", MarkupConfig.Validate(markups)[0][1]);
            Assert.That(markups[1].BeginOverlap, Is.True);
        }
        public IList <MarkupConfig> MarkupByType(MarkupType type, Address currentddress)
        {
            var result = Settings.Value.Markups
                         .Where(t => t.Type == type && t.Address == currentddress)
                         .OrderBy(m => m.Begin)
                         .LinkTo(Settings.Value.Markups, i => Settings.Value.AddMarkup((MarkupConfig)i));

            MarkupConfig.Validate(result);
            return(result);
        }
Пример #3
0
        public void Validate_gap()
        {
            var markups = new[] {
                new MarkupConfig(address, 0, 100, 20),
                new MarkupConfig(address, 100, 200, 20),
                new MarkupConfig(address, 200, 1000, 20),
                new MarkupConfig(address, 0, 50, 20, MarkupType.VitallyImportant),
                new MarkupConfig(address, 50, 500, 20, MarkupType.VitallyImportant),
                new MarkupConfig(address, 500, 1000000, 20, MarkupType.VitallyImportant),
            };

            Assert.IsNull(MarkupConfig.Validate(markups));
        }
Пример #4
0
        public void Reset_validation_error()
        {
            var markups = new[] {
                new MarkupConfig(address, 0, 100, 20),
                new MarkupConfig(address, 80, 200, 20),
                new MarkupConfig(address, 0, 50, 20, MarkupType.VitallyImportant),
                new MarkupConfig(address, 50, 500, 20, MarkupType.VitallyImportant),
                new MarkupConfig(address, 500, 1000000, 20, MarkupType.VitallyImportant),
            };

            Assert.AreEqual("Некорректно введены границы цен.", MarkupConfig.Validate(markups)[0][1]);

            markups[1].Begin = 100;
            Assert.IsNull(MarkupConfig.Validate(markups));
            Assert.That(markups[1].BeginOverlap, Is.False);
        }