using MonkeyCache.FileStore; using NUnit.Framework; using Serilog; using System; using TINK.Model.Connector; using TINK.Model.Services.CopriApi.ServerUris; using UITest.Fixtures.Connector; namespace TestTINKLib.Fixtures.Misc { [TestFixture] [Category(TestCopriCallsHttps.CATEGORY_REQUIRESCOPRI)] public class TestCachetimings { [Test] #if !NOLIVESERVER [Explicit("Run with care because this stress impact live system.")] //[Category(TestCopriCallsHttps.CATEGORY_USESLIVESERVER)] #elif !NODEVELSERVER [Category(TestCopriCallsHttps.CATEGORY_USESDEVELSERVER)] #endif public void TestCachedQuery_GetStationsAll( #if NOLIVESERVER [Values(CopriServerUriList.SHAREE_DEVEL)] string url, #elif NODEVELSERVER [Values(CopriServerUriList.SHAREE_LIVE)] string url, #else [Values(CopriServerUriList.SHAREE_DEVEL, CopriServerUriList.SHAREE_LIVE)] string url, #endif [Values(";", "6103_4da3044c8657a04ba60e2eaa753bc51a_;javaminister@gmail.com")] string cookieAndMail) { Barrel.ApplicationId = GetType().Name + nameof(TestCachedQuery_GetStationsAll); Log .Logger = new LoggerConfiguration() .MinimumLevel.ControlledBy(new Serilog.Core.LoggingLevelSwitch(Serilog.Events.LogEventLevel.Error)) .WriteTo.Debug() .CreateLogger(); var connector = ConnectorFactory.Create( true, // Is connected new Uri(url), "TestTINKApp/3.0.127 AutomatedTestEnvirnoment/" + nameof(TestCachedQuery_GetStationsAll), cookieAndMail.Split(';')[0], cookieAndMail.Split(';')[1], TimeSpan.FromSeconds(3)); // See task #97 for need of custom expiresAfter value. var start = DateTime.Now; var queryIndex = 1; while (DateTime.Now.Subtract(start).TotalSeconds < 60) { Log.ForContext().Information($"Query #{queryIndex}"); var result = connector.Query.GetBikesAndStationsAsync().Result; Assert.IsNull(result.Exception, $"Exception message: {result.Exception?.Message}"); queryIndex++; } } /// /// From COPRI version v4.1 switched from TINK devel https://tinkwwp.copri-bike.de/APIjsonserver to sharee devel https://shareeapp-primary.copri-bike.de/APIjsonserver /// /// /// [Test] #if !NOLIVESERVER [Explicit("Run with care because this stress impact live system.")] //[Category(TestCopriCallsHttps.CATEGORY_USESLIVESERVER)] #elif !NODEVELSERVER [Category(TestCopriCallsHttps.CATEGORY_USESDEVELSERVER)] #endif public void TestCachedQuery_GetBikes( #if NOLIVESERVER [Values(CopriServerUriList.SHAREE_DEVEL)] string url, #elif NODEVELSERVER [Values(CopriServerUriList.SHAREE_LIVE)] string url, #else [Values(CopriServerUriList.SHAREE_DEVEL, CopriServerUriList.SHAREE_LIVE)] string url, #endif [Values(";", "6103_4da3044c8657a04ba60e2eaa753bc51a_;javaminister@gmail.com")] string cookieAndMail) { Barrel.ApplicationId = GetType().Name + nameof(TestCachedQuery_GetBikes); Log.Logger = new LoggerConfiguration() .MinimumLevel.ControlledBy(new Serilog.Core.LoggingLevelSwitch(Serilog.Events.LogEventLevel.Error)) .WriteTo.Debug() .CreateLogger(); var connector = ConnectorFactory.Create( true, // Is connected new Uri(url), "Testsharee.bikeApp/3.0.223 AutomatedTestEnvirnoment/" + nameof(TestCachedQuery_GetBikes), cookieAndMail.Split(';')[0], cookieAndMail.Split(';')[1], TimeSpan.FromSeconds(3)); // See task #97 for need of custom expiresAfter value. var start = DateTime.Now; var queryIndex = 1; while (DateTime.Now.Subtract(start).TotalSeconds < 60) { Log.ForContext().Information($"Query #{queryIndex}"); var result = connector.Query.GetBikesAsync().Result; Assert.IsNull(result.Exception, $"Exception message: {result.Exception?.Message}"); queryIndex++; } } [Test] #if !NOLIVESERVER [Explicit("Run with care because this stress impact live system.")] //[Category(TestCopriCallsHttps.CATEGORY_USESLIVESERVER)] #elif !NODEVELSERVER [Category(TestCopriCallsHttps.CATEGORY_USESDEVELSERVER)] #endif public void TestCachedQuery_GetBikesOccupied( #if NOLIVESERVER [Values(CopriServerUriList.SHAREE_DEVEL)] string url, #elif NODEVELSERVER [Values(CopriServerUriList.SHAREE_LIVE)] string url, #else [Values(CopriServerUriList.SHAREE_DEVEL, CopriServerUriList.SHAREE_LIVE)] string url, #endif [Values("6103_4da3044c8657a04ba60e2eaa753bc51a_;javaminister@gmail.com")] string cookieAndMail) { Barrel.ApplicationId = GetType().Name + nameof(TestCachedQuery_GetBikes); Log.Logger = new LoggerConfiguration() .MinimumLevel.ControlledBy(new Serilog.Core.LoggingLevelSwitch(Serilog.Events.LogEventLevel.Verbose)) .WriteTo.Debug() .WriteTo.File($"Log{nameof(TestCachedQuery_GetBikes)}.log") .CreateLogger(); var connector = ConnectorFactory.Create( true, // Is connected new Uri(url), "TestTINKApp/3.0.127 AutomatedTestEnvirnoment/" + nameof(TestCachedQuery_GetBikes), cookieAndMail.Split(';')[0], cookieAndMail.Split(';')[1], TimeSpan.FromSeconds(3)); // See task #97 for need of custom expiresAfter value. var start = DateTime.Now; var queryIndex = 1; while (DateTime.Now.Subtract(start).TotalSeconds < 60) { Log.ForContext().Information($"Query #{queryIndex}"); var result = connector.Query.GetBikesOccupiedAsync().Result; Assert.IsNull(result.Exception, $"Exception message: {result.Exception?.Message}"); queryIndex++; } } } }