Example #1
0
        public AlbumsModelTests(ITestOutputHelper output)
        {
            this.output = output;
            this.albumsModel = AlbumsModel.GetInstance();

            TestUtil.InitDatabase();
        }
Example #2
0
 public ConfigTests(ITestOutputHelper output)
 {
     this.output = output;
     LogManager.UnInitialize();
     GrainClient.Uninitialize();
     GrainClient.TestOnlyNoConnect = false;
 }
        public WebApplicationProxyFixture(PrecompilerFixture fixture, ITestOutputHelper helper)
        {
            _Fixture = fixture;

              _testHelper = helper;
              _testHelper.WriteLine("Target folder: " + WebApplicationProxy.WebRootFolder);
        }
 public RemoteMigrationsFacts(ITestOutputHelper logHelper)
 {
     _logHelper = logHelper;
     _mockLogger = new MockLogger(logHelper);
     _migrator = new EfMigrator(PostgresFactConstants.DdlPath, PostgresFactConstants.ConfigName, PostgresFactConstants.AppConfig,
         PostgresFactConstants.InstanceConnectionString, PostgresFactConstants.ConnectionProvider, _mockLogger);
 }
		public JsonRpcIntegrationTestBase(ITestOutputHelper output) {
			this.output = output;

			var configs = new JsonRpcServerConfigurations() {
				BindingPort = port, //Interlocked.Increment(ref port),
				TransportProtocol = JsonRpcServerConfigurations.TransportMode.Bson
			};

			server = new JsonRpcServer<TestActionHandler>(configs);

			client = JsonRpcClient<TestActionHandler>.CreateClient("localhost", server.Configurations.BindingPort, JsonRpcServerConfigurations.TransportMode.Bson);
			client.Info.Username = "******";

			client.OnAuthenticationRequest += (sender, e) => {
				e.Data = AUTH_TEXT;
			};

			server.OnAuthenticationVerification += (sender, e) => {
				e.Authenticated = true;
			};

			server.OnStop += (sender, e) => {
				wait.Set();
			};
		}
Example #6
0
        public SocketTestClient(
            ITestOutputHelper log,
            string server,
            int port,
            int iterations,
            string message,
            Stopwatch timeProgramStart)
        {
            _log = log;

            _server = server;
            _port = port;
            _endpoint = new DnsEndPoint(server, _port);

            _sendString = message;
            _sendBuffer = Encoding.UTF8.GetBytes(_sendString);

            _bufferLen = _sendBuffer.Length;
            _recvBuffer = new byte[_bufferLen];

            _timeProgramStart = timeProgramStart;

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) // on Unix, socket will be created in Socket.ConnectAsync
            {
                _timeInit.Start();
                _s = new Socket(SocketType.Stream, ProtocolType.Tcp);
                _timeInit.Stop();
            }

            _iterations = iterations;
        }
 public CuratedFeedTest(ITestOutputHelper testOutputHelper)
     : base(testOutputHelper)
 {
     _commandlineHelper = new CommandlineHelper(TestOutputHelper);
     _clientSdkHelper = new ClientSdkHelper(TestOutputHelper);
     _packageCreationHelper = new PackageCreationHelper(TestOutputHelper);
 }
Example #8
0
 public GenerateTasksFileTests(ITestOutputHelper output)
 {
     sourceFile = Path.GetTempFileName();
     tasksName = Path.GetFileNameWithoutExtension(Path.GetTempFileName());
     inlineTask = Path.GetTempFileName();
     buildEngine = new MockBuildEngine(output);
 }
Example #9
0
        public SendPacketsAsync(ITestOutputHelper output)
        {
            _log = TestLogging.GetInstance();

            byte[] buffer = new byte[s_testFileSize];

            for (int i = 0; i < s_testFileSize; i++)
            {
                buffer[i] = (byte)(i % 255);
            }

            try
            {
                _log.WriteLine("Creating file {0} with size: {1}", TestFileName, s_testFileSize);
                using (FileStream fs = new FileStream(TestFileName, FileMode.CreateNew))
                {
                    fs.Write(buffer, 0, buffer.Length);
                }
            }
            catch (IOException)
            {
                // Test payload file already exists.
                _log.WriteLine("Payload file exists: {0}", TestFileName);
            }
        }
        internal static bool AreEqual(ITestOutputHelper testOutputHelper, Type sourceType, Type targetType, CastResult compilerResult, CastResult castResult, CastFlag expectedCastFlag)
        {
            if (compilerResult.IsSuccessful == true && castResult.IsSuccessful == false)
            {
                // Let's assert the details if the compiler generates a successful result
                // but the CastTo method does not the same.

                var castFlagsAreEqual = compilerResult.CastFlag == castResult.CastFlag || castResult.CastFlag == CastFlag.Implicit;
                if (!castFlagsAreEqual)
                {
                    testOutputHelper.WriteLine("CastFlags of conversion between {0} and {1} are not equal." + Environment.NewLine +
                        "Expected CastFlag: {2}" + Environment.NewLine +
                        "Resulted CastFlag: {3}" + Environment.NewLine,
                        sourceType.GetFormattedName(),
                        targetType.GetFormattedName(),
                        expectedCastFlag,
                        castResult.CastFlag);
                    return false;
                }

                var valuesAreNotEqual = compilerResult.CastFlag == castResult.CastFlag && !Equals(compilerResult.Value, castResult.Value);
                if (valuesAreNotEqual)
                {
                    testOutputHelper.WriteLine("Result of {0} conversion between {1} and {2} are not equal.",
                        expectedCastFlag == CastFlag.Implicit ? "implicit" : "explicit",
                        sourceType.GetFormattedName(),
                        targetType.GetFormattedName());

                    return false;
                }
            }

            return true;
        }
Example #11
0
        public static Output Ignore(ITestOutputHelper testOutputHelper)
        {
            if (ignore == null)
                ignore = new Output(testOutputHelper, "Ignore");

            return ignore;
        }
Example #12
0
        public HarvestPackageTests(ITestOutputHelper output)
        {
            _log = new Log(output);
            _engine = new TestBuildEngine(_log);

            _frameworks = new[]
            {
                CreateFrameworkItem("netcoreapp1.0", "win7-x86;win7-x64;osx.10.11-x64;centos.7-x64;debian.8-x64;linuxmint.17-x64;opensuse.13.2-x64;rhel.7.2-x64;ubuntu.14.04-x64;ubuntu.16.04-x64"),
                CreateFrameworkItem("netcoreapp1.1", "win7-x86;win7-x64;osx.10.11-x64;centos.7-x64;debian.8-x64;linuxmint.17-x64;opensuse.13.2-x64;rhel.7.2-x64;ubuntu.14.04-x64;ubuntu.16.04-x64"),

                CreateFrameworkItem("netcore50", "win10-x86;win10-x86-aot;win10-x64;win10-x64-aot;win10-arm;win10-arm-aot"),
                CreateFrameworkItem("netcore45", ""),
                CreateFrameworkItem("netcore451", ""),

                CreateFrameworkItem("net45", ";win-x86;win-x64"),
                CreateFrameworkItem("net451", ";win-x86;win-x64"),
                CreateFrameworkItem("net46", ";win-x86;win-x64;win7-x86;win7-x64"),
                CreateFrameworkItem("net461", ";win-x86;win-x64;win7-x86;win7-x64"),
                CreateFrameworkItem("net462", ";win-x86;win-x64;win7-x86;win7-x64"),
                CreateFrameworkItem("net463", ";win-x86;win-x64;win7-x86;win7-x64"),

                CreateFrameworkItem("wpa81", ""),
                CreateFrameworkItem("wp8", ""),
                CreateFrameworkItem("MonoAndroid10", ""),
                CreateFrameworkItem("MonoTouch10", ""),
                CreateFrameworkItem("xamarinios10", ""),
                CreateFrameworkItem("xamarinmac20", ""),
                CreateFrameworkItem("xamarintvos10", ""),
                CreateFrameworkItem("xamarinwatchos10", "")
            };
        }
 public OrleansTaskSchedulerAdvancedTests_Set2(ITestOutputHelper output)
 {
     this.output = output;
     OrleansTaskSchedulerBasicTests.InitSchedulerLogging();
     context = new UnitTestSchedulingContext();
     masterScheduler = TestInternalHelper.InitializeSchedulerForTesting(context);
 }
        public TaskAppServiceTests(ITestOutputHelper output)
        {
            this.output = output;

            this._taskAppService = Resolve<ITaskAppService>();
            this._userAppService = Resolve<ITaskeverUserAppService>();
        }
Example #15
0
 /// <summary>
 /// Executes package restore and builds the test solution.
 /// </summary>
 /// <param name="scenarioName">The name of the scenario to build. If omitted, it will be the name of the calling method.</param>
 /// <param name="packageId">The leaf name of the project to be built or rebuilt, and the package ID to return after the build.</param>
 /// <param name="properties">Build properties to pass to MSBuild.</param>
 /// <returns>The single built package, or the package whose ID matches <paramref name="packageId"/>.</returns>
 public static async Task<IPackage> RestoreAndBuildSinglePackageAsync([CallerMemberName] string scenarioName = null, string packageId = null, IDictionary<string, string> properties = null, ITestOutputHelper testLogger = null)
 {
     var packages = await RestoreAndBuildPackagesAsync(scenarioName, packageId, properties, testLogger);
     return packageId == null
             ? packages.Single()
             : packages.Single(p => string.Equals(p.Id, packageId, StringComparison.OrdinalIgnoreCase));
 }
        public ServerDisasterRecoveryConfigurationTests(ITestOutputHelper output)
        {
            var logger = new XunitTracingInterceptor(output);
            XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));

            helper.TracingInterceptor = logger;
        }
Example #17
0
        public BulkheadSpecsHelper(ITestOutputHelper testOutputHelper)
        {
#if !DEBUG 
            testOutputHelper = new SilentOutput();
#endif
            this.testOutputHelper = testOutputHelper;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RegisterAzureProviderCmdletTests"/> class.
        /// </summary>
        public RegisterAzureProviderCmdletTests(ITestOutputHelper output)
        {
            this.providerOperationsMock = new Mock<IProvidersOperations>();
            XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
            var resourceManagementClient = new Mock<IResourceManagementClient>();

            resourceManagementClient
                .SetupGet(client => client.Providers)
                .Returns(() => this.providerOperationsMock.Object);

            this.commandRuntimeMock = new Mock<ICommandRuntime>();

            this.commandRuntimeMock
              .Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>()))
              .Returns(() => true);

            this.cmdlet = new RegisterAzureProviderCmdlet()
            {
                ResourceManagerSdkClient = new ResourceManagerSdkClient
                {
                    ResourceManagementClient = resourceManagementClient.Object
                }
            };

            PSCmdletExtensions.SetCommandRuntimeMock(cmdlet, commandRuntimeMock.Object);
            mockRuntime = new MockCommandRuntime();
            commandRuntimeMock.Setup(f => f.Host).Returns(mockRuntime.Host);
        }
        protected GalleryTestBase(ITestOutputHelper testOutputHelper)
        {
            TestOutputHelper = testOutputHelper;

            // suppress SSL validation for *.cloudapp.net
            ServicePointManagerInitializer.InitializeServerCertificateValidationCallback();
        }
 public XunitTestLogger(ITestOutputHelper outputHelper, Config config) : base(entry =>
 {
     if (config.Verbose || entry.Severity != Severity.Debug)
         LogEntryWriter.Write(entry, outputHelper);
 })
 {
 }
Example #21
0
 public BasicTests(ITestOutputHelper logger)
 {
     this.logger = logger;
     this.nuproj = Assets.FromTemplate()
                         .AssignNuProjDirectory()
                         .ToProject();
 }
Example #22
0
 protected PersistenceSpec(Config config = null, ITestOutputHelper output = null)
     : base(config, output)
 {
     _name = NamePrefix + "-" + _counter.GetAndIncrement();
     Clean = new Cleanup(this);
     Clean.Initialize();
 }
Example #23
0
        public IntegrationTest(ITestOutputHelper writer)
        {
            if (File.Exists(output))
                File.Delete(output);

            this.writer = writer;
        }
        public OutputLogger(ITestOutputHelper testOutputHelper)
        {
            if (testOutputHelper == null)
                throw new ArgumentNullException(nameof(testOutputHelper));

            this.testOutputHelper = testOutputHelper;
        }
 public NugetCommandLineTests(ITestOutputHelper testOutputHelper)
     : base(testOutputHelper)
 {
     _clientSdkHelper = new ClientSdkHelper(testOutputHelper);
     _commandlineHelper = new CommandlineHelper(testOutputHelper);
     _packageCreationHelper = new PackageCreationHelper(testOutputHelper);
 }
Example #26
0
        public CXsltSettings(ITestOutputHelper output) : base(output)
        {
            // Make sure that we don't cache the value of the switch to enable testing
            AppContext.SetSwitch("TestSwitch.LocalAppContext.DisableCaching", true);

            _output = output;
        }
Example #27
0
        /// <summary>
        /// Builds a project.
        /// </summary>
        /// <param name="projectPath">The absolute path to the project.</param>
        /// <param name="targetsToBuild">The targets to build. If not specified, the project's default target will be invoked.</param>
        /// <param name="properties">The optional global properties to pass to the project. May come from the <see cref="MSBuild.Properties"/> static class.</param>
        /// <returns>A task whose result is the result of the build.</returns>
        public static async Task<BuildResultAndLogs> ExecuteAsync(string projectPath, string[] targetsToBuild = null, IDictionary<string, string> properties = null, ITestOutputHelper testLogger = null)
        {
            targetsToBuild = targetsToBuild ?? new string[0];

            var logger = new EventLogger();
            var logLines = new List<string>();
            var parameters = new BuildParameters
            {
                Loggers = new List<ILogger>
                {
                    new ConsoleLogger(LoggerVerbosity.Detailed, logLines.Add, null, null),
                    new ConsoleLogger(LoggerVerbosity.Minimal, v => testLogger?.WriteLine(v.TrimEnd()), null, null),
                    logger,
                },
            };

            BuildResult result;
            using (var buildManager = new BuildManager())
            {
                buildManager.BeginBuild(parameters);
                try
                {
                    var requestData = new BuildRequestData(projectPath, properties ?? Properties.Default, null, targetsToBuild, null);
                    var submission = buildManager.PendBuildRequest(requestData);
                    result = await submission.ExecuteAsync();
                }
                finally
                {
                    buildManager.EndBuild();
                }
            }

            return new BuildResultAndLogs(result, logger.LogEvents, logLines);
        }
Example #28
0
        public FlowTakeSpec(ITestOutputHelper helper) : base(helper)
        {
            var settings = ActorMaterializerSettings.Create(Sys).WithInputBuffer(2, 16);
            Materializer = ActorMaterializer.Create(Sys, settings);

            MuteDeadLetters(typeof(OnNext), typeof(OnComplete), typeof(RequestMore));
        }
        public MigratorFacts(ITestOutputHelper logHelper)
        {
            _logHelper = logHelper;
            _mockLogger = new MockLogger(logHelper);

            _logHelper.WriteLine($"Using connectionString: {_instanceString}");
        }
 public CSharpExampleFileTests(ITestOutputHelper output)
 {
     _output = output;
     var subject = new CSharpLexer();
     _results = subject.GetTokens(SampleFile.Load("csharp-sample.txt"))
         .ToArray();
 }
Example #31
0
 protected TransportTestsSuite(ITestOutputHelper output) : base(output)
 {
 }
Example #32
0
 public RavenDB_15792(ITestOutputHelper output) : base(output)
 {
 }
        private const int DELAY_UNTIL_INDEXES_ARE_UPDATED_LAZILY = 1000; //one second delay for writes to the in-memory indexes should be enough

        public StorageManagedIndexingTests(Fixture fixture, ITestOutputHelper output)
        {
            this.output = output;
        }
Example #34
0
 public IntExtensionsTests(ITestOutputHelper output) : base(output)
 {
 }
Example #35
0
 public ExpressionTests (ITestOutputHelper outputHelper) {
     this.output = outputHelper;
     var context = TestDbContext.UseSqlite ();
     UserQuery = context.Users;
 }
Example #36
0
 public GeneralPayloadTests(ITestOutputHelper output)
 {
     this.logger = output;
 }
 public ElidingArtifactContentCacheWrapperTests(ITestOutputHelper output)
     : base(output)
 {
 }
Example #38
0
 //--- Constructors ---
 public CompareTo(ITestOutputHelper output) => Output = output;
 public GlobalLabelsTests(ITestOutputHelper xUnitOutputHelper)
     : base(xUnitOutputHelper,
            envVarsToSetForSampleAppPool: new Dictionary <string, string>
 {
     { ConfigConsts.EnvVarNames.GlobalLabels, GlobalLabelsToRawOptionValue(CustomGlobalLabels) }
 }) =>
Example #40
0
 public OwnedQuerySqlServerTest(OwnedQuerySqlServerFixture fixture, ITestOutputHelper testOutputHelper)
     : base(fixture)
 {
     Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper);
 }
Example #41
0
        protected BaseEngineTest(ITestOutputHelper output)
            : base(output)
        {
            m_testOutput     = output;
            m_ignoreWarnings = OperatingSystemHelper.IsUnixOS; // ignoring /bin/sh is being used as a source file

            RegisterEventSource(global::BuildXL.Scheduler.ETWLogger.Log);
            RegisterEventSource(global::BuildXL.FrontEnd.Script.ETWLogger.Log);
            RegisterEventSource(global::BuildXL.FrontEnd.Core.ETWLogger.Log);
            RegisterEventSource(global::BuildXL.Engine.ETWLogger.Log);
            RegisterEventSource(global::BuildXL.Processes.ETWLogger.Log);

            ParseAndEvaluateLogger = Logger.CreateLogger();
            InitializationLogger   = InitializationLogger.CreateLogger();

            var pathTable = new PathTable();

            FileSystem = new PassThroughMutableFileSystem(pathTable);
            Context    = EngineContext.CreateNew(CancellationToken.None, pathTable, FileSystem);
            MainSourceResolverModules = new List <AbsolutePath>();

            var rootPath = AbsolutePath.Create(Context.PathTable, TestRoot);
            var logsPath = Combine(AbsolutePath.Create(Context.PathTable, TemporaryDirectory), "logs");

            Configuration = new CommandLineConfiguration()
            {
                DisableDefaultSourceResolver = true,
                Resolvers = new List <IResolverSettings>
                {
                    new SourceResolverSettings
                    {
                        Kind    = "SourceResolver",
                        Modules = MainSourceResolverModules,
                    },
                    new SourceResolverSettings
                    {
                        Kind    = "SourceResolver",
                        Modules = new List <AbsolutePath>
                        {
                            AbsolutePath.Create(Context.PathTable, Path.Combine(GetTestExecutionLocation(), "Sdk", "Prelude", "package.config.dsc")),
                            AbsolutePath.Create(Context.PathTable, Path.Combine(GetTestExecutionLocation(), "Sdk", "Transformers", "package.config.dsc")),
                            AbsolutePath.Create(Context.PathTable, Path.Combine(GetTestExecutionLocation(), "Sdk", "Deployment", "module.config.dsc")),
                        },
                    },
                },
                Layout =
                {
                    SourceDirectory = rootPath,
                    OutputDirectory = Combine(rootPath,                             "out"),
                    ObjectDirectory = Combine(rootPath,                             "obj"),
                    CacheDirectory  = Combine(AbsolutePath.Create(Context.PathTable, TemporaryDirectory), "cache"),
                },
                Cache =
                {
                    CacheSpecs       = SpecCachingOption.Disabled,
                    CacheLogFilePath = logsPath.Combine(Context.PathTable,PathAtom.Create(Context.StringTable,  "cache.log")),
                },
                Engine =
                {
                    ReuseEngineState        = false,
                    LogStatistics           = false,
                    TrackBuildsInUserFolder = false,
                },
                FrontEnd =
                {
                    MaxFrontEndConcurrency =     1,
                    LogStatistics          = false,
                },
                Schedule =
                {
                    MaxIO        = 1,
                    MaxProcesses = 1,
                },
                Sandbox =
                {
                    FileSystemMode      = FileSystemMode.RealAndMinimalPipGraph,
                    OutputReportingMode = OutputReportingMode.FullOutputOnError,
                },
                Logging =
                {
                    LogsDirectory     = logsPath,
                    LogStats          = false,
                    LogExecution      = false,
                    LogCounters       = false,
                    LogMemory         = false,
                    StoreFingerprints = false,
                    NoWarnings        =
                    {
                        909,     // Disable warnings about experimental feature
                    },
                }
            };

            if (TryGetSubstSourceAndTarget(out string substSource, out string substTarget))
            {
                // Directory translation is needed here particularly when the test temporary directory
                // is inside a directory that is actually a junction to another place.
                // For example, the temporary directory is D:\src\BuildXL\Out\Object\abc\t_1, but
                // the path D:\src\BuildXL\Out or D:\src\BuildXL\Out\Object is a junction to K:\Out.
                // Some tool, like cmd, can access the path in K:\Out, and thus the test will have a DFA
                // if there's no directory translation.
                // This problem does not occur when only substs are involved, but no junctions. The method
                // TryGetSubstSourceAndTarget works to get translations due to substs or junctions.
                AbsolutePath substSourcePath = AbsolutePath.Create(Context.PathTable, substSource);
                AbsolutePath substTargetPath = AbsolutePath.Create(Context.PathTable, substTarget);
                Configuration.Engine.DirectoriesToTranslate.Add(
                    new TranslateDirectoryData(I($"{substSource}<{substTarget}"), substSourcePath, substTargetPath));
            }

            AbsolutePath Combine(AbsolutePath parent, string name)
            {
                return(parent.Combine(Context.PathTable, PathAtom.Create(Context.StringTable, name)));
            }
        }
 public NorwegianNameGeneratorTest(ITestOutputHelper output)
 {
     this.output = output;
 }
Example #43
0
 protected CoreFormatterTestsBase(ITestOutputHelper output)
 => _output = output;
Example #44
0
 public AsyncPocoWrapperTest(ITestOutputHelper hlp)
 {
     _logger = hlp.WriteLine;
 }
Example #45
0
 protected WorkspaceServerTests(ITestOutputHelper output) : base(output)
 {
 }
Example #46
0
 public Converter(ITestOutputHelper output)
 {
     _output = output;
 }
Example #47
0
 public BrowserTestBase(BrowserFixture browserFixture, ITestOutputHelper output)
 {
     BrowserFixture = browserFixture;
     _output.Value  = output;
 }
Example #48
0
 public Issue571(ITestOutputHelper log)
 => _log = log;
Example #49
0
 public ClassWithAsyncLifetime_ThrowingDisposeAsync(ITestOutputHelper output) : base(output)
 {
 }
Example #50
0
 public GuidArgumentParsingTests(ITestOutputHelper outputHelper)
     : base(outputHelper)
 {
 }
Example #51
0
 public ClassWithAsyncLifetime_ThrowingCtor(ITestOutputHelper output)
     : base(output)
 {
     throw new DivideByZeroException();
 }
Example #52
0
 public ClassWithAsyncLifetime_FailingTest(ITestOutputHelper output) : base(output)
 {
 }
Example #53
0
            public ClassUnderTest(ITestOutputHelper output)
            {
                this.output = output;

                output.WriteLine("This is output in the constructor");
            }
Example #54
0
 public ClassWithAsyncLifetime_ThrowingInitializeAsync(ITestOutputHelper output) : base(output)
 {
 }
 public TestOutputAppender(ITestOutputHelper xunitTestOutputHelper)
 {
     _xunitTestOutputHelper = xunitTestOutputHelper;
     Name   = "TestOutputAppender";
     Layout = new PatternLayout("%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n");
 }
Example #56
0
            public ClassWithAsyncLifetime(ITestOutputHelper output)
            {
                this.output = output;

                output.WriteLine("Constructor");
            }
Example #57
0
 public ReceiveEventTests(ITestOutputHelper output)
     : base(output)
 {
 }
 public GivenThatWeWantToPublishAnUnpublishableProject(ITestOutputHelper log) : base(log)
 {
 }
 public PuppeteerLaunchTests(ITestOutputHelper output) : base(output)
 {
 }
Example #60
0
 public PythonImagesTest(ITestOutputHelper output) : base(output)
 {
 }