|
21 | 21 | namespace SysML2.NET.Tests.Extend |
22 | 22 | { |
23 | 23 | using System; |
24 | | - |
| 24 | + |
25 | 25 | using NUnit.Framework; |
26 | | - |
| 26 | + |
| 27 | + using SysML2.NET.Core.POCO.Core.Types; |
27 | 28 | using SysML2.NET.Core.POCO.Systems.Actions; |
| 29 | + using SysML2.NET.Core.POCO.Systems.DefinitionAndUsage; |
| 30 | + using SysML2.NET.Extensions; |
28 | 31 |
|
29 | 32 | [TestFixture] |
30 | 33 | public class ActionDefinitionExtensionsTestFixture |
31 | 34 | { |
32 | 35 | [Test] |
33 | | - public void ComputeAction_ThrowsNotSupportedException() |
| 36 | + public void VerifyComputeAction() |
34 | 37 | { |
35 | | - Assert.That(() => ((IActionDefinition)null).ComputeAction(), Throws.TypeOf<NotSupportedException>()); |
| 38 | + Assert.That(() => ((IActionDefinition)null).ComputeAction(), Throws.TypeOf<ArgumentNullException>()); |
| 39 | + |
| 40 | + var emptyActionDefinition = new ActionDefinition(); |
| 41 | + |
| 42 | + Assert.That(emptyActionDefinition.ComputeAction(), Has.Count.EqualTo(0)); |
| 43 | + |
| 44 | + // Only ActionUsage instances must be returned; a bare Usage must be filtered out. |
| 45 | + var subject = new ActionDefinition(); |
| 46 | + var actionUsage = new ActionUsage(); |
| 47 | + var bareUsage = new Usage(); |
| 48 | + |
| 49 | + subject.AssignOwnership(new FeatureMembership(), actionUsage); |
| 50 | + subject.AssignOwnership(new FeatureMembership(), bareUsage); |
| 51 | + |
| 52 | + using (Assert.EnterMultipleScope()) |
| 53 | + { |
| 54 | + Assert.That(subject.ComputeAction(), Does.Contain(actionUsage)); |
| 55 | + Assert.That(subject.ComputeAction(), Does.Not.Contain(bareUsage)); |
| 56 | + } |
36 | 57 | } |
37 | 58 | } |
38 | 59 | } |
0 commit comments