Esempio n. 1
0
        public void when_defining_fully_qualified_return_then_replace_namespace()
        {
            var solution = CreateSolution(@"
		using System;

		namespace ClassLibrary1 
		{
			public class Class1 
			{
				public Android.Arch.Lifecycle.ViewModelProviders Method()
				{
					return null;
				}
			}
		}"        );

            var methodFixer = new TypeRewriter(resolver, new NullProgress());

            solution = methodFixer.Visit(solution, GetFirstDocument(solution));

            var root = GetText(solution);

            Assert.Contains("AndroidX.Lifecycle.ViewModelProviders", root);
            Assert.DoesNotContain("Android.Arch.Lifecycle.ViewModelProviders", root);
        }
Esempio n. 2
0
        public void when_defining_attribute_then_replace_attribute_name()
        {
            var solution = CreateSolution(@"
		using System;

		namespace ClassLibrary1 
		{
			[Android.Support.V17.Leanback.Widget.Visibility]
			public class Class1 
			{
			}
		}"        );

            var methodFixer = new TypeRewriter(resolver, new NullProgress());

            solution = methodFixer.Visit(solution, GetFirstDocument(solution));

            var root = GetText(solution);

            Assert.Contains("AndroidX.Leanback.Widget.Visibility", root);
            Assert.DoesNotContain("Android.Support.V17.Leanback.Widget.Visibility", root);
        }
        public void when_defining_aliased_namespaces_then_fully_qualify_if_needed()
        {
            var solution = CreateSolution(@"
		using System;
		using support = Android.Support;

		namespace ClassLibrary1 
		{
			public class MainActivity : support.V7.App.AppCompatActivity 
			{
			}
		}"        );

            var methodFixer = new SemanticRewriter(resolver, new NullProgress());
            var typeFixer   = new TypeRewriter(resolver, new NullProgress());

            solution = methodFixer.Visit(solution, GetFirstDocument(solution));
            solution = typeFixer.Visit(solution, GetFirstDocument(solution));

            var root = GetText(solution);

            Assert.Contains(": AndroidX.AppCompat.App.AppCompatActivity", root);
            Assert.DoesNotContain(": support.V7.App.AppCompatActivity", root);
        }