public void Paste()
        {
            var console = new UnitTestProvider(new List <string>
            {
                "p",
                "0",
                "ok"
            });

            var interactionProvider = new ConsoleInteractionProvider(console);

            interactionProvider.clipboard.Add(new MyDto()
            {
                Prop = "abc"
            });

            var myDto = new MyDto()
            {
                Prop = "test"
            };

            Assert.IsTrue(interactionProvider.EditObject(typeof(MyDto), myDto, out myDto));

            Assert.IsTrue(myDto.Prop == "abc");
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (int)ConfigSource;
         hashCode = (hashCode * 397) ^ (CustomDependencies != null ? CustomDependencies.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (GeneratorCustomDependencies != null ? GeneratorCustomDependencies.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FeatureLanguage != null ? FeatureLanguage.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BindingCulture != null ? BindingCulture.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (UnitTestProvider != null ? UnitTestProvider.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ StopAtFirstError.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)MissingOrPendingStepsOutcome;
         hashCode = (hashCode * 397) ^ AllowDebugGeneratedFiles.GetHashCode();
         hashCode = (hashCode * 397) ^ AllowRowTests.GetHashCode();
         hashCode = (hashCode * 397) ^ TraceSuccessfulSteps.GetHashCode();
         hashCode = (hashCode * 397) ^ TraceTimings.GetHashCode();
         hashCode = (hashCode * 397) ^ MinTracedDuration.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)StepDefinitionSkeletonStyle;
         hashCode = (hashCode * 397) ^ (AdditionalStepAssemblies != null ? AdditionalStepAssemblies.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Plugins != null ? Plugins.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ MarkFeaturesParallelizable.GetHashCode();
         hashCode = (hashCode * 397) ^ (SkipParallelizableMarkerForTags != null ? SkipParallelizableMarkerForTags.GetHashCode() : 0);
         return(hashCode);
     }
 }
Esempio n. 3
0
        private void ApplicationStartup(object sender, StartupEventArgs e)
        {
            var unitTestProvider = new UnitTestProvider();

            UnitTestSystem.RegisterUnitTestProvider(unitTestProvider);
            RootVisual = UnitTestSystem.CreateTestPage();
        }
Esempio n. 4
0
        public OpenCoverTask UseDotNet(string executablePath = null)
        {
            _testExecutable = executablePath;

            if (string.IsNullOrEmpty(_testExecutableArgs))
            {
                _testExecutableArgs = "test";
            }

            _provider = UnitTestProvider.DotnetCore;
            return(this);
        }
        public void UseUnitTestProvider(string unitTestProviderName)
        {
            if (unitTestProviderName.IsNullOrEmpty())
            {
                throw new ArgumentNullException();
            }

            if (UnitTestProvider.IsNotNullOrEmpty() && UnitTestProvider != unitTestProviderName)
            {
                throw new Exception("Unit test Provider already set.");
            }

            UnitTestProvider = unitTestProviderName;
        }
Esempio n. 6
0
        public static UIElement CreateTestPage()
        {
            UnitTestProvider.Register();

            var unitTestSettings = UnitTestSystem.CreateDefaultSettings();

            unitTestSettings.TestAssemblies.Clear();
            unitTestSettings.TestAssemblies.Add(typeof(xunit_silverlight.App).Assembly);
            unitTestSettings.TestAssemblies.Add(typeof(xunit.extensions_silverlight.App).Assembly);
            unitTestSettings.ShowTagExpressionEditor = true;
            unitTestSettings.SampleTags = new[] { "All", "XunitFixesTests", "SanityCheckTests" };

            return(UnitTestSystem.CreateTestPage(unitTestSettings));
        }
        public void AssignProperty()
        {
            var console = new UnitTestProvider(new List <string>
            {
                "1",                  // first property
                "argument for Prop1", // value for property
                "ok"                  // confirm
            });

            var interactionProvider = new ConsoleInteractionProvider(console);

            var args = new Args();

            Assert.IsTrue(interactionProvider.EditObject(typeof(Args), args, out args));

            Assert.AreEqual(args.Prop1, "argument for Prop1");
        }
        public void RenderServiceOverview()
        {
            var console = new UnitTestProvider(new List <string>
            {
                "1", // first service
                "1", // first method
                "x", // back to overview
                "x"  // exit overview
            });

            Container c = new Container();

            c.RegisterSingleton(typeof(MyService), typeof(MyService));

            var interactionProvider = new ConsoleInteractionProvider(console);

            interactionProvider.RenderServiceOverview(c);
        }
        public void Copy()
        {
            var console = new UnitTestProvider(new List <string>
            {
                "c",
                "0",
                "ok"
            });

            var interactionProvider = new ConsoleInteractionProvider(console);

            var args = new Args {
                Prop1 = "test"
            };

            Assert.IsTrue(interactionProvider.EditObject(typeof(Args), args, out args));

            Assert.IsTrue(((Args)interactionProvider.clipboard[0]).Prop1 == "test");
        }
        public void InvokeMethodWithParameter()
        {
            var console = new UnitTestProvider(new List <string>
            {
                "2",   // second method
                "1",   // first property of parameter type
                "abc", // value for property
                "ok",  // confirm changes on object
                "x"    //
            });

            var interactionProvider = new ConsoleInteractionProvider(console);

            var myService = new MyService();

            interactionProvider.RenderService(typeof(MyService), myService);

            Assert.IsTrue(myService.TestParamValue == "abc");
        }
Esempio n. 11
0
        public static UIElement CreateTestPage()
        {
            UnitTestProvider.Register();

            var unitTestSettings = UnitTestSystem.CreateDefaultSettings();

            unitTestSettings.TestAssemblies.Clear();
            unitTestSettings.TestAssemblies.Add(typeof(xunit_silverlight.XunitFixesTests).Assembly);
            unitTestSettings.TestAssemblies.Add(typeof(xunit.extensions_silverlight.XunitFixesTests).Assembly);
            unitTestSettings.ShowTagExpressionEditor = true;
            unitTestSettings.SampleTags = new[] { "All", "XunitFixesTests", "SanityCheckTests" };

            foreach (var logProvider in unitTestSettings.LogProviders)
            {
                if (logProvider is DebugOutputProvider)
                {
                    ((DebugOutputProvider)logProvider).ShowEverything = true;
                }
            }

            return(UnitTestSystem.CreateTestPage(unitTestSettings));
        }
        public static string ToName(this UnitTestProvider unitTestProvider)
        {
            switch (unitTestProvider)
            {
            case UnitTestProvider.SpecRunWithNUnit: return("SpecRun+NUnit");

            case UnitTestProvider.SpecRunWithNUnit2: return("SpecRun+NUnit.2");

            case UnitTestProvider.SpecRunWithMsTest: return("SpecRun+MsTest");

            case UnitTestProvider.MSTest: return("MSTest");

            case UnitTestProvider.NUnit2: return("NUnit2");

            case UnitTestProvider.NUnit3: return("NUnit");

            case UnitTestProvider.xUnit: return("XUnit");

            case UnitTestProvider.SpecRun: return("SpecRun");

            default: throw new ArgumentOutOfRangeException(nameof(unitTestProvider), unitTestProvider, "value is not known");
            }
        }
Esempio n. 13
0
 private void ApplicationStartup(object sender, StartupEventArgs e)
 {
     var unitTestProvider = new UnitTestProvider();
     UnitTestSystem.RegisterUnitTestProvider(unitTestProvider);
     RootVisual = UnitTestSystem.CreateTestPage();
 }
        private string GetOptionsId()
        {
            var hashCode = 0;

            unchecked
            {
                hashCode = (hashCode * 397) ^ FeatureFileCount;
                hashCode = (hashCode * 397) ^ ScenarioPerFeatureFileCount;
                hashCode = (hashCode * 397) ^ StepDefPerClassCount;
                hashCode = (hashCode * 397) ^ StepDefinitionPerStepPercent;
                hashCode = (hashCode * 397) ^ ScenarioOutlinePerScenarioPercent;
            }
            var result = new StringBuilder();

            if (CreatedFor != null)
            {
                var createdForPath = ToPath(CreatedFor);
                if (createdForPath.Length > 8)
                {
                    var hash = (createdForPath.GetHashCode() % 1000).ToString().TrimStart('-');
                    createdForPath = createdForPath.Substring(0, 3) + hash + createdForPath.Substring(createdForPath.Length - 2, 2);
                }
                result.Append(createdForPath);
                result.Append('_');
            }
            result.Append($"{SpecFlowPackageVersion}_");
            result.Append($"{UnitTestProvider.ToLowerInvariant()}_");
            if (NewProjectFormat)
            {
                result.Append("nprj_");
            }
            if (TargetFramework != DefaultTargetFramework)
            {
                result.Append($"{TargetFramework}_");
            }
            if (PlatformTarget != null)
            {
                result.Append($"{PlatformTarget}_");
            }
            if (AddGeneratorPlugin || AddRuntimePlugin)
            {
                result.Append($"plug");
                result.Append("(");
                if (AddGeneratorPlugin)
                {
                    result.Append("g");
                }
                if (AddRuntimePlugin)
                {
                    result.Append("r");
                }
                result.Append(")_");
            }
            if (AddExternalBindingPackage)
            {
                result.Append($"extbnd_");
            }
            if (AddUnicodeBinding)
            {
                result.Append("unic_");
            }
            if (AddAsyncStep)
            {
                result.Append("async_");
            }
            if (IsBuilt)
            {
                result.Append("bt_");
            }

            result.Append(hashCode.ToString().TrimStart('-'));

            return(result.ToString());
        }
Esempio n. 15
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     UnitTestProvider.Register();
     RootVisual = UnitTestSystem.CreateTestPage();
 }
 public TestFileExplorer(UnitTestProvider provider, IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager)
 {
   _manager = manager;
   _psiModuleManager = psiModuleManager;
   _cacheManager = cacheManager;