Skip to content
Snippets Groups Projects
Commit 597e68e0 authored by Michal Ondrejička's avatar Michal Ondrejička Committed by Daniel Andrášik
Browse files

Fix client address

Ref #38
Changelog: fixed
parent 8d8fb1a8
No related branches found
No related tags found
No related merge requests found
image : mcr.microsoft.com/dotnet/sdk:5.0
image : mcr.microsoft.com/dotnet/sdk:6.0
stages:
- build
......@@ -43,7 +43,7 @@ deploy:
expire_in: 1 week
script:
- dotnet pack -c Release
- dotnet nuget add source https://gitlab.twinzo.eu/api/v4/projects/189/packages/nuget/index.json -n gitlab_tDevkit -u lorant.bugar -p Yx5G3Xnp-QnVsCo4FwyJ --store-password-in-clear-text
- dotnet nuget add source https://gitlab.twinzo.eu/api/v4/projects/189/packages/nuget/index.json -n gitlab_tDevkit -u gitlab+deploy-token-4 -p nidd5s9XWfRVCLGbt6cH --store-password-in-clear-text
- dotnet nuget push "SDK/bin/Release/*.nupkg" --source gitlab_tDevkit
only:
- master
......
using SDK.Contracts.Communication;
using SDK.Exceptions;
using SDK.Models;
using System.Threading.Tasks;
namespace SDK
{
public partial class DevkitConnectorV3
{
public async Task<LogContract> AddLog(LogContract logContract)
{
string subUrl = Address.UrlCombine(Address.LogAdd);
return await PostRequest<LogContract>(subUrl, logContract);
}
}
}
using SDK.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace SDK.Contracts.Communication
{
[DataContract]
public class LogContract
{
[DataMember(Order = 1)]
public int Id { get; set; }
[DataMember(Order = 2)]
public int AccountId { get; set; }
[DataMember(Order = 3)]
public string Message { get; set; }
[DataMember(Order = 4)]
public string Level { get; set; }
[DataMember(Order = 5)]
public long Timestamp { get; set; }
[DataMember(Order = 6)]
public int BranchId { get; set; }
[DataMember(Order = 8)]
public string Login { get; set; }
}
}
......@@ -29,7 +29,7 @@ namespace SDK.Models
public const string Branches = "branches/";
public const string Clients = "branches/";
public const string Clients = "clients/";
public const string Configuration = "configuration/";
public const string ConfigurationBranch = "configuration/branch/";
......@@ -48,6 +48,8 @@ namespace SDK.Models
public const string LocalizationAddData = "localization/";
public const string LocalizationAddDataBatch = "localization/batch/";
public const string LogAdd = "logs";
public const string Sectors = "sectors/";
public const string Sensors = "sensors/";
......
......@@ -2,10 +2,10 @@
<PropertyGroup>
<PackageId>tDevKit</PackageId>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<AssemblyVersion>2021.6.28.25</AssemblyVersion>
<FileVersion>2021.6.28.25</FileVersion>
<Version>4.4.0</Version>
<Version>4.7.0</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
......
......@@ -26,6 +26,7 @@ namespace Test.V3
const string CONFIGURATION = "configuration";
const string DEVICES = "devices";
const string LAYERS = "layers";
const string LOG = "logs";
const string SECTORS = "sectors";
static WireMockServer server;
......@@ -248,6 +249,30 @@ namespace Test.V3
Assert.IsInstanceOfType(response, typeof(LayerContract[]));
}
[TestCategory("Log")]
[TestMethod]
public async Task PostLog_ShouldReturnLogContract()
{
var bodyContent = new LogContract()
{
Login = "login",
AccountId = 1,
Level = "Info",
Message = "message"
};
server.Given(Request.Create().WithPath(PATH_BASE + LOG).UsingPost())
.RespondWith(
Response.Create()
.WithStatusCode(200)
.WithBodyAsJson(bodyContent)
);
var response = await devkitConnector.AddLog(bodyContent);
Assert.IsInstanceOfType(response, typeof(LogContract));
}
[TestCategory("Sector")]
[TestMethod]
public async Task GetSector_GetDeviceByLogin_ShouldReturn200()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment