private void SetProperCenter()
 {
     if (!User_CenterChanged.HasValue)
     {
         return;
     }
     if (User_CenterChanged.Value)
     {
         Center = (LatLon)CenterConverter.ConvertBack(MainMap.Center, typeof(LatLon), null, null);
     }
     else
     {
         MainMap.Center = (Geopoint)CenterConverter.Convert(Center, typeof(Geopoint), null, null);
     }
     User_CenterChanged = null;
 }
        public void ConvertTest(object value)
        {
            var converterGroup = new ValueConverterGroup();

            converterGroup.Add(new MockConverter());
            converterGroup.Add(new MockConverter());
            converterGroup.Add(new MockConverter());

            var result = converterGroup.Convert(value, typeof(string), null, CultureInfo.CurrentCulture);

            var correctValue = $"{MockConverter.Tag}{MockConverter.Tag}{MockConverter.Tag}{value.ToString()}";

            Assert.AreEqual(correctValue, result);
        }
Beispiel #3
0
        public void TautologyTest(bool?input)
        {
            // Arrange
            var group = new ValueConverterGroup();

            group.Converters.Add(new InverseBooleanConverter());
            group.Converters.Add(new InverseBooleanConverter());

            // Act
            var result     = group.Convert(input, typeof(bool), null, CultureInfo.CurrentCulture);
            var resultBack = group.ConvertBack(result, typeof(bool), null, CultureInfo.CurrentCulture);

            // Assert
            Assert.AreEqual(input, result);
            Assert.AreEqual(input, resultBack);
        }
        public void ConvertList(object value)
        {
            var expectedResult = value.ToString();

            for (var i = 0; i < 10; i++)
            {
                var c = new MockConverter(i);
                converter.Add(c);

                expectedResult = string.Format(MockConverter.TagFormat, i) + expectedResult;
            }

            var actualResult = converter.Convert(value, typeof(string), null, CultureInfo.CurrentCulture);

            Assert.AreEqual(expectedResult, actualResult);
        }