public DataLakeStoreFileSystemManagementHelper(TestBase testBase) { this.testBase = testBase; resourceManagementClient = this.testBase.GetResourceManagementClient(); dataLakeStoreManagementClient = this.testBase.GetDataLakeStoreManagementClient(); dataLakeStoreFileSystemClient = this.testBase.GetDataLakeStoreFileSystemManagementClient(); }
public DataLakeAnalyticsManagementHelper(TestBase testBase) { this.testBase = testBase; resourceManagementClient = this.testBase.GetResourceManagementClient(); storageManagementClient = this.testBase.GetStorageManagementClient(); dataLakeStoreManagementClient = this.testBase.GetDataLakeStoreManagementClient(); }
public Page(TestBase testBase) { //Telerik = testBase.Telerik; utilsList.Add(testBase.WebDriver); utilsList.Add(testBase.KeyBoardSimulator); //utilsList.Add(testBase.DialogHandler); utilsList.Add(testBase.DBValidation); }
/// <summary> /// Initializes a new instance of the LiveReference class. /// </summary> /// <param name="test">Reference to the executing test class.</param> /// <param name="element">Element to add to the testing surface.</param> public LiveReference(TestBase test, UIElement element) { _test = test; Assert.IsNotNull(_test); Assert.IsNotNull(_test.TestPanel); Element = element; _test.TestPanel.Children.Add(Element); }
public void TestTryGetPropertyNotFound() { var target = new TestBase(); IPropertyData data; var result = target.TryGetProperty("NotFound", out data); Assert.AreEqual(false, result); Assert.IsNull(data); }
public DataLakeAnalyticsCatalogManagementHelper(TestBase testBase) { this.testBase = testBase; resourceManagementClient = ClientManagementUtilities.GetResourceManagementClient(this.testBase); dataLakeStoreManagementClient = ClientManagementUtilities.GetDataLakeStoreManagementClient(this.testBase); dataLakeAnalyticsManagementClient = ClientManagementUtilities.GetDataLakeAnalyticsManagementClient(this.testBase); dataLakeAnalyticsJobManagementClient = ClientManagementUtilities.GetDataLakeAnalyticsJobManagementClient(this.testBase); }
public void TestInheritedPageTypeDiscovery() { var target = new TestBase(); IPropertyData data; var hasTopElement = target.TryGetElement("Button", out data); var hasProperty = target.TryGetProperty("Name", out data); var hasBaseClassProperty = target.TryGetProperty("HiddenProperty", out data); Assert.AreEqual(true, hasTopElement); Assert.AreEqual(true, hasProperty); Assert.AreEqual(false, hasBaseClassProperty); }
private void CreateAccounts() { var test = new TestBase(); _documentService.Save(test.Build.A<Account>(a => a.NameSlug = "Amory-Blaine")); var liam = new Account { FirstName = "Liam", LastName = "McLennan", Email = "*****@*****.**", TimeZoneInfoId = "E. Australia Standard Time", Password = "******" }; liam.SetNameSlug(); _documentService.Save(liam); }
/// <summary> /// Initialize a new FileSystemHelper to a specific directory. /// </summary> /// <param name="testInstance"> /// Reference to the test class (to access its logging). /// </param> /// <param name="rootPath">The rootPath directory.</param> public FileSystemHelper(TestBase testInstance, string rootPath) { Debug.Assert(testInstance != null); Debug.Assert(!string.IsNullOrEmpty(rootPath)); TestInstance = testInstance; // Set the directory and create it if necessary. RootPath = rootPath; if (!Directory.Exists(rootPath)) { Log("Creating directory {0}", rootPath); Directory.CreateDirectory(rootPath); } }
static void Main(string[] args) { TestBase[] array = new TestBase[3]; array[0] = new HasValueProperty(); array[1] = new AlsoHasValueProperty(); array[2] = new DoesntHaveValueProperty(); foreach (TestBase myClass in array) { Type t = myClass.GetType(); Console.WriteLine("Type name : {0}", t.FullName); PropertyInfo pi = t.GetProperty("Value"); if (pi == null) continue; pi.SetValue(myClass, t.FullName, null); } Console.WriteLine("array[0] : {0}", ((HasValueProperty) array[0]).Value); Console.WriteLine("array[1] : {0}", ((AlsoHasValueProperty) array[1]).Value); // Console.WriteLine("array[2] : {0}", ((DoesntHaveValueProperty) array[2]).Value); // commented here for the sake to highlight that I haven't forgotten it Console.WriteLine("Press any key to exit ... "); Console.ReadKey(); }
public void TestWaitForPageToBeActiveCallsNativeInterface() { var targetClass = new InheritedActivateClass(); var target = new TestBase(targetClass); target.WaitForPageToBeActive(); Assert.IsTrue(targetClass.ActiveCheck); }
static void Main(string[] args) { string FileType = args[0]; int count = Convert.ToInt32(args[1]); //тут передаем количество данных которые хотим сгенерировать StreamWriter writer = new StreamWriter(args[2]); //куда мы хотим записывать (args[1])-потому что не указываем конкретное имяфайла, абудем указывать его все время разное при запуске string format = args[3]; List <GroupData> groups = new List <GroupData>();//создаем список List <ContactData> contacts = new List <ContactData>(); if (FileType == "group") { for (int i = 1; i < count; i++) { groups.Add((new GroupData(TestBase.GenerateRandomString(10)) { Header = TestBase.GenerateRandomString(10), Footer = TestBase.GenerateRandomString(10) })); /* contacts.Add((new ContactData(TestBase.GenerateRandomString(10), TestBase.GenerateRandomString(10)) * { * Address = TestBase.GenerateRandomString(50), * * })); */ } if (format == "scv") { WriteGroupdToCsvFile(groups, writer); //WriteContactsToCsvFile(contacts, writer); } else if (format == "xml") { WriteGroupsToXMLFile(groups, writer); // WriteContactsToXMLFile(contacts, writer); } else if (format == "json") { WriteGroupsToJsonFile(groups, writer); } // WriteGroupdToCsvFile(groups,writer); // WriteContactsToCsvFile(contacts, writer); writer.Close(); } if (FileType == "contact") { for (int i = 1; i < count; i++) { contacts.Add((new ContactData(TestBase.GenerateRandomString(10), TestBase.GenerateRandomString(10)) { Address = TestBase.GenerateRandomString(50), })); } if (format == "scv") { WriteContactsToCsvFile(contacts, writer); } else if (format == "xml") { WriteContactsToXMLFile(contacts, writer); } else if (format == "json") { WriteContactsToJsonFile(contacts, writer); } // WriteGroupdToCsvFile(groups,writer); // WriteContactsToCsvFile(contacts, writer); writer.Close(); } }
public void TestSetPropertySetsPropertyValue() { var page = new InheritedClass(); var target = new TestBase(page); IPropertyData data; var result = target.TryGetProperty("Name", out data); Assert.AreEqual(true, result); // Set the property value via the action data.FillData("Dan"); Assert.AreEqual("Dan", page.Name); }
/// <summary> /// Default constructor for management clients, using the TestSupport Infrastructure /// </summary> /// <param name="testBase">the test class</param> /// <returns>A storage management client, created from the current context (environment variables)</returns> public static StorageManagementClient GetStorageManagementClient(this TestBase testBase, MockContext context) { return(context.GetServiceClient <StorageManagementClient>()); }
/// <summary> /// Initializes a new FileSystemHelper to a random temp directory. /// </summary> /// <param name="testInstance"> /// Reference to the test class (to access its logging). /// </param> public FileSystemHelper(TestBase testInstance) : this(testInstance, GetTemporaryDirectoryName()) { }
static void Main(string[] args) { int count = Convert.ToInt32(args[0]); string format = args[2]; string datatype = args[3]; StreamWriter writer = new StreamWriter(args[1]); List <GroupData> groups = new List <GroupData>(); List <AddressData> address = new List <AddressData>(); if (datatype == "group") { for (int i = 0; i < count; i++) { groups.Add(new GroupData(TestBase.GenerateRandomString(10)) { Header = TestBase.GenerateRandomString(10), Footer = TestBase.GenerateRandomString(10) }); } if (format == "csv") { writeGroupsToCsvFile(groups, writer); } else if (format == "xml") { writeGroupsToXmlFile(groups, writer); } else if (format == "json") { writeGroupsToJsonFile(groups, writer); } else { System.Console.Out.Write("Unrecognazied format" + format); } writer.Close(); } else if (datatype == "address") { for (int i = 0; i < count; i++) { address.Add(new AddressData(TestBase.GenerateRandomString(30), TestBase.GenerateRandomString(30)) { Middlename = TestBase.GenerateRandomString(30), Nickname = TestBase.GenerateRandomString(30), Title = TestBase.GenerateRandomString(30), Address = TestBase.GenerateRandomString(30), Company = TestBase.GenerateRandomString(30), Home = TestBase.GenerateRandomInt(11), Mobile = TestBase.GenerateRandomInt(11), Work = TestBase.GenerateRandomInt(11), Fax = TestBase.GenerateRandomInt(11), Email = TestBase.GenerateRandomString(20) + "@gmail.com", Email2 = TestBase.GenerateRandomString(20) + "@mail.ru", Email3 = TestBase.GenerateRandomString(20) + "@yandex.ru", Homepage = "qqq.com", Bday = "17", Bmonth = "June", Byear = "1985", Aday = "17", Amonth = "June", Ayear = "2025", Groupselection = "none", Address2 = TestBase.GenerateRandomString(30), Phone2 = TestBase.GenerateRandomInt(11), Notes = TestBase.GenerateRandomString(100) }); } if (format == "xml") { writeAddressToXmlFile(address, writer); } else if (format == "json") { writeAddressToJsonFile(address, writer); } else { System.Console.Out.Write("Unrecognazied format" + format); } writer.Close(); } else { System.Console.Out.Write("Unrecognazied type of data" + datatype); } }
public TestHelper(TestBase testBase) { this.testBase = testBase; }
static void Main(string[] args) { string typeData = args[0]; //выбираем, contact или group int count = Convert.ToInt32(args[1]); //аргумент 1 -Количество тестjвых данных, которые хотим сгенерировать //Для записи в текстовый файл используется класс StreamWriter. string filename = args[2]; string format = args[3]; if (typeData == "groups") { List <GroupData> groups = new List <GroupData>(); //список groups, в который будут записываться случайные строки for (int i = 0; i < count; i++) { groups.Add(new GroupData(TestBase.GenerateRandomString(10)) { Header = TestBase.GenerateRandomString(10), Footer = TestBase.GenerateRandomString(10) }); } if (format == "excel") { writeGroupsToExcelFile(groups, filename); } else { StreamWriter writer = new StreamWriter(args[2]); // аргумент 2 - Название файла, в который будем писать сгенерированные данные if (format == "csv") { writeGroupsToCsvFile(groups, writer); } else if (format == "xml") { writeGroupsToXmlFile(groups, writer); } else if (format == "json") { writeGroupsToJsonFile(groups, writer); } else { System.Console.Out.Write("Unrecognixed format " + format); } writer.Close(); } } else if (typeData == "contacts") { List <ContactDate> contacts = new List <ContactDate>(); for (int i = 0; i < count; i++) { contacts.Add(new ContactDate(TestBase.GenerateRandomString(10), TestBase.GenerateRandomString(10)) { Address = TestBase.GenerateRandomString(10), Middlename = TestBase.GenerateRandomString(10), Company = TestBase.GenerateRandomString(10), }); } if (format == "excel") { writeContactsToExcelFile(contacts, filename); } else { StreamWriter writer = new StreamWriter(args[2]); // аргумент 2 - Название файла, в который будем писать сгенерированные данные if (format == "csv") { writeContactsToCsvFile(contacts, writer); } else if (format == "xml") { writeContactsToXmlFile(contacts, writer); } else if (format == "json") { writeContactsToJsonFile(contacts, writer); } else { System.Console.Out.Write("Unrecognixed format " + format); } writer.Close(); } } else { System.Console.Out.Write("Выбран неверный тип. Напишите groups ИЛИ contacts"); } }
public static DataFactoryManagementClient GetDataFactoryManagementClient(DelegatingHandler handler) { CSMTestEnvironmentFactory factory = new CSMTestEnvironmentFactory(); return(TestBase.GetServiceClient <DataFactoryManagementClient>(factory).WithHandler(handler)); }
public void WalletCanReorg() { // This test has 4 parts: // Send first transaction from one wallet to another and wait for it to be confirmed // Send a second transaction and wait for it to be confirmed // Connect to a longer chain that causes a reorg so that the second trasnaction is undone // Mine the second transaction back in to the main chain using (NodeBuilder builder = NodeBuilder.Create(this)) { CoreNode stratisSender = builder.CreateStratisPowNode(this.network).WithWallet().Start(); CoreNode stratisReceiver = builder.CreateStratisPowNode(this.network).WithWallet().Start(); CoreNode stratisReorg = builder.CreateStratisPowNode(this.network).WithWallet().Start(); int maturity = (int)stratisSender.FullNode.Network.Consensus.CoinbaseMaturity; TestHelper.MineBlocks(stratisSender, maturity + 1 + 15); int currentBestHeight = maturity + 1 + 15; // The mining should add coins to the wallet. long total = stratisSender.FullNode.WalletManager().GetSpendableTransactionsInWallet(WalletName).Sum(s => s.Transaction.Amount); Assert.Equal(Money.COIN * 16 * 50, total); // Sync all nodes. TestHelper.ConnectAndSync(stratisReceiver, stratisSender); TestHelper.ConnectAndSync(stratisReceiver, stratisReorg); TestHelper.ConnectAndSync(stratisSender, stratisReorg); // Build Transaction 1. // Send coins to the receiver. HdAddress sendto = stratisReceiver.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference(WalletName, Account)); Transaction transaction1 = stratisSender.FullNode.WalletTransactionHandler().BuildTransaction(CreateContext(stratisSender.FullNode.Network, new WalletAccountReference(WalletName, Account), Password, sendto.ScriptPubKey, Money.COIN * 100, FeeType.Medium, 101)); // Broadcast to the other node. stratisSender.FullNode.NodeController <WalletController>().SendTransaction(new SendTransactionRequest(transaction1.ToHex())); // Wait for the transaction to arrive. TestBase.WaitLoop(() => stratisReceiver.CreateRPCClient().GetRawMempool().Length > 0); Assert.NotNull(stratisReceiver.CreateRPCClient().GetRawTransaction(transaction1.GetHash(), null, false)); TestBase.WaitLoop(() => stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet(WalletName).Any()); long receivetotal = stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet(WalletName).Sum(s => s.Transaction.Amount); Assert.Equal(Money.COIN * 100, receivetotal); Assert.Null(stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet(WalletName).First().Transaction.BlockHeight); // Generate two new blocks so the transaction is confirmed. TestHelper.MineBlocks(stratisSender, 1); int transaction1MinedHeight = currentBestHeight + 1; TestHelper.MineBlocks(stratisSender, 1); currentBestHeight = currentBestHeight + 2; // Wait for block repo for block sync to work. TestBase.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender)); TestBase.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisReorg)); Assert.Equal(currentBestHeight, stratisReceiver.FullNode.ChainIndexer.Tip.Height); TestBase.WaitLoop(() => transaction1MinedHeight == stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet(WalletName).First().Transaction.BlockHeight); // Build Transaction 2. // Remove the reorg node. TestHelper.Disconnect(stratisReceiver, stratisReorg); TestHelper.Disconnect(stratisSender, stratisReorg); ChainedHeader forkblock = stratisReceiver.FullNode.ChainIndexer.Tip; // Send more coins to the wallet sendto = stratisReceiver.FullNode.WalletManager().GetUnusedAddress(new WalletAccountReference(WalletName, Account)); Transaction transaction2 = stratisSender.FullNode.WalletTransactionHandler().BuildTransaction(CreateContext(stratisSender.FullNode.Network, new WalletAccountReference(WalletName, Account), Password, sendto.ScriptPubKey, Money.COIN * 10, FeeType.Medium, 101)); stratisSender.FullNode.NodeController <WalletController>().SendTransaction(new SendTransactionRequest(transaction2.ToHex())); // Wait for the transaction to arrive TestBase.WaitLoop(() => stratisReceiver.CreateRPCClient().GetRawMempool().Length > 0); Assert.NotNull(stratisReceiver.CreateRPCClient().GetRawTransaction(transaction2.GetHash(), null, false)); TestBase.WaitLoop(() => stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet(WalletName).Any()); long newamount = stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet(WalletName).Sum(s => s.Transaction.Amount); Assert.Equal(Money.COIN * 110, newamount); Assert.Contains(stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet(WalletName), b => b.Transaction.BlockHeight == null); // Mine more blocks so it gets included in the chain. TestHelper.MineBlocks(stratisSender, 1); int transaction2MinedHeight = currentBestHeight + 1; TestHelper.MineBlocks(stratisSender, 1); currentBestHeight = currentBestHeight + 2; TestBase.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender)); Assert.Equal(currentBestHeight, stratisReceiver.FullNode.ChainIndexer.Tip.Height); TestBase.WaitLoop(() => stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet(WalletName).Any(b => b.Transaction.BlockHeight == transaction2MinedHeight)); // Create a reorg by mining on two different chains. // Advance both chains, one chain is longer. TestHelper.MineBlocks(stratisSender, 2); TestHelper.MineBlocks(stratisReorg, 10); currentBestHeight = forkblock.Height + 10; // Connect the reorg chain. TestHelper.Connect(stratisReceiver, stratisReorg); TestHelper.Connect(stratisSender, stratisReorg); // Wait for the chains to catch up. TestBase.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender)); TestBase.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisReorg, true)); Assert.Equal(currentBestHeight, stratisReceiver.FullNode.ChainIndexer.Tip.Height); // Ensure wallet reorg completes. TestBase.WaitLoop(() => stratisReceiver.FullNode.WalletManager().WalletTipHash == stratisReorg.CreateRPCClient().GetBestBlockHash()); // Check the wallet amount was rolled back. long newtotal = stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet(WalletName).Sum(s => s.Transaction.Amount); Assert.Equal(receivetotal, newtotal); TestBase.WaitLoop(() => maturity + 1 + 16 == stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet(WalletName).First().Transaction.BlockHeight); // ReBuild Transaction 2. // After the reorg transaction2 was returned back to mempool. stratisSender.FullNode.NodeController <WalletController>().SendTransaction(new SendTransactionRequest(transaction2.ToHex())); TestBase.WaitLoop(() => stratisReceiver.CreateRPCClient().GetRawMempool().Length > 0); // Mine the transaction again. TestHelper.MineBlocks(stratisSender, 1); transaction2MinedHeight = currentBestHeight + 1; TestHelper.MineBlocks(stratisSender, 1); currentBestHeight = currentBestHeight + 2; TestBase.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisSender)); TestBase.WaitLoop(() => TestHelper.AreNodesSynced(stratisReceiver, stratisReorg)); Assert.Equal(currentBestHeight, stratisReceiver.FullNode.ChainIndexer.Tip.Height); long newsecondamount = stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet(WalletName).Sum(s => s.Transaction.Amount); Assert.Equal(newamount, newsecondamount); TestBase.WaitLoop(() => stratisReceiver.FullNode.WalletManager().GetSpendableTransactionsInWallet(WalletName).Any(b => b.Transaction.BlockHeight == transaction2MinedHeight)); } }
public static ResourceManagementClient GetResourceManagementClient(RecordedDelegatingHandler handler) { handler.IsPassThrough = true; return(TestBase.GetServiceClient <ResourceManagementClient>(new CSMTestEnvironmentFactory()).WithHandler(handler)); }
public static void SetBlobContentClassCleanup() { TestBase.TestClassCleanup(); }
public static void ClassInit(TestContext testContext) { TestBase.TestClassInitialize(testContext); uploadDirRoot = Test.Data.Get("UploadDir"); SetupUploadDir(); }
private DnsManagementClient GetFeatureClient() { return(TestBase.GetServiceClient <DnsManagementClient>(this.csmTestFactory)); }
public void TestHighlightDoesNothing() { var target = new TestBase(); target.Highlight(); target.Highlight(null); }
private AuthorizationManagementClient GetAuthorizationManagementClient() { return(TestBase.GetServiceClient <AuthorizationManagementClient>(this.csmTestFactory)); }
public void TestGetPropertyNames() { var target = new TestBase(); var result = target.GetPropertyNames(f => true).ToList(); Assert.IsNotNull(result); CollectionAssert.Contains(result, "Name"); CollectionAssert.Contains(result, "Button"); }
private ResourceManagementClient GetResourceManagementClient() { return(TestBase.GetServiceClient <ResourceManagementClient>(this.csmTestFactory)); }
public DataLakeStoreManagementHelper(TestBase testBase) { this.testBase = testBase; resourceManagementClient = ClientManagementUtilities.GetResourceManagementClient(this.testBase); }
private KeyVaultManagementClient GetKeyVaultManagementClient() { return(TestBase.GetServiceClient <KeyVaultManagementClient>(this.csmTestFactory)); }
/// <summary> /// Default constructor for management clients, using the TestSupport Infrastructure /// </summary> /// <param name="testBase">the test class</param> /// <returns>A bigAnalytics management client, created from the current context (environment variables)</returns> public static DataLakeAnalyticsJobManagementClient GetDataLakeAnalyticsJobManagementClient(this TestBase testBase, MockContext context) { var client = context.GetServiceClient <DataLakeAnalyticsJobManagementClient>(true); // reset back to the default to ensure the logic works as expected. client.AdlaJobDnsSuffix = TestEnvironmentFactory.GetTestEnvironment().Endpoints.DataLakeAnalyticsJobAndCatalogServiceUri.OriginalString.Replace("https://", ""); return(client); }
/// <summary> /// Default constructor for management clients, using the TestSupport Infrastructure /// </summary> /// <param name="testBase">the test class</param> /// <returns>A resource management client, created from the current context (environment variables)</returns> public static ResourceManagementClient GetResourceManagementClient(this TestBase testBase, MockContext context) { return(context.GetServiceClient <ResourceManagementClient>()); }
public RedisCacheManagementHelper(TestBase testBase) { _client = RedisCacheManagementTestUtilities.GetResourceManagementClient(testBase); _testBase = testBase; }
public LoggingHttpHandler(TestBase test) { Test = test; }
private SubscriptionClient GetSubscriptionClient() { return(TestBase.GetServiceClient <SubscriptionClient>(this.csmTestFactory)); }
protected DataLakeStoreManagementClient GetDataLakeStoreManagementClient() { return(TestBase.GetServiceClient <DataLakeStoreManagementClient>(new CSMTestEnvironmentFactory())); }
protected ManagedCacheClient GetManagedCacheClient() { return(TestBase.GetServiceClient <ManagedCacheClient>(new RDFETestEnvironmentFactory())); }
private GalleryClient GetGalleryClient() { return(TestBase.GetServiceClient <GalleryClient>(this.csmTestFactory)); }
public void TestCallElementInvoker() { var page = new InheritedClass { Button = new BaseElement() }; var target = new TestBase(page); IPropertyData property; var result = target.TryGetProperty("Button", out property); property.ClickElement(); Assert.IsTrue(result); }
/// <summary> /// Creates test chain with a consensus loop. /// </summary> public static async Task <TestChainContext> CreateAsync(Network network, string dataDir, Mock <IPeerAddressManager> mockPeerAddressManager = null) { var testChainContext = new TestChainContext() { Network = network }; testChainContext.NodeSettings = new NodeSettings(network, args: new string[] { $"-datadir={dataDir}" }); testChainContext.ConnectionSettings = new ConnectionManagerSettings(testChainContext.NodeSettings); testChainContext.LoggerFactory = testChainContext.NodeSettings.LoggerFactory; testChainContext.DateTimeProvider = DateTimeProvider.Default; testChainContext.Signals = new Signals.Signals(testChainContext.NodeSettings.LoggerFactory, null); testChainContext.AsyncProvider = new AsyncProvider(testChainContext.NodeSettings.LoggerFactory, testChainContext.Signals, new Mock <INodeLifetime>().Object); network.Consensus.Options = new ConsensusOptions(); //new FullNodeBuilderConsensusExtension.PowConsensusRulesRegistration().RegisterRules(network.Consensus); var consensusSettings = new ConsensusSettings(testChainContext.NodeSettings); testChainContext.Checkpoints = new Checkpoints(); testChainContext.ChainIndexer = new ChainIndexer(network); testChainContext.ChainState = new ChainState(); testChainContext.InitialBlockDownloadState = new InitialBlockDownloadState(testChainContext.ChainState, testChainContext.Network, consensusSettings, new Checkpoints(), testChainContext.NodeSettings.LoggerFactory, testChainContext.DateTimeProvider); var inMemoryCoinView = new InMemoryCoinView(testChainContext.ChainIndexer.Tip.HashBlock); var cachedCoinView = new CachedCoinView(inMemoryCoinView, DateTimeProvider.Default, testChainContext.LoggerFactory, new NodeStats(testChainContext.DateTimeProvider, testChainContext.LoggerFactory), new ConsensusSettings(testChainContext.NodeSettings)); var dataFolder = new DataFolder(TestBase.AssureEmptyDir(dataDir)); testChainContext.PeerAddressManager = mockPeerAddressManager == null ? new PeerAddressManager(DateTimeProvider.Default, dataFolder, testChainContext.LoggerFactory, new SelfEndpointTracker(testChainContext.LoggerFactory, testChainContext.ConnectionSettings)) : mockPeerAddressManager.Object; testChainContext.MockConnectionManager = new Mock <IConnectionManager>(); testChainContext.MockReadOnlyNodesCollection = new Mock <IReadOnlyNetworkPeerCollection>(); testChainContext.MockConnectionManager.Setup(s => s.ConnectedPeers).Returns(testChainContext.MockReadOnlyNodesCollection.Object); testChainContext.MockConnectionManager.Setup(s => s.NodeSettings).Returns(testChainContext.NodeSettings); testChainContext.MockConnectionManager.Setup(s => s.ConnectionSettings).Returns(testChainContext.ConnectionSettings); testChainContext.ConnectionManager = testChainContext.MockConnectionManager.Object; var dateTimeProvider = new DateTimeProvider(); testChainContext.PeerBanning = new PeerBanning(testChainContext.ConnectionManager, testChainContext.LoggerFactory, testChainContext.DateTimeProvider, testChainContext.PeerAddressManager); var deployments = new NodeDeployments(testChainContext.Network, testChainContext.ChainIndexer); testChainContext.ConsensusRules = new PowConsensusRuleEngine(testChainContext.Network, testChainContext.LoggerFactory, testChainContext.DateTimeProvider, testChainContext.ChainIndexer, deployments, consensusSettings, testChainContext.Checkpoints, cachedCoinView, testChainContext.ChainState, new InvalidBlockHashStore(dateTimeProvider), new NodeStats(dateTimeProvider, testChainContext.LoggerFactory), testChainContext.AsyncProvider, new ConsensusRulesContainer()).SetupRulesEngineParent(); testChainContext.HeaderValidator = new HeaderValidator(testChainContext.ConsensusRules, testChainContext.LoggerFactory); testChainContext.IntegrityValidator = new IntegrityValidator(testChainContext.ConsensusRules, testChainContext.LoggerFactory); testChainContext.PartialValidator = new PartialValidator(testChainContext.AsyncProvider, testChainContext.ConsensusRules, testChainContext.LoggerFactory); testChainContext.FullValidator = new FullValidator(testChainContext.ConsensusRules, testChainContext.LoggerFactory); var dBreezeSerializer = new DBreezeSerializer(network.Consensus.ConsensusFactory); var blockRepository = new BlockRepository(testChainContext.Network, dataFolder, testChainContext.LoggerFactory, dBreezeSerializer); var blockStoreFlushCondition = new BlockStoreQueueFlushCondition(testChainContext.ChainState, testChainContext.InitialBlockDownloadState); var blockStore = new BlockStoreQueue(testChainContext.ChainIndexer, testChainContext.ChainState, blockStoreFlushCondition, new Mock <StoreSettings>().Object, blockRepository, testChainContext.LoggerFactory, new Mock <INodeStats>().Object, testChainContext.AsyncProvider); blockStore.Initialize(); testChainContext.Consensus = ConsensusManagerHelper.CreateConsensusManager(network, dataDir); await testChainContext.Consensus.InitializeAsync(testChainContext.ChainIndexer.Tip); return(testChainContext); }
public void TestWaitForPageToBeActiveCallsNativeInterfaceNoActionIfMissing() { var targetClass = new InheritedClass(); var target = new TestBase(targetClass); target.WaitForPageToBeActive(); }
protected StreamAnalyticsManagementClient GetStreamAnalyticsManagementClient() { return(TestBase.GetServiceClient <StreamAnalyticsManagementClient>(new CSMTestEnvironmentFactory())); }
static void Main(string[] args) { string data_type = args[0]; int count = Convert.ToInt32(args[1]); string file_name = args[2]; string format = args[3]; if (data_type == "groups") { List <GroupData> groups = new List <GroupData>(); for (int i = 0; i < count; i++) { groups.Add(new GroupData(TestBase.GenerateRandomString(10)) { Header = TestBase.GenerateRandomString(10), Footer = TestBase.GenerateRandomString(10) }); } if (format == "excel") { WriteGroupsToExcelFile(groups, file_name); } else { StreamWriter writer = new StreamWriter(file_name); if (format == "csv") { WriteGroupsToCsvFile(groups, writer); } else if (format == "xml") { WriteGroupsToXmlFile(groups, writer); } else if (format == "json") { WriteGroupsToJsonFile(groups, writer); } else { Console.Out.Write("Unrecognized format" + format); } writer.Close(); } } else if (data_type == "contacts") { List <ContactData> contacts = new List <ContactData>(); StreamWriter writer = new StreamWriter(file_name); for (int i = 0; i < count; i++) { contacts.Add(new ContactData(TestBase.GenerateRandomString(5), TestBase.GenerateRandomString(5)) { Address = TestBase.GenerateRandomString(5), MobilePhone = Convert.ToString(new Random().Next(1111, 9999)), WorkPhone = Convert.ToString(new Random().Next(1111, 9999)), HomePhone = Convert.ToString(new Random().Next(1111, 9999)), Email1 = TestBase.GenerateRandomString(5) + "@" + TestBase.GenerateRandomString(5), Email2 = TestBase.GenerateRandomString(5) + "@" + TestBase.GenerateRandomString(5), Email3 = TestBase.GenerateRandomString(5) + "@" + TestBase.GenerateRandomString(5) }); } if (format == "xml") { WriteContactsToXmlFile(contacts, writer); } else if (format == "json") { WriteContactsToJsonFile(contacts, writer); } else { Console.Out.Write("Unrecognized format" + format); } writer.Close(); } }
protected StorageManagementClient GetStorageManagementClient() { return(TestBase.GetServiceClient <StorageManagementClient>(new RDFETestEnvironmentFactory())); }
static void Main(string[] args) { string dataType = args[0]; int count = Convert.ToInt32(args[1]); string filename = args[2]; string format = args[3]; if (dataType == "groups") { List <GroupData> groups = new List <GroupData>(); for (int i = 0; i < count; i++) { groups.Add(new GroupData(TestBase.GenerateRandomString(10)) { Header = TestBase.GenerateRandomString(100), Footer = TestBase.GenerateRandomString(100) }); } if (format == "excel") { writeGroupsToExcelFile(groups, filename); } else { StreamWriter writer = new StreamWriter(filename); if (format == "csv") { writeGroupsToCsvFile(groups, writer); } else if (format == "xml") { writeGroupsToXmlFile(groups, writer); } else if (format == "json") { writeGroupsToJsonFile(groups, writer); } else { System.Console.Out.Write("Unrecognized format " + format); } writer.Close(); } } else if (dataType == "contacts") { List <ContactData> contacts = new List <ContactData>(); for (int i = 0; i < count; i++) { contacts.Add(new ContactData(TestBase.GenerateRandomString(10), TestBase.GenerateRandomString(10))); } StreamWriter writer = new StreamWriter(filename); if (format == "xml") { writeContactsToXmlFile(contacts, writer); } else if (format == "json") { writeContactsToJsonFile(contacts, writer); } else { System.Console.Out.Write("Unrecognized format " + format); } writer.Close(); } else { System.Console.Out.Write("Unrecognized data type " + dataType); } }
private void mempool_of_node2_has_received_transaction() { TestBase.WaitLoop(() => this.firstNode.FullNode.MempoolManager().GetMempoolAsync().Result.Any()); this.firstNode.FullNode.MempoolManager().GetMempoolAsync().Result.Should().Contain(this.transaction.GetHash()); }
public Steps(Page pageObject, TestBase testInstance) { page = pageObject; test = testInstance; }
protected ResourceManagementClient GetResourceManagementClient() { return(TestBase.GetServiceClient <ResourceManagementClient>(new CSMTestEnvironmentFactory())); }
// Makes the next test class being the one executed private void ProcessNextTestClass() { if (CurrentTestClassNo >= TestTypes.Length) { CurrentTestClassNo = -1; Common.Log("Tests completed. Passed: " + PassedTests + ", failed: " + FailedTests.Count + ", ignored: " + IgnoreTestNames.Length); foreach (string name in FailedTests) { Debug.Log("Failed test: " + name); } return; } var t = TestTypes[CurrentTestClassNo++]; CurrentTestClassName = t.Name; CurrentClassTestComponent = (TestBase)gameObject.AddComponent(t); CurrentClassMethods = ListTestMethods(t); CurrentTestMethodNo = 0; }
protected SubscriptionClient GetSubscriptionClient() { return(TestBase.GetServiceClient <SubscriptionClient>(new CSMTestEnvironmentFactory())); }
public LoggingFilter(TestBase test) { Test = test; }
protected GalleryClient GetGalleryClient() { return(TestBase.GetServiceClient <GalleryClient>(new CSMTestEnvironmentFactory())); }
protected AuthorizationManagementClient GetAuthorizationManagementClient() { return(TestBase.GetServiceClient <AuthorizationManagementClient>(new CSMTestEnvironmentFactory())); }
/// <summary> /// Default constructor for management clients, using the TestSupport Infrastructure /// </summary> /// <param name="testBase">the test class</param> /// <returns>A dataLake management client, created from the current context (environment variables)</returns> public static DataLakeStoreAccountManagementClient GetDataLakeStoreAccountManagementClient(this TestBase testBase, MockContext context) { return(context.GetServiceClient <DataLakeStoreAccountManagementClient>()); }