private async Task Delete(DocumentId documentId, bool shouldExist) { ContractClient client = TestApplication.GetContractClient(); var query = new QueryParameter() { Filter = documentId.Id.Split('/').Reverse().Skip(1).Reverse().Join("/"), Recursive = false, }; BatchSet <string> searchList = await client.Search(query).ReadNext(); searchList.Should().NotBeNull(); bool exists = searchList.Records.Any(x => x.EndsWith(documentId.Path)); if (!shouldExist && !exists) { return; } exists.Should().BeTrue(); (await client.Delete(documentId)).Should().BeTrue(); searchList = await client.Search(query).ReadNext(); searchList.Should().NotBeNull(); searchList.Records.Any(x => x.EndsWith(documentId.Path)).Should().BeFalse(); }
public void setup_context() { var objectSpaceProvider = new XPObjectSpaceProvider(new MemoryDataStoreProvider()); application = new TestApplication(); var testModule = new ModuleBase(); beforeSetup(testModule); application.Modules.Add(testModule); application.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways; application.Setup("TestApplication", objectSpaceProvider); objectSpace = objectSpaceProvider.CreateObjectSpace() as XPObjectSpace; XpoDefault.DataLayer = objectSpace.Session.DataLayer; //Do test-specific tasks in the context method ImageLoader.Reset(); if (!ImageLoader.IsInitialized) { ImageLoader.Init(new AssemblyResourceImageSource(GetType().Assembly.FullName, "Images1")); } context(); }
public async Task GivenNoContract_WhenCreated_ShouldVerify() { ContractClient client = TestApplication.GetContractClient(); var documentId = new DocumentId("test/unit-tests-smart/contract1"); var query = new QueryParameter() { Filter = "test/unit-tests-smart", Recursive = false, }; IReadOnlyList <string> search = (await client.Search(query).ReadNext()).Records; if (search.Any(x => x == (string)documentId)) { await client.Delete(documentId); } var blkHeader = new BlkHeader { PrincipalId = "dev/user/[email protected]", DocumentId = (string)documentId, Creator = "test", Description = "test description", }; await client.Create(blkHeader); BlockChainModel model = await client.Get(documentId); model.Should().NotBeNull(); model.Blocks.Should().NotBeNull(); model.Blocks.Count.Should().Be(2); model.Blocks[0].Should().NotBeNull(); model.Blocks[0].IsValid().Should().BeTrue(); model.Blocks[1].Should().NotBeNull(); model.Blocks[1].IsValid().Should().BeTrue(); model.Blocks[1].DataBlock.Should().NotBeNull(); model.Blocks[1].DataBlock.BlockType.Should().Be(typeof(BlkHeader).Name); bool isValid = await client.Validate(model); isValid.Should().BeTrue(); BatchSet <string> searchList = await client.Search(query).ReadNext(); searchList.Should().NotBeNull(); searchList.Records.Any(x => x.EndsWith(documentId.Path)).Should().BeTrue(); (await client.Delete(documentId)).Should().BeTrue(); searchList = await client.Search(query).ReadNext(); searchList.Should().NotBeNull(); searchList.Records.Any(x => x.EndsWith(documentId.Path)).Should().BeFalse(); }
void StartEngine(bool initiator) { TestApplication application = new TestApplication(LogonCallback, LogoffCallback); IMessageStoreFactory storeFactory = new MemoryStoreFactory(); SessionSettings settings = new SessionSettings(); Dictionary defaults = new Dictionary(); defaults.SetString(QuickFix.SessionSettings.FILE_LOG_PATH, _logPath); // Put IP endpoint settings into default section to verify that that defaults get merged into // session-specific settings not only for static sessions, but also for dynamic ones defaults.SetString(SessionSettings.SOCKET_CONNECT_HOST, Host); defaults.SetString(SessionSettings.SOCKET_CONNECT_PORT, ConnectPort.ToString()); defaults.SetString(SessionSettings.SOCKET_ACCEPT_HOST, Host); defaults.SetString(SessionSettings.SOCKET_ACCEPT_PORT, AcceptPort.ToString()); settings.Set(defaults); ILogFactory logFactory = new FileLogFactory(settings); if (initiator) { defaults.SetString(SessionSettings.RECONNECT_INTERVAL, "1"); settings.Set(CreateSessionID(StaticInitiatorCompID), CreateSessionConfig(StaticInitiatorCompID, true)); _initiator = new SocketInitiator(application, storeFactory, settings, logFactory); _initiator.Start(); } else { settings.Set(CreateSessionID(StaticAcceptorCompID), CreateSessionConfig(StaticAcceptorCompID, false)); _acceptor = new ThreadedSocketAcceptor(application, storeFactory, settings, logFactory); _acceptor.Start(); } }
public WebEasyTestFixtureHelperBase(string relativePathToWebApplication) { var testApplicationDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), relativePathToWebApplication); application = new TestApplication { IgnoreCase = true, }; var doc = new XmlDocument(); var additionalAttributes = new List <XmlAttribute> { CreateAttribute(doc, "PhysicalPath", testApplicationDir), CreateAttribute(doc, "URL", $"{testWebApplicationRootUrl}{GetUrlOptions()}"), CreateAttribute(doc, "SingleWebDev", true), CreateAttribute(doc, "DontRestartIIS", true), CreateAttribute(doc, "UseIISExpress", true), }; application.AdditionalAttributes = additionalAttributes.ToArray(); webAdapter = new WebAdapter(); webAdapter.RunApplication(application, InMemoryDataStoreProvider.ConnectionString); adapter = webAdapter.CreateCommandAdapter(); commandAdapter = new TestCommandAdapter(adapter, application); }
public static async Task ClassInitAsync(TestContext context) { app = new(); await app.InitializeAsync(context); await app.OpenAsync(); }
public void ConfigureUsingXmlApplicationContext_CanMergePropertyValues() { XmlApplicationContext appContext = new XmlApplicationContext(false, ReadOnlyXmlTestResource.GetFilePath("HttpApplicationConfigurerMergablePropertiesTests.xml", typeof(HttpApplicationConfigurerTests))); ParentHttpModule module = new ParentHttpModule(); TestApplication appObject = new TestApplication(new ModuleEntry[] { new ModuleEntry("DirectoryServicesAuthentication", module) }); HttpApplicationConfigurer.Configure(appContext, appObject); //base class property has carried through successfully Assert.Contains("GrandParentValue1", module.GrandParentProperty); //parent property values remain in the final instance Assert.Contains("ParentValue1", module.ParentProperty); Assert.Contains("ParentValue2", module.ParentProperty); Assert.Contains("ParentValue3", module.ParentProperty); Assert.Contains("ParentValue4", module.ParentProperty); //the new additional value has been merged into the property Assert.Contains("MergedValueToFind", module.ParentProperty); }
public async Task GivenFakePackage_WhenFullLifeCycle_ShouldPass() { TestWebsiteHost host = TestApplication.GetHost(); const string payload = "This is a test"; string id = "fake1"; byte[] bytes = Encoding.UTF8.GetBytes(payload); ArticlePayload articlePayload = bytes.ToArticlePayload((ArticleId)id); await host.ArticleClient.Set(articlePayload); ArticlePayload?readPayload = await host.ArticleClient.Get((ArticleId)id); readPayload.Should().NotBeNull(); (articlePayload == readPayload).Should().BeTrue(); string payloadText = Encoding.UTF8.GetString(readPayload !.ToBytes()); payloadText.Should().Be(payload); BatchSet <string> searchList = await host.ArticleClient.List(QueryParameters.Default).ReadNext(); searchList.Should().NotBeNull(); searchList.Records.Any(x => x.StartsWith(id)).Should().BeTrue(); (await host.ArticleClient.Delete((ArticleId)id)).Should().BeTrue(); searchList = await host.ArticleClient.List(QueryParameters.Default).ReadNext(); searchList.Should().NotBeNull(); searchList.Records.Any(x => x.StartsWith(id)).Should().BeFalse(); }
public void ShouldFailForInvalidVendor() { var vendor = new Vendor { VendorNamespacePrefixes = new List <VendorNamespacePrefix> { new VendorNamespacePrefix { NamespacePrefix = "http://tests.com" } }, VendorName = "Integration Tests" }; var user = new Admin.DataAccess.Models.User { Email = "*****@*****.**", FullName = "Integration Tests", Vendor = vendor }; Save(vendor, user); var command = new AddApplicationCommand(SetupContext, new InstanceContext()); var newApplication = new TestApplication { Environment = CloudOdsEnvironment.Production, ApplicationName = "Production-Test Application", ClaimSetName = "FakeClaimSet", ProfileId = 0, VendorId = 0 }; Assert.Throws <InvalidOperationException>(() => command.Execute(newApplication)); }
public static async Task InitializeAsync(this TestContext context, TestApplication app) { context.Properties.Add(appKey, app); context.Properties.Add(cremaHostKey, app.GetService(typeof(ICremaHost))); context.Properties.Add(authenticationKey, new HashSet <Authentication>()); await Task.Delay(1); }
private static string GetModelFileName(TestApplication application) { var model = application.ParameterValue <string>(ApplicationParams.Model); var logPath = Logger.Instance.GetLogger <FileLogger>().LogPath; return(model != null?Path.Combine(logPath, model + ".xafml") : logPath); }
public override void RunApplication(TestApplication testApplication){ testApplication.CreateParametersFile(); testApplication.DeleteUserModel(); testApplication.CopyModel(); ConfigApplicationModel(testApplication); RunApplicationCore(testApplication); }
private static string GetParameterFile(this TestApplication application) { var path = application.ParameterValue <string>(ApplicationParams.PhysicalPath) ?? Path.GetDirectoryName(application.ParameterValue <string>(ApplicationParams.FileName)); return(Path.Combine(path + "", "easytestparameters")); }
public static Process Run(TestApplication testApplication, Uri uri) { string physicalPath = Path.GetFullPath(testApplication.FindParamValue("PhysicalPath")); string arguments = string.Format(@"/path:""{0}"" /port:{1}", physicalPath, uri.Port); EasyTestTracer.Tracer.InProcedure(string.Format("RunIISExpressServer({0})", arguments)); try{ string serverPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), @"IIS Express\iisexpress.exe"); EasyTestTracer.Tracer.InProcedure(string.Format("IISExpressServerPath= {0}", serverPath)); var serverProcess = new Process { StartInfo = { FileName = serverPath, Arguments = arguments, UseShellExecute = true, WindowStyle = ProcessWindowStyle.Hidden } }; serverProcess.Start(); return(serverProcess); } finally{ EasyTestTracer.Tracer.OutProcedure(string.Format("RunWebDevWebServer({0})", arguments)); } }
public static void Main() { using (var app = new TestApplication()) { app.Run(); } }
public void SetUp() { _gameObject = new GameObject("ProcessorTest"); _testLogger = new TestLogger(); _sentryMonoBehaviour = _gameObject.AddComponent <SentryMonoBehaviour>(); _testApplication = new(); }
static void Main(string[] args) { var generator = Platform.Get(Platforms.WinForms); var app = new TestApplication(generator); app.Run(); }
// This is the main entry point of the application. static void Main(string[] args) { var generator = new Eto.Platform.iOS.Generator(); var app = new TestApplication(generator); app.Run(args); }
public async Task GivenDirectoryEntry_WhenRoundTrip_Success() { const string issuer = "*****@*****.**"; IdentityClient client = TestApplication.GetIdentityClient(); var documentId = new DocumentId("test/unit-tests-identity/identity1"); var query = new QueryParameter() { Filter = "test/unit-tests-identity", Recursive = false, }; await client.Delete(documentId); var request = new IdentityEntryRequest { DirectoryId = (string)documentId, Issuer = issuer }; bool success = await client.Create(request); success.Should().BeTrue(); IdentityEntry?entry = await client.Get(documentId); entry.Should().NotBeNull(); await client.Delete(documentId); }
static void Main(string [] args) { var generator = Generator.GetGenerator(Generators.Direct2DAssembly); var app = new TestApplication(generator); app.Run(args); }
public static void Configure(TestApplication testApplication) { using (var server = new ServerManager()) { var applicationName = GetApplicationName(testApplication); var applicationPool = server.ApplicationPools.FirstOrDefault(pool => pool.Name == applicationName) ?? server.ApplicationPools.Add(applicationName); applicationPool.ProcessModel.IdentityType = ProcessModelIdentityType.SpecificUser; applicationPool.ProcessModel.UserName = GetValueFromRegistry("UserName"); applicationPool.ProcessModel.Password = GetValueFromRegistry("Password"); var webSite = server.Sites.First(site => site.Name == "Default Web Site"); var url = GetUrl(webSite, applicationName); ConfigureTestApplication(testApplication, url); ConfigureSiteApplication(testApplication, webSite, applicationPool, applicationName); server.CommitChanges(); if (applicationPool.State == ObjectState.Started) { applicationPool.Stop(); } while (applicationPool.State != ObjectState.Stopped) { Thread.Sleep(300); } applicationPool.Start(); while (applicationPool.State != ObjectState.Started) { Thread.Sleep(300); } } }
public async Task GivenContactRequest_WhenFullLifeCycle_ShouldPass() { TestWebsiteHost host = TestApplication.GetHost(); const int max = 10; IReadOnlyList <ContactRequest> list = Enumerable.Range(0, max) .Select(x => new ContactRequest { Name = $"Name_{x}", Email = $"Email_{x}", Subject = $"Subject_{x}", Message = $"Message_{x}", RequestResume = x % 2 == 0, }).ToList(); await list .ForEachAsync(async x => await host.ContactRequestClient.Set(x)); List <ContactRequest> readList = new List <ContactRequest>(); foreach (var item in list) { ContactRequest?contactRequest = await host.ContactRequestClient.Get(item.RequestId); contactRequest.Should().NotBeNull(); (item == contactRequest).Should().BeTrue(); (await host.ContactRequestClient.Delete(item.RequestId)).Should().BeTrue(); } }
public AllTests() { var groupSections = TestSections.Get(TestApplication.DefaultTestAssemblies()).ToList(); for (var i = 0; i < groupSections.Count; ++i) { var groupSection = groupSections[i]; var testSections = groupSection.ToList(); // the children var testGroup = new TestGroup( uniqueId: "Group-" + i, title: groupSection.Text, subtitle: string.Format("{0} Tests", testSections.Count), imagePath: "Assets/DarkGray.png", description: ""); // TODO: add a Description field to tests. AllGroups.Add(testGroup); for (var j = 0; j < testSections.Count; ++j) { var testSection = groupSection[j]; var testItem = new TestItem( uniqueId: string.Format("Group-{0}-Item-{1}", i, j), title: testSection.Text, subtitle: "", imagePath: "Assets/LightGray.png", description: "", content: "Hello!", group: testGroup, getControl: () => GetControl(testSection)); testGroup.Items.Add(testItem); } } }
public void ProfileShouldBeOptional() { var vendor = new Vendor { VendorNamespacePrefixes = new List <VendorNamespacePrefix> { new VendorNamespacePrefix { NamespacePrefix = "http://tests.com" } }, VendorName = "Integration Tests" }; var user = new Admin.DataAccess.Models.User { Email = "*****@*****.**", FullName = "Integration Tests", Vendor = vendor }; Save(vendor, user); AddApplicationResult result = null; Scoped <IUsersContext>(usersContext => { var command = new AddApplicationCommand(usersContext, new InstanceContext()); var newApplication = new TestApplication { ApplicationName = "Test Application", ClaimSetName = "FakeClaimSet", ProfileId = null, VendorId = vendor.VendorId, EducationOrganizationIds = new List <int> { 12345, 67890 } }; result = command.Execute(newApplication); }); Transaction(usersContext => { var persistedApplication = usersContext.Applications.Single(a => a.ApplicationId == result.ApplicationId); persistedApplication.ClaimSetName.ShouldBe("FakeClaimSet"); persistedApplication.Profiles.Count.ShouldBe(0); persistedApplication.ApplicationEducationOrganizations.Count.ShouldBe(2); persistedApplication.ApplicationEducationOrganizations.All(o => o.EducationOrganizationId == 12345 || o.EducationOrganizationId == 67890).ShouldBeTrue(); persistedApplication.Vendor.VendorId.ShouldBeGreaterThan(0); persistedApplication.Vendor.VendorId.ShouldBe(vendor.VendorId); persistedApplication.ApiClients.Count.ShouldBe(1); var apiClient = persistedApplication.ApiClients.First(); apiClient.Name.ShouldBe("Test Application"); apiClient.ApplicationEducationOrganizations.All(o => o.EducationOrganizationId == 12345 || o.EducationOrganizationId == 67890).ShouldBeTrue(); apiClient.Key.ShouldBe(result.Key); apiClient.Secret.ShouldBe(result.Secret); }); }
public void GlueConfiguredByCodeAndMakeCall_Sync() { //This is an example of how to use Glue without pre-configured app container var app = new TestApplication() { Active = true }; var glue = new NFX.Glue.Implementation.GlueService(app); glue.Start(); try { using (var binding = new SyncBinding(glue, "sync")) { binding.Start(); var cl = new JokeContractClient(glue, TestServerSyncNode); cl.Headers.Add(new AuthenticationHeader(TestCredentials)); var result = cl.Echo("Gello A!"); Assert.IsTrue(result.StartsWith("Server echoed Gello A!")); } } finally { glue.WaitForCompleteStop(); } }
// This is the main entry point of the application. static void Main(string[] args) { var platform = new Eto.iOS.Platform(); var app = new TestApplication(platform); app.Run(); }
public void ConfiguresApplicationAndModulesFromTemplate() { StaticApplicationContext appContext = CreateTestContext(); HttpApplicationConfigurer h; RootObjectDefinition rod; h = new HttpApplicationConfigurer(); rod = new RootObjectDefinition(); rod.PropertyValues.Add("TestObject", new RuntimeObjectReference("testObject")); h.ApplicationTemplate = rod; rod = new RootObjectDefinition(); rod.PropertyValues.Add("TestObject", new RuntimeObjectReference("testObject1")); h.ModuleTemplates.Add("TestModule1", rod); rod = new RootObjectDefinition(); rod.PropertyValues.Add("TestObject", new RuntimeObjectReference("testObject2")); h.ModuleTemplates.Add("TestModule2", rod); TestModule m1 = new TestModule(); TestModule m2 = new TestModule(); TestApplication appObject = new TestApplication(new ModuleEntry[] { new ModuleEntry("TestModule1", m1) , new ModuleEntry("TestModule2", m2), }); HttpApplicationConfigurer.Configure(appContext, appObject); // app configured Assert.AreEqual(appContext.GetObject("testObject"), appObject.TestObject); // modules configured Assert.AreEqual(appContext.GetObject("testObject1"), m1.TestObject); Assert.AreEqual(appContext.GetObject("testObject2"), m2.TestObject); }
private static void ConfigureTestApplication(TestApplication testApplication, string url) { testApplication.SetParameterValue(ApplicationParams.DontRunWebDev, "True"); testApplication.SetParameterValue(ApplicationParams.DontRunIISExpress, "True"); testApplication.SetParameterValue(ApplicationParams.DontRestartIIS, "True"); testApplication.SetParameterValue(ApplicationParams.Url, url); }
static void Main (string [] args) { var generator = Generator.GetGenerator ("Eto.Platform.Wpf.Generator, Eto.Platform.Wpf"); var app = new TestApplication (generator); app.Run (args); }
public async Task GivenDirectoryEntry_WhenRoundTripWithETag_Fail() { DirectoryClient client = TestApplication.GetDirectoryClient(); var documentId = new DocumentId("test/unit-tests/entry1"); var query = new QueryParameter() { Filter = "test", Recursive = false, }; await client.Delete(documentId); var entry = new DirectoryEntryBuilder() .SetDirectoryId(documentId) .SetClassType("test") .AddProperty(new EntryProperty { Name = "property1", Value = "value1" }) .Build(); await client.Set(entry); DirectoryEntry?readEntry = await client.Get(documentId); readEntry.Should().NotBeNull(); readEntry !.ETag.Should().NotBeNull(); readEntry.Properties.Count.Should().Be(1); var updateEntry = new DirectoryEntryBuilder(readEntry) .SetClassType("test-next") .SetETag(new ETag("0xFF9CA90CB9F5120")) .AddProperty(new EntryProperty { Name = "property2", Value = "value2" }) .Build(); bool failed; try { await client.Set(updateEntry); failed = false; } catch (Azure.RequestFailedException) { failed = true; } failed.Should().BeTrue(); await client.Delete(documentId); IReadOnlyList <DatalakePathItem> search = (await client.Search(query).ReadNext()).Records; search.Any(x => x.Name == (string)documentId).Should().BeFalse(); }
public void VsixSolutionWizardTest() { //okay so this wizard contains a dialog spawned different to the others //since it is loaded prior to the solution being created //this script just verifies the settings are netered into the dialog wihtout a crash with no visual studio solutoion context etc. var packageSettings = new XrmPackageSettings(); var container = new VsixDependencyContainer(); //purpose of this is to load modules registrations into the container as per done in the actual wizard Factory.CreateJosephMXrmVsixApp(new FakeVisualStudioService(), container, isNonSolutionExplorerContext: true); //okay spawn the wizards entry method with a fake controller var applicationController = new FakeVsixApplicationController(container); XrmSolutionWizardBase.RunWizardSettingsEntry(packageSettings, applicationController, "Fake.Name"); //okay so now we have navigated to the package entry //in our application controller via the wizard //here I inject that application conctroller into a fake application //so that I can use methods for auto testing the dialog which has spawned var fakeVsixApplication = TestApplication.CreateTestApplication(applicationController); fakeVsixApplication.AddModule <XrmPackageSettingsModule>(); var dialog = fakeVsixApplication.GetNavigatedDialog <XrmPackageSettingsDialog>(); //okay so the package entry dialog should redirect us to the connection entry when started as we dont have a connection yet var connectionEntryDialog = dialog.SubDialogs.First(); var connectionEntry = fakeVsixApplication.GetSubObjectEntryViewModel(connectionEntryDialog); var connectionToEnter = GetXrmRecordConfiguration(); fakeVsixApplication.EnterAndSaveObject(connectionToEnter, connectionEntry); //okay now the connection is entered it should navigate to the package settings entry var packageSettingsEntry = fakeVsixApplication.GetSubObjectEntryViewModel(dialog, index: 1); Assert.AreEqual("Fake", packageSettingsEntry.GetStringFieldFieldViewModel(nameof(XrmPackageSettings.SolutionObjectPrefix)).Value); //we want to verify that the object had the settings passed into it as well as the lookup connection works packageSettingsEntry.GetBooleanFieldFieldViewModel(nameof(XrmPackageSettings.AddToSolution)).Value = true; var solutionPicklistField = packageSettingsEntry.GetLookupFieldFieldViewModel(nameof(XrmPackageSettings.Solution)); solutionPicklistField.SelectedItem = solutionPicklistField.ItemsSource.ElementAt(1); Assert.IsTrue(!string.IsNullOrWhiteSpace(packageSettingsEntry.GetStringFieldFieldViewModel(nameof(XrmPackageSettings.SolutionDynamicsCrmPrefix)).Value)); var connectionsubGrid = packageSettingsEntry.GetEnumerableFieldViewModel(nameof(XrmPackageSettings.Connections)); Assert.IsTrue(connectionsubGrid.GridRecords.Any()); Assert.AreEqual(connectionToEnter.OrganizationUniqueName, connectionsubGrid.GridRecords.First().GetStringFieldFieldViewModel(nameof(SavedXrmRecordConfiguration.OrganizationUniqueName)).Value); packageSettingsEntry.SaveButtonViewModel.Invoke(); Assert.IsTrue(packageSettings.Connections.Any()); Assert.AreEqual(connectionToEnter.OrganizationUniqueName, packageSettings.Connections.First().OrganizationUniqueName); }
public override void RunApplication(TestApplication testApplication){ var physicalPath = testApplication.ParameterValue<string>(ApplicationParams.PhysicalPath); foreach (var model in Directory.GetFiles(physicalPath, "Model.User*.xafml").ToArray()) { File.Delete(model); } ConfigApplicationModel(testApplication, physicalPath); RunApplicationCore(testApplication); }
private bool GetParamValue(string name, bool defaultValue, TestApplication testApplication){ string paramValue = testApplication.FindParamValue(name); bool result; if (string.IsNullOrEmpty(paramValue) || !bool.TryParse(paramValue, out result)){ result = defaultValue; } return result; }
public static string EasyTestSettingsFile(this TestApplication application) { var path = application.AdditionalAttributes.FirstOrDefault(attribute => attribute.LocalName == "FileName")?.Value; path = path != null?Path.GetDirectoryName(path) : Path.GetFullPath(application.AdditionalAttributes.First(attribute => attribute.LocalName == "PhysicalPath").Value); return($"{path}\\EasyTestSettings.json"); }
static void Main(string[] args) { var platform = new Eto.Wpf.Platform(); var app = new TestApplication(platform); app.TestAssemblies.Add(typeof(Startup).Assembly); app.Run(); }
static void Main(string [] args) { AddStyles (); var generator = new Eto.Platform.Mac.Generator (); var app = new TestApplication (generator); app.Run (args); }
public override void KillApplication(TestApplication testApplication, KillApplicationConext context){ ScreenCaptureCommand.Stop(); if (_easyTestCommandAdapter != null) { _easyTestCommandAdapter.Disconnect(); } CloseApplication(mainProcess,true); foreach (var additionalProcess in _additionalProcesses){ CloseApplication(additionalProcess, true); } }
static void Main (string[] args) { var generator = new Eto.Platform.Wpf.Generator (); // don't use tiling for the direct drawing test Style.Add<DrawableHandler>("direct", handler => handler.AllowTiling = false); var app = new TestApplication (generator); app.Run (args); }
static void Main (string [] args) { AddStyles (); var generator = new Eto.Platform.Mac.Generator (); var app = new TestApplication (generator); // use this to use your own app delegate: // ApplicationHandler.Instance.AppDelegate = new MyAppDelegate(); app.Run (args); }
static void Main(string[] args) { var platform = new Eto.Wpf.Platform(); // optional - enables GDI text display mode /* Style.Add<Eto.Wpf.Forms.FormHandler>(null, handler => TextOptions.SetTextFormattingMode(handler.Control, TextFormattingMode.Display)); Style.Add<Eto.Wpf.Forms.DialogHandler>(null, handler => TextOptions.SetTextFormattingMode(handler.Control, TextFormattingMode.Display)); */ var app = new TestApplication(platform); app.TestAssemblies.Add(typeof(Startup).Assembly); app.Run(); }
// This is the main entry point of the application. static void Main (string[] args) { // TODO: make desktop tests work in iOS // This will require much more work on iOS port to implement required events and controls var app = new TestApplication (new Eto.Platform.iOS.Generator ()); app.Run (args); /* var app = new Application (new Eto.Platform.iOS.Generator ()); app.Initialized += delegate { app.MainForm = new MainForm (); app.MainForm.Show (); };*/ }
static void Main(string[] args) { AddStyles(); var platform = new Eto.Mac.Platform(); var app = new TestApplication(platform); app.TestAssemblies.Add(typeof(Startup).Assembly); // use this to use your own app delegate: // ApplicationHandler.Instance.AppDelegate = new MyAppDelegate(); app.Run(); }
private static void ConfigApplicationModel(TestApplication testApplication, string physicalPath){ var useModel = testApplication.ParameterValue<bool>(ApplicationParams.UseModel); if (useModel){ var logPath = Logger.Instance.GetLogger<FileLogger>().LogPath; var model = Directory.GetFiles(logPath, "*.xafml").Single(); File.Copy(Path.Combine(physicalPath, "Model.xafml"), Path.Combine(physicalPath, "restore.xafml"), true); File.Copy(model, Path.Combine(physicalPath, "Model.xafml"), true); } else{ if (File.Exists(Path.Combine(physicalPath, "restore.xafml"))){ File.Copy(Path.Combine(physicalPath, "restore.xafml"), Path.Combine(physicalPath, "Model.xafml"), true); File.Delete(Path.Combine(physicalPath, "restore.xafml")); } } }
static void Main (string[] args) { #if DEBUG Debug.Listeners.Add (new ConsoleTraceListener ()); #endif AddStyles (); var generator = new Eto.Platform.Mac.Generator (); var app = new TestApplication (generator); // use this to use your own app delegate: // ApplicationHandler.Instance.AppDelegate = new MyAppDelegate(); app.Run (args); }
public override void RunApplication(TestApplication testApplication){ if (!GetParamValue("UseIISExpress", false, testApplication)){ base.RunApplication(testApplication); } else{ string url = testApplication.GetParamValue(UrlParamName); var uri = new Uri(url); string webBrowserType = testApplication.FindParamValue("WebBrowserType"); webBrowsers = string.IsNullOrEmpty(webBrowserType) ? (IWebBrowserCollection) new WebBrowserCollection() : new StandaloneWebBrowserCollection(); if (!WebDevWebServerHelper.IsWebDevServerStarted(uri)) IISExpressServerHelper.Run(testApplication,uri); if (testApplication.FindParamValue("DefaultWindowSize") != null) { WebBrowserCollection.DefaultFormSize = GetWindowSize(testApplication.GetParamValue("DefaultWindowSize")); } this.CallMethod("CreateBrowser", url); } }
private void RunApplicationCore(TestApplication testApplication){ var defaultWindowSize = testApplication.ParameterValue<string>(ApplicationParams.DefaultWindowSize); if (defaultWindowSize != null){ WebBrowserCollection.DefaultFormSize = GetWindowSize(defaultWindowSize); } if (!testApplication.ParameterValue<bool>(ApplicationParams.UseIISExpress)){ RunApplicationBase(testApplication); } else{ var url = testApplication.ParameterValue<string>(ApplicationParams.Url); var uri = new Uri(url); webBrowsers = CreateWebBrowsers(testApplication); if (!WebDevWebServerHelper.IsWebDevServerStarted(uri)){ _process = IISExpressServerHelper.Run(testApplication, uri); } this.CreateBrowser(url); } }
private void RunApplicationBase(TestApplication testApplication){ var url = testApplication.ParameterValue<string>(ApplicationParams.Url); var uri = new Uri(url); webBrowsers=CreateWebBrowsers(testApplication); var physicalPath = testApplication.ParameterValue<string>(ApplicationParams.PhysicalPath); if (string.IsNullOrEmpty(physicalPath) && !testApplication.ParameterValue<bool>(ApplicationParams.DontRestartIIS)) { RestartIIS(); } else { if (!testApplication.ParameterValue<bool>(ApplicationParams.DontRunWebDev) && !string.IsNullOrEmpty(physicalPath)) { typeof(DevExpress.ExpressApp.EasyTest.WebAdapter.WebAdapter).CallMethod("LoadFileInfo",Path.GetFullPath(physicalPath)); if (testApplication.ParameterValue<string>(ApplicationParams.SingleWebDev) == null) { if (WebDevWebServerHelper.IsWebDevServerStarted(uri)) { WebDevWebServerHelper.KillWebDevWebServer(); } WebDevWebServerHelper.RunWebDevWebServer(Path.GetFullPath(physicalPath), uri.Port.ToString(CultureInfo.InvariantCulture)); } else { if (!WebDevWebServerHelper.IsWebDevServerStarted(uri)) { WebDevWebServerHelper.RunWebDevWebServer(Path.GetFullPath(physicalPath), uri.Port.ToString(CultureInfo.InvariantCulture)); } } } } var defaultWindowSize = testApplication.ParameterValue<string>(ApplicationParams.DefaultWindowSize); if (defaultWindowSize != null) { WebBrowserCollection.DefaultFormSize = GetWindowSize(defaultWindowSize); } var waitDebuggerAttached = testApplication.ParameterValue<bool>(ApplicationParams.WaitDebuggerAttached); if (waitDebuggerAttached) { Thread.Sleep(8000); if (Debugger.IsAttached) { MessageBox.Show("Start web application?", "Warning", MessageBoxButtons.OK); } } DateTime current = DateTime.Now; while (!WebDevWebServerHelper.IsWebDevServerStarted(uri) && DateTime.Now.Subtract(current).TotalSeconds < 60) { Thread.Sleep(200); } this.CreateBrowser(url); }
public static Process Run(TestApplication testApplication, Uri uri) { string physicalPath = Path.GetFullPath(testApplication.FindParamValue("PhysicalPath")); string arguments = string.Format(@"/path:""{0}"" /port:{1}", physicalPath, uri.Port); EasyTestTracer.Tracer.InProcedure(string.Format("RunIISExpressServer({0})", arguments)); try{ string serverPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), @"IIS Express\iisexpress.exe"); EasyTestTracer.Tracer.InProcedure(string.Format("IISExpressServerPath= {0}", serverPath)); var serverProcess = new Process{ StartInfo ={ FileName = serverPath, Arguments = arguments, UseShellExecute = true, WindowStyle = ProcessWindowStyle.Hidden } }; serverProcess.Start(); return serverProcess; } finally{ EasyTestTracer.Tracer.OutProcedure(string.Format("RunWebDevWebServer({0})", arguments)); } }
public override void KillApplication(TestApplication testApplication, KillApplicationConext context){ testApplication.ClearModel(); testApplication.DeleteParametersFile(); ScreenCaptureCommand.Stop(); webBrowsers.KillAllWebBrowsers(); var isSingleWebDev = testApplication.ParameterValue<bool>(ApplicationParams.SingleWebDev); if (!testApplication.ParameterValue<bool>(ApplicationParams.DontKillWebDev)&&_process!=null) { if (isSingleWebDev) { if (context != KillApplicationConext.TestNormalEnded) { IISExpressServerHelper.Stop(_process); } } else { IISExpressServerHelper.Stop(_process); } } }
public void OnAuthenticateRequestWithInvalidTokenCallsOnValidateTokenException() { var application = new TestApplication(new TokenValidationParameters() { AllowedAudiences = this.allowedAudiences, SigningToken = new X509SecurityToken(this.certificate), ValidIssuer = "self" }); var request = new HttpRequest(string.Empty, "http://www.example.com", string.Empty); request.AddHeader("Authorization", "Bearer invalid-token"); var sut = new TestModule(); sut.Init(application); var principal = (ClaimsPrincipal)sut.GetPrincipalFromRequestTest(request); Assert.NotNull(sut.ValidationTokenException); Assert.False(principal.Identity.IsAuthenticated); Assert.Empty(principal.Claims); }
public void ConfigureUsingXmlApplicationContext() { XmlApplicationContext appContext = new XmlApplicationContext(false, ReadOnlyXmlTestResource.GetFilePath("HttpApplicationConfigurerTests.xml", typeof(HttpApplicationConfigurerTests))); TestModule m1 = new TestModule(); TestModule m2 = new TestModule(); TestApplication appObject = new TestApplication(new ModuleEntry[] { new ModuleEntry("TestModule1", m1) , new ModuleEntry("TestModule2", m2), }); HttpApplicationConfigurer.Configure(appContext, appObject); // app configured Assert.AreEqual(appContext.GetObject("testObject"), appObject.TestObject); // modules configured Assert.AreEqual(appContext.GetObject("testObject1"), m1.TestObject); Assert.AreEqual(null, m2.TestObject); }
public void ThrowsOnUnapplicableModuleTemplate() { StaticApplicationContext appContext = CreateTestContext(); HttpApplicationConfigurer h; RootObjectDefinition rod; h = new HttpApplicationConfigurer(); rod = new RootObjectDefinition(); rod.PropertyValues.Add("TestObject", new RuntimeObjectReference("testObject1")); h.ModuleTemplates.Add("TestModule1", rod); TestApplication appObject = new TestApplication(null); HttpApplicationConfigurer.Configure(appContext, appObject); }
private static void RunAdditionalApps(TestApplication testApplication){ _additionalProcesses = new List<Process>(); var additionalApps = testApplication.ParameterValue<string>("AdditionalApplications"); if (!string.IsNullOrEmpty(additionalApps)) foreach (var app in additionalApps.Split(';')) { var fullPath = Path.GetFullPath(app); var process = new Process { StartInfo = new ProcessStartInfo(fullPath) }; process.Start(); _additionalProcesses.Add(process); } }
public override void RunApplication(TestApplication testApplication){ string appName=testApplication.GetParamValue("FileName"); var directoryName = DeleteUserModel(appName); DeleteLogonParametersFile(directoryName); RunAdditionalApps(testApplication); base.RunApplication(testApplication); }
public void OnAuthenticateRequestWithTokenSetsApplicationContextUser() { var application = new TestApplication(new TokenValidationParameters() { AllowedAudiences = this.allowedAudiences, SigningToken = new X509SecurityToken(this.certificate), ValidIssuer = "self" }); var request = new HttpRequest(string.Empty, "http://www.example.com", string.Empty); request.AddHeader("Authorization", "Bearer " + this.GenerateAuthToken("http://www.example.com")); var sut = new TestModule(); sut.Init(application); var principal = (ClaimsPrincipal)sut.GetPrincipalFromRequestTest(request); Assert.True(principal.Identity.IsAuthenticated); Assert.True(principal.HasClaim(ClaimTypes.Name, "Username")); Assert.True(principal.HasClaim(ClaimTypes.Role, "User")); }
void StartEngine(bool initiator) { TestApplication application = new TestApplication(LogonCallback, LogoffCallback); IMessageStoreFactory storeFactory = new MemoryStoreFactory(); ILogFactory logFactory = new ScreenLogFactory(false, false, false); SessionSettings settings = new SessionSettings(); if (initiator) { Dictionary defaults = new Dictionary(); defaults.SetString(SessionSettings.RECONNECT_INTERVAL, "1"); settings.Set(defaults); settings.Set(CreateSessionID(StaticInitiatorCompID), CreateSessionConfig(StaticInitiatorCompID, true)); _initiator = new SocketInitiator(application, storeFactory, settings, logFactory); _initiator.Start(); } else { settings.Set(CreateSessionID(StaticAcceptorCompID), CreateSessionConfig(StaticAcceptorCompID, false)); _acceptor = new ThreadedSocketAcceptor(application, storeFactory, settings, logFactory); _acceptor.Start(); } }
public void InitWithValidContextSucceeds() { var sut = new JwtValidationModule(); var testApp = new TestApplication(new TokenValidationParameters() { AllowedAudiences = this.allowedAudiences, SigningToken = new X509SecurityToken(this.certificate), ValidIssuer = "self" }); sut.Init(testApp); // TODO: Find a way to verify we are properly registering to AuthenticateRequest. }