Skip to content

Commit

Permalink
tests slight cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Stroganov committed Mar 6, 2019
1 parent 1a99a92 commit f55686b
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 47 deletions.
2 changes: 1 addition & 1 deletion Source/SdkTests/MeetingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void GetMyMeetings()
[TestMethod]
public void GetSCOshotcuts()
{
var result = MeetingManagement.GetSCOshotcuts(this.Api);
var result = MeetingManagement.GetSCOshortcuts(this.Api);
Assert.IsTrue(result.Result.Any());
}

Expand Down
50 changes: 4 additions & 46 deletions Source/SdkTests/ReportingTests.cs
Original file line number Diff line number Diff line change
@@ -1,55 +1,13 @@
namespace SdkTests
{
using System;
using AdobeConnectSDK;
using AdobeConnectSDK.Common;
using AdobeConnectSDK.Extensions;
using AdobeConnectSDK.Model;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SdkTests.Common;
using System.Collections.Generic;
using System.Linq;
using AdobeConnectSDK.Extensions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SdkTests.Common;
using System.Linq;

[TestClass]
public class ReportingTests : TestsBase
{
[TestMethod]
public void QuotaEntity_CanSerializeAndDeserialize()
{
QuotaInfo qi = new QuotaInfo()
{
QuotaList = new List<Quota> {
new Quota { AclId = 1, Limit = 2, QuotaId = "tstquota", SoftLimit = 4, Used = 5 },
new Quota { AclId = 5, Limit = 6, QuotaId = "tstquota2", SoftLimit = 7, Used = 8 }
}
};

string s = XmlSerializerHelpersGeneric.ToXML(qi);

QuotaInfo r = XmlSerializerHelpersGeneric.FromXML<QuotaInfo>(s);

Assert.AreEqual(qi.QuotaList.First().AclId, r.QuotaList.First().AclId);
}

[TestMethod]
public void QuotaEntity_CanDeserialize()
{
QuotaInfo qi = new QuotaInfo()
{
QuotaList = new List<Quota> {
new Quota { AclId = 838570243, Limit = 2, QuotaId = "tstquota", SoftLimit = 4, Used = 5, DateBegin = new DateTime(2009, 03, 31, 08, 07, 59, 180, DateTimeKind.Utc) },
new Quota { AclId = 5, Limit = 6, QuotaId = "tstquota2", SoftLimit = 7, Used = 8 }
}
};

string s = "<report-quotas> <quota acl-id=\"838570243\" quota-id=\"download-quota\" used=\"0\" limit=\"10\" soft-limit=\"10\"> <date-begin>2009-03-31T10:07:59.180+02:00</date-begin> <date-end>3000-01-01T01:00:00.537+01:00</date-end> </quota></report-quotas>";

QuotaInfo r = XmlSerializerHelpersGeneric.FromXML<QuotaInfo>(s);

Assert.AreEqual(qi.QuotaList.First().AclId, r.QuotaList.First().AclId);
Assert.AreEqual(qi.QuotaList.First().DateBegin, r.QuotaList.First().DateBegin);
}

[TestMethod]
public void Report_Quotas()
{
Expand Down
1 change: 1 addition & 0 deletions Source/SdkTests/SdkTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<Compile Include="MeetingTests.cs" />
<Compile Include="ScenarioTests.cs" />
<Compile Include="UserAccountTests.cs" />
<Compile Include="XmlSerializerTests.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\report-quotas.xml">
Expand Down
50 changes: 50 additions & 0 deletions Source/SdkTests/XmlSerializerTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using AdobeConnectSDK.Common;
using AdobeConnectSDK.Model;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace SdkTests
{
//TODO: implement tests for all data models
[TestClass, Ignore]
public class XmlSerializerTests
{
[TestMethod]
public void QuotaEntity_CanSerializeAndDeserialize()
{
QuotaInfo qi = new QuotaInfo() {
QuotaList = new List<Quota> {
new Quota { AclId = 1, Limit = 2, QuotaId = "tstquota", SoftLimit = 4, Used = 5 },
new Quota { AclId = 5, Limit = 6, QuotaId = "tstquota2", SoftLimit = 7, Used = 8 }
}
};

string s = XmlSerializerHelpersGeneric.ToXML(qi);

QuotaInfo r = XmlSerializerHelpersGeneric.FromXML<QuotaInfo>(s);

Assert.AreEqual(qi.QuotaList.First().AclId, r.QuotaList.First().AclId);
}

[TestMethod]
public void QuotaEntity_CanDeserialize()
{
QuotaInfo qi = new QuotaInfo() {
QuotaList = new List<Quota> {
new Quota { AclId = 838570243, Limit = 2, QuotaId = "tstquota", SoftLimit = 4, Used = 5, DateBegin = new DateTime(2009, 03, 31, 08, 07, 59, 180, DateTimeKind.Utc) },
new Quota { AclId = 5, Limit = 6, QuotaId = "tstquota2", SoftLimit = 7, Used = 8 }
}
};

string s =
"<report-quotas> <quota acl-id=\"838570243\" quota-id=\"download-quota\" used=\"0\" limit=\"10\" soft-limit=\"10\"> <date-begin>2009-03-31T10:07:59.180+02:00</date-begin> <date-end>3000-01-01T01:00:00.537+01:00</date-end> </quota></report-quotas>";

QuotaInfo r = XmlSerializerHelpersGeneric.FromXML<QuotaInfo>(s);

Assert.AreEqual(qi.QuotaList.First().AclId, r.QuotaList.First().AclId);
Assert.AreEqual(qi.QuotaList.First().DateBegin, r.QuotaList.First().DateBegin);
}
}
}

0 comments on commit f55686b

Please sign in to comment.