Skip to content

Commit

Permalink
Refactor: Update tests to use latest version of Moesif.Api
Browse files Browse the repository at this point in the history
Refactor: Update tests to use latest version of Moesif.Api
Refactor: Update userAgentString to 1.5.0
  • Loading branch information
keyur9 committed Nov 8, 2024
1 parent b5d72b9 commit d350281
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions Moesif.Middleware/NetCore/MoesifMiddlewareNetCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Moesif.Middleware.NetCore
{
public class MoesifMiddlewareNetCore
{
public static string APP_VERSION = "moesif-netcore/1.4.9";
public static string APP_VERSION = "moesif-netcore/1.5.0";
private readonly RequestDelegate _next;

public Dictionary<string, object> moesifOptions;
Expand Down Expand Up @@ -110,31 +110,31 @@ public MoesifMiddlewareNetCore(Dictionary<string, object> _middleware)

public MoesifMiddlewareNetCore(RequestDelegate next, Dictionary<string, object> _middleware, ILoggerFactory logger)
{
#if MOESIF_INSTRUMENT
#if MOESIF_INSTRUMENT
Stopwatch stopwatch = stopwatch = new Stopwatch();
stopwatch.Start();
long createLoggerTime = 0;
long createInitCientAndOptTime = 0;
long fetchAppConfigTime = 0;
long fetchGovRuleTime = 0;
#endif
#endif

moesifOptions = _middleware;
_logger = logger.CreateLogger("Moesif.Middleware.NetCore");
loggerHelper = new LoggerHelper(_logger);

#if MOESIF_INSTRUMENT
#if MOESIF_INSTRUMENT
{
createLoggerTime = stopwatch.ElapsedMilliseconds;
stopwatch.Restart();
}
#endif
#endif

try
{
// Initialize client
debug = loggerHelper.GetConfigBoolValues(moesifOptions, "LocalDebug", false);
client = new MoesifApiClient(moesifOptions["ApplicationId"].ToString(), "moesif-netcore/1.4.9", debug);
client = new MoesifApiClient(moesifOptions["ApplicationId"].ToString(), APP_VERSION, debug);
logBody = loggerHelper.GetConfigBoolValues(moesifOptions, "LogBody", true);
isLambda = loggerHelper.GetConfigBoolValues(moesifOptions, "IsLambda", false);
_next = next;
Expand All @@ -161,12 +161,12 @@ public MoesifMiddlewareNetCore(RequestDelegate next, Dictionary<string, object>
apiVersion = null;
}

#if MOESIF_INSTRUMENT
#if MOESIF_INSTRUMENT
{
createInitCientAndOptTime = stopwatch.ElapsedMilliseconds;
stopwatch.Restart();
}
#endif
#endif
//MoesifQueue = new ConcurrentQueue<EventModel>(); // Initialize queue
//governance = Governance.getDefaultGovernance();
//configEvent = new AutoResetEvent(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public MoesifMiddlewareNetFramework(Dictionary<String,object> options) : base(nu
_logger = null;
loggerHelper = new LoggerHelper(_logger);
debug = loggerHelper.GetConfigBoolValues(moesifOptions, "LocalDebug", false);
client = new MoesifApiClient(moesifOptions["ApplicationId"].ToString(), "moesif-netframework/1.4.9", debug);
client = new MoesifApiClient(moesifOptions["ApplicationId"].ToString(), "moesif-netframework/1.5.0", debug);
userHelper = new UserHelper(); // Create a new instance of userHelper
companyHelper = new CompanyHelper(); // Create a new instane of companyHelper
clientIpHelper = new ClientIp(); // Create a new instance of client Ip
Expand All @@ -98,7 +98,7 @@ public MoesifMiddlewareNetFramework(OwinMiddleware next, Dictionary<string, obje
{
// Initialize client
debug = loggerHelper.GetConfigBoolValues(moesifOptions, "LocalDebug", false);
client = new MoesifApiClient(moesifOptions["ApplicationId"].ToString(), "moesif-netframework/1.4.9", debug);
client = new MoesifApiClient(moesifOptions["ApplicationId"].ToString(), "moesif-netframework/1.5.0", debug);
logBody = loggerHelper.GetConfigBoolValues(moesifOptions, "LogBody", true);
isBatchingEnabled = loggerHelper.GetConfigBoolValues(moesifOptions, "EnableBatching", true); // Enable batching
disableStreamOverride = loggerHelper.GetConfigBoolValues(moesifOptions, "DisableStreamOverride", false); // Reset Request Body position
Expand Down
2 changes: 1 addition & 1 deletion Moesif.NetCore.Test/Moesif.NetCore.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageReference Include="Moq" Version="4.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.2.0" />
<PackageReference Include="Moesif.Api" Version="2.0.8" />
<PackageReference Include="Moesif.Api" Version="2.0.9" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Moesif.NetFramework.Test/Moesif.NetFramework.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
<Reference Include="Microsoft.Owin, Version=4.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.4.2.2\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>
<Reference Include="Moesif.Api, Version=2.0.8.0, Culture=neutral, PublicKeyToken=b3d293efeab4ba1f, processorArchitecture=MSIL">
<HintPath>..\packages\Moesif.Api.2.0.8\lib\net45\Moesif.Api.dll</HintPath>
<Reference Include="Moesif.Api, Version=2.0.9.0, Culture=neutral, PublicKeyToken=b3d293efeab4ba1f, processorArchitecture=MSIL">
<HintPath>..\packages\Moesif.Api.2.0.9\lib\net45\Moesif.Api.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.12.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.12.0\lib\net45\Moq.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion Moesif.NetFramework.Test/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<package id="Microsoft.Extensions.Options" version="3.1.32" targetFramework="net461" />
<package id="Microsoft.Extensions.Primitives" version="3.1.32" targetFramework="net461" />
<package id="Microsoft.Owin" version="4.2.2" targetFramework="net461" />
<package id="Moesif.Api" version="2.0.8" targetFramework="net461" />
<package id="Moesif.Api" version="2.0.9" targetFramework="net461" />
<package id="Moq" version="4.12.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net461" />
<package id="NUnit" version="3.12.0" targetFramework="net461" />
Expand Down

0 comments on commit d350281

Please sign in to comment.