Commit 707adec0 authored by Andreas Müller's avatar Andreas Müller
Browse files

First implementation of the Divera 24/7 API

parent 4914023e
......@@ -15,6 +15,7 @@
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
<PackageReference Include="Unclassified.DeepConvert" Version="1.3.0" />
</ItemGroup>
<ItemGroup>
......
......@@ -4,13 +4,13 @@ using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using AMWD.Net.Api.Divera.Models;
using AMWD.Net.Api.Divera.Requests;
using AMWD.Net.Api.Divera.Responses;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Moq.Protected;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace AMWD.Net.Api.Divera.Test
{
......@@ -18,15 +18,12 @@ namespace AMWD.Net.Api.Divera.Test
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public class CloseAlarmTests : TestBase
{
private static readonly string jsonMimeType = "application/json";
private static readonly DateTime date = new(2022, 1, 9, 11, 22, 33, DateTimeKind.Utc);
[TestMethod]
public async Task ShouldMapFullRequest()
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = true });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = true });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new CloseAlarmRequest
......@@ -48,12 +45,12 @@ namespace AMWD.Net.Api.Divera.Test
Assert.AreEqual(HttpMethod.Post, requestCallback.Method);
Assert.IsNotNull(requestCallback.Content);
var callbackJson = JsonConvert.DeserializeObject<JObject>(requestCallback.Content);
var callback = HttpUtility.ParseQueryString(requestCallback.Content);
Assert.AreEqual(request.Id, callbackJson["id"]);
Assert.AreEqual(request.IsClosed, callbackJson["closed"].Value<bool>());
Assert.AreEqual(request.Report, callbackJson["report"]);
Assert.AreEqual(request.TimestampUnix, callbackJson["ts"]);
Assert.AreEqual(request.Id, Convert<int?>(callback["Alarm[id]"]));
Assert.AreEqual(request.IsClosed, Convert<bool?>(callback["Alarm[closed]"]));
Assert.AreEqual(request.Report, callback["Alarm[report]"]);
Assert.AreEqual(request.TimestampUnix, Convert<int?>(callback["Alarm[ts]"]));
httpMessageHandlerMock.Protected().Verify("SendAsync", Times.Exactly(1), ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>());
}
......@@ -63,7 +60,7 @@ namespace AMWD.Net.Api.Divera.Test
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = true });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = true });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var api = GetApi(accessKey);
......@@ -85,7 +82,7 @@ namespace AMWD.Net.Api.Divera.Test
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = true });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = true });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new CloseAlarmRequest();
......@@ -127,7 +124,7 @@ namespace AMWD.Net.Api.Divera.Test
}
[TestMethod]
public async Task ShouldReturnFalseOnHttpError()
public async Task ShouldThrowExceptionOnHttpError()
{
// arrange
string accessKey = "abc";
......@@ -137,15 +134,24 @@ namespace AMWD.Net.Api.Divera.Test
var api = GetApi(accessKey);
// act
bool response = await api.CloseAlarm(request);
string exceptionMessage = null;
try
{
bool response = await api.CloseAlarm(request);
Assert.Fail();
}
catch (DiveraException ex)
{
exceptionMessage = ex.Message;
}
// assert
Assert.IsFalse(response);
Assert.IsNotNull(requestCallback);
Assert.AreEqual($"{DiveraApiUrls.CloseAlarm}?accesskey={accessKey}", requestCallback.RequestUri.ToString());
Assert.AreEqual(HttpMethod.Post, requestCallback.Method);
Assert.IsNotNull(requestCallback.Content);
Assert.AreEqual($"HTTP error ({(int)httpResponseMessage.StatusCode}): ", exceptionMessage);
httpMessageHandlerMock.Protected().Verify("SendAsync", Times.Exactly(1), ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>());
}
......@@ -155,7 +161,7 @@ namespace AMWD.Net.Api.Divera.Test
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = false });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = false });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new CloseAlarmRequest { Id = 123 };
......
......@@ -4,14 +4,14 @@ using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using AMWD.Net.Api.Divera.Enums;
using AMWD.Net.Api.Divera.Models;
using AMWD.Net.Api.Divera.Requests;
using AMWD.Net.Api.Divera.Responses;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Moq.Protected;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace AMWD.Net.Api.Divera.Test
{
......@@ -19,14 +19,12 @@ namespace AMWD.Net.Api.Divera.Test
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public class ConfirmEventTests : TestBase
{
private static readonly string jsonMimeType = "application/json";
[TestMethod]
public async Task ShouldMapFullRequest()
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = true });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = true });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new ConfirmEventRequest
......@@ -47,11 +45,11 @@ namespace AMWD.Net.Api.Divera.Test
Assert.AreEqual(HttpMethod.Post, requestCallback.Method);
Assert.IsNotNull(requestCallback.Content);
var callbackJson = JsonConvert.DeserializeObject<JObject>(requestCallback.Content);
var callback = HttpUtility.ParseQueryString(requestCallback.Content);
Assert.AreEqual(request.EventId, callbackJson["event_id"]);
Assert.AreEqual((int)request.Type, callbackJson["type"]);
Assert.AreEqual(request.Message, callbackJson["custom_answer"]);
Assert.AreEqual(request.EventId, Convert<int?>(callback["Confirmation[event_id]"]));
Assert.AreEqual((int)request.Type, Convert<int>(callback["Confirmation[type]"]));
Assert.AreEqual(request.Message, callback["Confirmation[custom_answer]"]);
httpMessageHandlerMock.Protected().Verify("SendAsync", Times.Exactly(1), ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>());
}
......@@ -61,7 +59,7 @@ namespace AMWD.Net.Api.Divera.Test
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = true });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = true });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var api = GetApi(accessKey);
......@@ -83,7 +81,7 @@ namespace AMWD.Net.Api.Divera.Test
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = true });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = true });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new ConfirmEventRequest
......@@ -111,7 +109,7 @@ namespace AMWD.Net.Api.Divera.Test
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = true });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = true });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new ConfirmEventRequest
......@@ -157,7 +155,7 @@ namespace AMWD.Net.Api.Divera.Test
}
[TestMethod]
public async Task ShouldReturnFalseOnHttpError()
public async Task ShouldThrowExceptionOnHttpError()
{
// arrange
string accessKey = "abc";
......@@ -167,14 +165,25 @@ namespace AMWD.Net.Api.Divera.Test
var api = GetApi(accessKey);
// act
bool response = await api.ConfirmEvent(request);
string exceptionMessage = null;
try
{
bool response = await api.ConfirmEvent(request);
Assert.Fail();
}
catch (DiveraException ex)
{
exceptionMessage = ex.Message;
}
// assert
Assert.IsFalse(response);
Assert.IsNotNull(requestCallback);
Assert.AreEqual($"{DiveraApiUrls.ConfirmEvent}?accesskey={accessKey}", requestCallback.RequestUri.ToString());
Assert.AreEqual(HttpMethod.Post, requestCallback.Method);
Assert.IsNotNull(requestCallback.Content);
Assert.AreEqual($"HTTP error ({(int)httpResponseMessage.StatusCode}): ", exceptionMessage);
httpMessageHandlerMock.Protected().Verify("SendAsync", Times.Exactly(1), ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>());
}
......@@ -183,7 +192,7 @@ namespace AMWD.Net.Api.Divera.Test
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = false });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = false });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new ConfirmEventRequest { EventId = 42, Type = EventConfirmType.NotSure };
......
......@@ -4,13 +4,13 @@ using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using AMWD.Net.Api.Divera.Models;
using AMWD.Net.Api.Divera.Requests;
using AMWD.Net.Api.Divera.Responses;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Moq.Protected;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace AMWD.Net.Api.Divera.Test
{
......@@ -18,14 +18,12 @@ namespace AMWD.Net.Api.Divera.Test
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public class ConfirmSurveyTests : TestBase
{
private static readonly string jsonMimeType = "application/json";
[TestMethod]
public async Task ShouldMapFullRequest()
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = true });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = true });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new ConfirmSurveyRequest
......@@ -47,12 +45,12 @@ namespace AMWD.Net.Api.Divera.Test
Assert.AreEqual(HttpMethod.Post, requestCallback.Method);
Assert.IsNotNull(requestCallback.Content);
var callbackJson = JsonConvert.DeserializeObject<JObject>(requestCallback.Content);
var callback = HttpUtility.ParseQueryString(requestCallback.Content);
Assert.AreEqual(request.SurveyId, callbackJson["news_survey_id"]);
Assert.AreEqual(request.AnswerId, callbackJson["news_survey_answer_id"]);
Assert.AreEqual(request.IsChecked, callbackJson["checked"]);
Assert.AreEqual(request.Message, callbackJson["custom_answer"]);
Assert.AreEqual(request.SurveyId, Convert<int?>(callback["Survey[news_survey_id]"]));
Assert.AreEqual(request.AnswerId, Convert<int?>(callback["Survey[news_survey_answer_id]"]));
Assert.AreEqual(request.IsChecked, Convert<bool?>(callback["Survey[checked]"]));
Assert.AreEqual(request.Message, callback["Survey[custom_answer]"]);
httpMessageHandlerMock.Protected().Verify("SendAsync", Times.Exactly(1), ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>());
}
......@@ -62,7 +60,7 @@ namespace AMWD.Net.Api.Divera.Test
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = true });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = true });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var api = GetApi(accessKey);
......@@ -84,7 +82,7 @@ namespace AMWD.Net.Api.Divera.Test
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = true });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = true });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new ConfirmSurveyRequest
......@@ -113,7 +111,7 @@ namespace AMWD.Net.Api.Divera.Test
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = true });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = true });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new ConfirmSurveyRequest
......@@ -142,7 +140,7 @@ namespace AMWD.Net.Api.Divera.Test
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = true });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = true });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new ConfirmSurveyRequest
......@@ -171,7 +169,7 @@ namespace AMWD.Net.Api.Divera.Test
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = true });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = true });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new ConfirmSurveyRequest
......@@ -218,7 +216,7 @@ namespace AMWD.Net.Api.Divera.Test
}
[TestMethod]
public async Task ShouldReturnFalseOnHttpError()
public async Task ShouldThrowExceptionOnHttpError()
{
// arrange
string accessKey = "abc";
......@@ -228,14 +226,25 @@ namespace AMWD.Net.Api.Divera.Test
var api = GetApi(accessKey);
// act
bool response = await api.ConfirmSurvey(request);
string exceptionMessage = null;
try
{
bool response = await api.ConfirmSurvey(request);
Assert.Fail();
}
catch (DiveraException ex)
{
exceptionMessage = ex.Message;
}
// assert
Assert.IsFalse(response);
Assert.IsNotNull(requestCallback);
Assert.AreEqual($"{DiveraApiUrls.ConfirmSurvey}?accesskey={accessKey}", requestCallback.RequestUri.ToString());
Assert.AreEqual(HttpMethod.Post, requestCallback.Method);
Assert.IsNotNull(requestCallback.Content);
Assert.AreEqual($"HTTP error ({(int)httpResponseMessage.StatusCode}): ", exceptionMessage);
httpMessageHandlerMock.Protected().Verify("SendAsync", Times.Exactly(1), ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>());
}
......@@ -244,7 +253,7 @@ namespace AMWD.Net.Api.Divera.Test
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = false });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = false });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new ConfirmSurveyRequest { SurveyId = 4711, AnswerId = 21, IsChecked = true };
......
using System;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using AMWD.Net.Api.Divera.Models;
using AMWD.Net.Api.Divera.Requests;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Moq.Protected;
using Newtonsoft.Json;
namespace AMWD.Net.Api.Divera.Test
{
[TestClass]
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public class ConvertCoordinatesTests : TestBase
{
[TestMethod]
public async Task ShouldMapFullRequest()
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new Success<ConvertedAddress> { IsSuccess = true, Data = new ConvertedAddress { Address = "def" } });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new ConvertCoordinatesRequest
{
CoordinateX = 12.345f,
CoordinateY = 123.45f
};
var api = GetApi(accessKey);
// act
string response = await api.ConvertCoordinates(request);
// assert
Assert.AreEqual("def", response);
Assert.IsNotNull(requestCallback);
Assert.AreEqual($"{DiveraApiUrls.ConvertCoordinates}?accesskey={accessKey}", requestCallback.RequestUri.ToString());
Assert.AreEqual(HttpMethod.Post, requestCallback.Method);
Assert.IsNotNull(requestCallback.Content);
var callback = HttpUtility.ParseQueryString(requestCallback.Content);
Assert.AreEqual(request.CoordinateX, Convert<float?>(callback["coordinates-x"]));
Assert.AreEqual(request.CoordinateY, Convert<float?>(callback["coordinates-y"]));
httpMessageHandlerMock.Protected().Verify("SendAsync", Times.Exactly(1), ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>());
}
[TestMethod]
public async Task ShouldThrowExceptionOnMissingRequest()
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new Success<ConvertedAddress> { IsSuccess = true, Data = new ConvertedAddress { Address = "def" } });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var api = GetApi(accessKey);
// act + assert
try
{
string response = await api.ConvertCoordinates(null);
Assert.Fail();
}
catch (ArgumentNullException)
{ /* expected behaviour */ }
httpMessageHandlerMock.Protected().Verify("SendAsync", Times.Exactly(0), ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>());
}
[TestMethod]
public async Task ShouldThrowExceptionOnMissingCoordinateX()
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new Success<ConvertedAddress> { IsSuccess = false, Data = new ConvertedAddress { Address = null } });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new ConvertCoordinatesRequest
{
CoordinateY = 123.45f
};
var api = GetApi(accessKey);
// act + assert
try
{
string response = await api.ConvertCoordinates(request);
Assert.Fail();
}
catch (ArgumentNullException)
{ /* expected behaviour */ }
httpMessageHandlerMock.Protected().Verify("SendAsync", Times.Exactly(0), ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>());
}
[TestMethod]
public async Task ShouldThrowExceptionOnMissingCoordinateY()
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new Success<ConvertedAddress> { IsSuccess = false, Data = new ConvertedAddress { Address = null } });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new ConvertCoordinatesRequest
{
CoordinateX = 12.245f
};
var api = GetApi(accessKey);
// act + assert
try
{
string response = await api.ConvertCoordinates(request);
Assert.Fail();
}
catch (ArgumentNullException)
{ /* expected behaviour */ }
httpMessageHandlerMock.Protected().Verify("SendAsync", Times.Exactly(0), ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>());
}
[TestMethod]
public async Task ShouldThrowExceptionOnInvalidAccessKey()
{
// arrange
string accessKey = "abc";
httpResponseMessage.StatusCode = HttpStatusCode.Forbidden;
var request = new ConvertCoordinatesRequest { CoordinateX = 12.245f, CoordinateY = 123.45f };
var api = GetApi(accessKey);
// act + assert
try
{
string response = await api.ConvertCoordinates(request);
Assert.Fail();
}
catch (AccessKeyException)
{ /* expected behaviour */ }
httpMessageHandlerMock.Protected().Verify("SendAsync", Times.Exactly(1), ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>());
}
[TestMethod]
public async Task ShouldThrowExceptionOnHttpError()
{
// arrange
string accessKey = "abc";
httpResponseMessage.StatusCode = HttpStatusCode.InternalServerError;
var request = new ConvertCoordinatesRequest { CoordinateX = 12.245f, CoordinateY = 123.45f };
var api = GetApi(accessKey);
// act
string exceptionMessage = null;
try
{
string response = await api.ConvertCoordinates(request);
Assert.Fail();
}
catch (DiveraException ex)
{
exceptionMessage = ex.Message;
}
// assert
Assert.IsNotNull(requestCallback);
Assert.AreEqual($"{DiveraApiUrls.ConvertCoordinates}?accesskey={accessKey}", requestCallback.RequestUri.ToString());
Assert.AreEqual(HttpMethod.Post, requestCallback.Method);
Assert.IsNotNull(requestCallback.Content);
Assert.AreEqual($"HTTP error ({(int)httpResponseMessage.StatusCode}): ", exceptionMessage);
httpMessageHandlerMock.Protected().Verify("SendAsync", Times.Exactly(1), ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>());
}
}
}
......@@ -6,13 +6,13 @@ using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using AMWD.Net.Api.Divera.Models;
using AMWD.Net.Api.Divera.Requests;
using AMWD.Net.Api.Divera.Responses;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Moq.Protected;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace AMWD.Net.Api.Divera.Test
{
......@@ -20,14 +20,12 @@ namespace AMWD.Net.Api.Divera.Test
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public class CreateAlarmTests : TestBase
{
private static readonly string jsonMimeType = "application/json";
[TestMethod]
public async Task ShouldMapFullRequest()
{
// arrange
string accessKey = "abc";
string responseJson = JsonConvert.SerializeObject(new SuccessResponse { IsSuccessful = true });
string responseJson = JsonConvert.SerializeObject(new Success { IsSuccess = true });
httpResponseMessage.Content = new StringContent(responseJson, Encoding.UTF8, jsonMimeType);
var request = new CreateAlarmRequest
......@@ -60,11 +58,11 @@ namespace AMWD.Net.Api.Divera.Test
CoordinatesY = 65.4321f,