|
| 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 | +} |
0 commit comments