Skip to content

Commit 3a13961

Browse files
committed
Start SubStatement testing with nested test
1 parent 71f7571 commit 3a13961

3 files changed

Lines changed: 63 additions & 1 deletion

File tree

TinCanTests/StatementTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void TestJObjectCtrSubStatement()
5959

6060
Statement obj = new Statement(cfg);
6161
Assert.IsInstanceOf<Statement>(obj);
62-
Assert.IsNotNull(obj.target);
62+
Assert.IsInstanceOf<SubStatement>(obj.target);
6363
}
6464
}
6565
}

TinCanTests/SubStatementTest.cs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
Copyright 2014 Rustici Software
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
namespace TinCanTests
17+
{
18+
using System;
19+
using System.Collections.Generic;
20+
using NUnit.Framework;
21+
using Newtonsoft.Json.Linq;
22+
using TinCan;
23+
using TinCan.Json;
24+
25+
[TestFixture]
26+
class SubStatementTest
27+
{
28+
[SetUp]
29+
public void Init()
30+
{
31+
Console.WriteLine("Running " + TestContext.CurrentContext.Test.FullName);
32+
}
33+
34+
[Test]
35+
public void TestEmptyCtr()
36+
{
37+
var obj = new SubStatement();
38+
Assert.IsInstanceOf<SubStatement>(obj);
39+
Assert.IsNull(obj.actor);
40+
Assert.IsNull(obj.verb);
41+
Assert.IsNull(obj.target);
42+
Assert.IsNull(obj.result);
43+
Assert.IsNull(obj.context);
44+
45+
StringAssert.AreEqualIgnoringCase("{\"objectType\":\"SubStatement\"}", obj.ToJSON());
46+
}
47+
48+
[Test]
49+
public void TestJObjectCtrNestedSubStatement()
50+
{
51+
JObject cfg = new JObject();
52+
cfg.Add("actor", Support.agent.ToJObject());
53+
cfg.Add("verb", Support.verb.ToJObject());
54+
cfg.Add("object", Support.subStatement.ToJObject());
55+
56+
var obj = new SubStatement(cfg);
57+
Assert.IsInstanceOf<SubStatement>(obj);
58+
Assert.IsNull(obj.target);
59+
}
60+
}
61+
}

TinCanTests/TinCanTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
<ItemGroup>
7373
<Compile Include="AgentTest.cs" />
7474
<Compile Include="Support.cs" />
75+
<Compile Include="SubStatementTest.cs" />
7576
<Compile Include="StatementTest.cs" />
7677
<Compile Include="RemoteLRSResourceTest.cs" />
7778
<Compile Include="RemoteLRSTest.cs" />

0 commit comments

Comments
 (0)