public void can_get_Application_by_name_from_a_ApplicationList() { var list = new ApplicationList(); list.Add(new Application(Method("Foo"))); list.Add(new Application(Method("ObjectParam"))); list.Add(new Application(Method("WithAttribute2"))); list["Does not exist"].Should(Be.Null); list["CustomName"].MethodFullName.ShouldEqual("ConsoleRack.Specs.ApplicationSpec.WithAttribute2"); list["ConsoleRack.Specs.ApplicationSpec.Foo"].Invoke("hello", "foo").Text.ShouldEqual("You requested: hello, foo\n"); }
internal static ApplicationList GetApplicationList() { var appList = new ApplicationList(); Debug.WriteLine("Application", "TurbineLite"); using (var db = new ProducerContext()) { Debug.WriteLine("Application ProducerContext", "TurbineLite"); foreach (var entity in db.Applications) { Debug.WriteLine("Application Add", "TurbineLite"); Application app = new Application { Name = entity.Name, Inputs = new InputTypeList() }; appList.Add(app); foreach (var i in app.Inputs) { app.Inputs.Add(new InputType() { Name = i.Name, Required = i.Required, Type = i.Type }); } } } return(appList); }
private static void AddAppMock(Mock <QueryManagerWrapper> queryManagerMock, string appName, ApplicationList appList) { appList.Add(MockQueryApplicationFactory.CreateApplication(appName)); queryManagerMock.Setup(i => i.GetServiceListAsync(It.Is <Uri>(uri => uri.AbsoluteUri == $"fabric:/{appName}"))) .ReturnsAsync(new ServiceList() { CreateStatelessServiceInstance(new Uri($"fabric:/{appName}Service"), "apiServiceType", "1.0", HealthState.Ok, ServiceStatus.Active) }); var partGuid = Guid.NewGuid(); var partition = CreateServicePartition(partGuid); queryManagerMock .Setup(i => i.GetPartitionListAsync(It.Is <Uri>(uri => uri.AbsoluteUri == $"fabric:/{appName}Service"))) .ReturnsAsync(new ServicePartitionList() { partition }); queryManagerMock.Setup(i => i.GetReplicaListAsync(It.Is <Guid>(g => g == partGuid))).ReturnsAsync( new ServiceReplicaList() { new MockedReplica(ServiceKind.Stateless, 1, ServiceReplicaStatus.Ready, HealthState.Ok, GetReplicaAddressJson($"http://{appName}:1234"), "nodeA", TimeSpan.MinValue) }); }
public void PagedApplicationListSerializationTest() { ApplicationList applicationList = new ApplicationList(); applicationList.ContinuationToken = "fabric:/MyApp"; applicationList.Add(this.random.CreateRandom <Application>()); TestUsingSerializer(this.Serializer, applicationList); }
public void CountealthStateTest() { ApplicationList appsList = new ApplicationList(); StringBuilder sb = new StringBuilder(); Application app1 = new Application(); Application app2 = new Application(); Application app3 = new Application(); app1.HealthState = HealthState.Ok; app2.HealthState = HealthState.Warning; app3.HealthState = HealthState.Error; appsList.Add(app1); appsList.Add(app2); appsList.Add(app3); FileLogCollector.CountHealthState(appsList, sb); Assert.AreEqual("OK: 1 Warning: 1 Error: 1" + Environment.NewLine, sb.ToString()); }
/// <summary> /// GetApplications /// </summary> /// <param name="userContext">User context.</param> /// <returns> /// Returns list of applications or null if no applications are found. /// </returns> public ApplicationList GetApplications(IUserContext userContext) { ApplicationList applicationList; List <WebApplication> webApplicationList; CheckTransaction(userContext); webApplicationList = WebServiceProxy.UserService.GetApplications(GetClientInformation(userContext)); applicationList = new ApplicationList(); foreach (WebApplication webApplication in webApplicationList) { applicationList.Add(GetApplication(userContext, webApplication)); } return(applicationList); }
private static void InsertPlugin(Plugin plugin, string[] args) { switch (plugin.PluginType) { case PluginType.Application: ApplicationList.Add((ApplicationPlugin)plugin); Logger.Origin($"应用 \"{plugin.Name}\" 已经加载完毕。"); break; case PluginType.Service: default: ServicePlugin svcPlugin = (ServicePlugin)plugin; svcPlugin.Execute(args); ServiceList.Add(svcPlugin); Logger.Origin($"服务 \"{svcPlugin.Name}\" 已经加载完毕。"); break; } }
public void Add(ApplicationVM obj) { ApplicationList.Add(obj); }