mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
passing canvas models tests
This commit is contained in:
29
Management.Test/CanvasModels/TermTests.cs
Normal file
29
Management.Test/CanvasModels/TermTests.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
using CanvasModel.EnrollmentTerms;
|
||||||
|
|
||||||
|
public class DeserializationTests
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestTerm()
|
||||||
|
{
|
||||||
|
|
||||||
|
var canvasContentResponse = @"{
|
||||||
|
""enrollment_terms"": [
|
||||||
|
{
|
||||||
|
""id"": 1,
|
||||||
|
""name"": ""one"",
|
||||||
|
""start_at"": ""2022-01-01T00:00:00Z"",
|
||||||
|
""end_at"": ""2022-02-01T00:00:00Z"",
|
||||||
|
""created_at"": ""2011-04-26T23:34:35Z"",
|
||||||
|
""workflow_state"": ""active"",
|
||||||
|
""grading_period_group_id"": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}";
|
||||||
|
|
||||||
|
var result = JsonSerializer.Deserialize<RedundantEnrollmentTermsResponse>(canvasContentResponse);
|
||||||
|
|
||||||
|
result.Should().NotBeNull();
|
||||||
|
result?.EnrollmentTerms?.First().Id.Should().Be(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
|
|
||||||
using CanvasModel.EnrollmentTerms;
|
|
||||||
|
|
||||||
public class DeserializationTests
|
|
||||||
{
|
|
||||||
// [Test]
|
|
||||||
// public void TestTerm()
|
|
||||||
// {
|
|
||||||
|
|
||||||
// var canvasContentResponse = @"{
|
|
||||||
// ""enrollment_terms"": [
|
|
||||||
// {
|
|
||||||
// ""id"": 1,
|
|
||||||
// ""name"": ""one"",
|
|
||||||
// ""start_at"": 2022-01-01T00:00:00Z,
|
|
||||||
// ""end_at"": 2022-02-01T00:00:00Z,
|
|
||||||
// ""created_at"": ""2011-04-26T23:34:35Z"",
|
|
||||||
// ""workflow_state"": ""active"",
|
|
||||||
// ""grading_period_group_id"": null
|
|
||||||
// },
|
|
||||||
// }";
|
|
||||||
|
|
||||||
// var result = JsonSerializer.Deserialize<EnrollmentTermModel>(canvasContentResponse);
|
|
||||||
|
|
||||||
// result.Should().NotBeNull();
|
|
||||||
// result?.Id.Should().Be(1);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
namespace Management.Test;
|
|
||||||
|
|
||||||
public class Tests
|
|
||||||
{
|
|
||||||
[SetUp]
|
|
||||||
public void Setup()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test1()
|
|
||||||
{
|
|
||||||
Assert.Pass();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,2 @@
|
|||||||
|
|
||||||
global using System.Text.Json.Serialization;
|
global using System.Text.Json.Serialization;
|
||||||
global using System.Text.Json;
|
global using System.Text.Json;
|
||||||
@@ -64,7 +64,4 @@ public class CanvasService
|
|||||||
.TrimStart('<')
|
.TrimStart('<')
|
||||||
.Replace(" ", "")
|
.Replace(" ", "")
|
||||||
.Replace(BaseUrl, "");
|
.Replace(BaseUrl, "");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user