public async Task SingletonServiceIsDefferentPerTenant_WhenUseMultitenancy() { // Act string responseFirstTenant_11 = await ClientSingleton.GetStringAsync(UrlTenant1).ConfigureAwait(false); string responseFirstTenant_12 = await ClientSingleton.GetStringAsync(UrlTenant1).ConfigureAwait(false); string responseSecondTenant_21 = await ClientSingleton.GetStringAsync(UrlTenant2).ConfigureAwait(false); string responseSecondTenant_22 = await ClientSingleton.GetStringAsync(UrlTenant2).ConfigureAwait(false); // Assert string[] col = new[] { responseFirstTenant_11, responseFirstTenant_12, responseSecondTenant_21, responseSecondTenant_22 }; Assert.All(col, x => Assert.NotNull(x)); Assert.All(col, x => Assert.NotEqual(string.Empty, x)); // Begin with tenant1. Assert.All(new[] { responseFirstTenant_11, responseFirstTenant_12 }, x => Assert.StartsWith("Tenant 1", x)); // Begin with tenant2. Assert.All(new[] { responseSecondTenant_21, responseSecondTenant_22 }, x => Assert.StartsWith("Tenant 2", x)); // singleton is same between same tenant,and different with different tenant Assert.Equal(responseFirstTenant_11, responseFirstTenant_12); Assert.Equal(responseSecondTenant_21, responseSecondTenant_22); Assert.NotEqual(responseFirstTenant_11, responseSecondTenant_21); }
public LogModel() { Logs = new ObservableCollection <LogEntry>(); LogsToShow = new ObservableCollection <Tuple <string, string> >(); LogsToShow.Add(new Tuple <string, string>("WARNING", "hi im warning log")); LogsToShow.Add(new Tuple <string, string>("WARNING", "hi im warning log2")); LogsToShow.Add(new Tuple <string, string>("ERROR", "hi im ERROR log")); LogsToShow.Add(new Tuple <string, string>("ERROR", "hi im ERROR log2")); FilterType = ""; ClientSingleton client = ClientSingleton.ClientInsatnce; if (client.IsConnected) { this.isConnected = true; string[] args = { }; CommandRecievedEventArgs e = new CommandRecievedEventArgs((int)CommandEnum.GetLogList, args, ""); client.SendCommand(e); } else { this.isConnected = false; } }
/// <summary> /// Do the dispose. /// </summary> public void Dispose() { Server?.Dispose(); ClientTransient?.Dispose(); ClientSingleton?.Dispose(); ClientScoped?.Dispose(); ClientOverrideTransient?.Dispose(); ClientOverrideSingleton?.Dispose(); }
/// <summary> /// Initializes a new instance of the <see cref="LogModel"/> class. /// </summary> public LogModel() { CommandReceivedEventArgs e = new CommandReceivedEventArgs( (int)CommandEnum.LogCommand, null, null); client = ClientSingleton.getInstance; client.CommandReceivedEvent += logOnCommand; WriteToClient(e); client.wait(); model_log = new ObservableCollection <Log>(); }
/// <summary> /// Initializes a new instance of the <see cref="WindowsModel"/> class. /// </summary> public WindowsModel() { client = ClientSingleton.getInstance; if (client.CheckIfServerConnect()) { m_backgroundColor = "White"; } else { m_backgroundColor = "Gray"; } }
/// <summary> /// Initializes a new instance of the <see cref="SettingModel"/> class. /// </summary> public SettingModel() { CommandReceivedEventArgs e = new CommandReceivedEventArgs( (int)CommandEnum.GetConfigCommand, null, null); setting = new Setting(); client = ClientSingleton.getInstance; client.CommandReceivedEvent += settingsOnCommand; modelSettingsHandlers = new ObservableCollection <string>(); WriteToClient(e); client.wait(); }
public static void Main(string[] args) { ////Console.WriteLine("Hello World!"); //CTCIString cTCI = new CTCIString(); //cTCI.AllStrings(); //BackTracking BT = new BackTracking(); //BT.AllBackTracking(); //DivideAndConquer dq = new DivideAndConquer(); //dq.AllDivideAndConquer(); //CTCITrees cTCITree = new CTCITrees(); //cTCITree.AllTree(); CTCIRecursionDP R = new CTCIRecursionDP(); R.AllRecursionDP(); //CTCIModerate M = new CTCIModerate(); //M.AllModerate(); //Design Patterns //ClientFactory c = new ClientFactory(); //c.Calculate(); //ClientTemplete c = new ClientTemplete(); //c.Process(); //CTCIGraphs g = new CTCIGraphs(); //g.AllGraphs(); //CTCISortSearch g = new CTCISortSearch(); //g.AllSortSearch(); //CTCIStacksQueue sq = new CTCIStacksQueue(); //sq.AllStack(); /*******************SOLID*****************/ //SingleResponsibility sr = new SingleResponsibility(); //sr.Purchase(); //OpenClose oc = new OpenClose(); //oc.GetInvoiceDiscount(); //LiskovSubstitution ls = new LiskovSubstitution(); //ls.SubmitApp(); //InterfaceSegration s = new InterfaceSegration(); //s.GetProfile(); //DependancyInversionExample2 di = new DependancyInversionExample2(); //di.Notification(); /***************************************************/ //Design Pattern ClientSingleton c = new ClientSingleton(); c.SingletonClient(); CacheClient cache = new CacheClient(); cache.AddToCache(); Prototype p = new Prototype(); p.PrototypeDP(); FactoryMethodDP fm = new FactoryMethodDP(); fm.FactoryMethod(); BuilderDP b = new BuilderDP(); b.BuildCar(); AdapterDP a = new AdapterDP(); a.GetClientProfile(); Facade f = new Facade(); f.ApplicationSumission(); DependancyInjectionDP d = new DependancyInjectionDP(); d.GetEmployee(); Observer_PubSub ps = new Observer_PubSub(); ps.Observer(); }
public Program() { _client2 = ClientSingleton.Instance; }
public UserExperience(ClientSingleton _client, SqlClient _sql) { this._sql = _sql; this._client = _client; UserView(); }