Skip to content

Commit a2da1e7

Browse files
author
samatrhea
committed
[Add] AnnotatingElementExtensionsTestFixture
1 parent 26bfbee commit a2da1e7

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// -------------------------------------------------------------------------------------------------
2+
// <copyright file="AnnotatingElementExtensionsTestFixture.cs" company="RHEA System S.A.">
3+
//
4+
// Copyright 2022-2023 RHEA System S.A.
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// </copyright>
19+
// ------------------------------------------------------------------------------------------------
20+
21+
namespace SysML2.NET.Dal.Tests
22+
{
23+
using System;
24+
using System.Collections.Generic;
25+
using System.Linq;
26+
27+
using NUnit.Framework;
28+
29+
using SysML2.NET.Core.POCO;
30+
using SysML2.NET.Dal;
31+
32+
/// <summary>
33+
/// Suite of tests for the <see cref="AnnotatingElementExtensions"/> class
34+
/// </summary>
35+
[TestFixture]
36+
public class AnnotatingElementExtensionsTestFixture
37+
{
38+
[Test]
39+
public void Verify_that_ToDto_works_as_expected()
40+
{
41+
var annotation = new Core.POCO.Annotation
42+
{
43+
Id = Guid.NewGuid()
44+
};
45+
46+
var ownedMemberShip = new Core.POCO.Membership
47+
{
48+
Id = Guid.NewGuid()
49+
};
50+
51+
var owningMemberShip = new Core.POCO.Membership
52+
{
53+
Id = Guid.NewGuid()
54+
};
55+
56+
var poco = new Core.POCO.AnnotatingElement
57+
{
58+
Id = Guid.NewGuid(),
59+
AliasIds = new List<string> { "alias_1", "alias_2" },
60+
Annotation = new List<Annotation> { annotation },
61+
DeclaredName = "declared name",
62+
DeclaredShortName = "declared shortname",
63+
ElementId = "element id",
64+
IsImpliedIncluded = true,
65+
OwnedRelationship = new List<IRelationship>{ ownedMemberShip },
66+
OwningRelationship = owningMemberShip
67+
};
68+
69+
var dto = poco.ToDto();
70+
71+
Assert.That(dto.Id, Is.EqualTo(poco.Id));
72+
Assert.That(dto.AliasIds, Is.EquivalentTo(poco.AliasIds));
73+
Assert.That(dto.Annotation.Single(), Is.EqualTo(poco.Annotation.Single().Id));
74+
Assert.That(dto.DeclaredName, Is.EqualTo(poco.DeclaredName));
75+
Assert.That(dto.DeclaredShortName, Is.EqualTo(poco.DeclaredShortName));
76+
Assert.That(dto.ElementId, Is.EqualTo(poco.ElementId));
77+
Assert.That(dto.IsImpliedIncluded, Is.EqualTo(poco.IsImpliedIncluded));
78+
Assert.That(dto.OwnedRelationship.Single(), Is.EqualTo(poco.OwnedRelationship.Single().Id));
79+
Assert.That(dto.OwningRelationship, Is.EqualTo(poco.OwningRelationship.Id));
80+
}
81+
}
82+
}

SysML2.NET.Dal.Tests/AssemblerTestFixture.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ namespace SysML2.NET.Dal.Tests
3030
/// <summary>
3131
/// Suite of tests for the <see cref="Assembler"/> class
3232
/// </summary>
33+
[TestFixture]
3334
public class AssemblerTestFixture
3435
{
3536
private IAssembler assembler;

0 commit comments

Comments
 (0)