Skip to content

Commit

Permalink
[Delete] Using IReferenceable
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanael smiechowski committed Oct 23, 2024
1 parent f2c81ad commit 8070e08
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 384 deletions.
92 changes: 19 additions & 73 deletions uml4net.Tests/AssemblerTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ public void Teardown()
this.cache.Clear();
}

[TestCase(true)]
[TestCase(false)]
public void Synchronize_ShouldSetSingleValueReference(bool useFullReflection)
[Test]
public void Synchronize_ShouldSetSingleValueReference()
{
// Arrange
var classElement = new Class
Expand All @@ -66,16 +65,8 @@ public void Synchronize_ShouldSetSingleValueReference(bool useFullReflection)

Assert.That(classElement.NameExpression, Is.Null);

// Act
if (useFullReflection)
{
this.assembler.SynchronizeUsingFullReflection(this.cache);
}
else
{
this.assembler.Synchronize(this.cache);
}

this.assembler.Synchronize(this.cache);

// Assert
Assert.Multiple(() =>
{
Expand All @@ -85,9 +76,8 @@ public void Synchronize_ShouldSetSingleValueReference(bool useFullReflection)
});
}

[TestCase(true)]
[TestCase(false)]
public void Synchronize_ShouldSetMultiValueReference(bool useFullReflection)
[Test]
public void Synchronize_ShouldSetMultiValueReference()
{
// Arrange
var classElement = new Class
Expand All @@ -106,15 +96,7 @@ public void Synchronize_ShouldSetMultiValueReference(bool useFullReflection)
this.cache.Add(comment1.XmiId, comment1);
this.cache.Add(comment2.XmiId, comment2);

// Act
if (useFullReflection)
{
this.assembler.SynchronizeUsingFullReflection(this.cache);
}
else
{
this.assembler.Synchronize(this.cache);
}
this.assembler.Synchronize(this.cache);

// Assert
Assert.Multiple(() =>
Expand All @@ -125,9 +107,8 @@ public void Synchronize_ShouldSetMultiValueReference(bool useFullReflection)
});
}

[TestCase(true)]
[TestCase(false)]
public void Synchronize_ShouldSetSingleValueReferenceAndMultipleValuesReference(bool useFullReflection)
[Test]
public void Synchronize_ShouldSetSingleValueReferenceAndMultipleValuesReference()
{
// Arrange
var classElement = new Class
Expand All @@ -153,15 +134,7 @@ public void Synchronize_ShouldSetSingleValueReferenceAndMultipleValuesReference(
Assert.That(classElement.NameExpression, Is.Null);
Assert.That(classElement.OwnedComment.Count, Is.Zero);

// Act
if (useFullReflection)
{
this.assembler.SynchronizeUsingFullReflection(this.cache);
}
else
{
this.assembler.Synchronize(this.cache);
}
this.assembler.Synchronize(this.cache);

// Assert
Assert.Multiple(() =>
Expand All @@ -175,9 +148,8 @@ public void Synchronize_ShouldSetSingleValueReferenceAndMultipleValuesReference(
});
}

[TestCase(true)]
[TestCase(false)]
public void Synchronize_ShouldSetExpectedReferenceToExpectedReference(bool useFullReflection)
[Test]
public void Synchronize_ShouldSetExpectedReferenceToExpectedReference()
{
// Arrange
var classElement0 = new Class
Expand Down Expand Up @@ -214,15 +186,7 @@ public void Synchronize_ShouldSetExpectedReferenceToExpectedReference(bool useFu
Assert.That(classElement0.OwnedComment.Count, Is.Zero);
Assert.That(classElement1.OwnedComment.Count, Is.Zero);

// Act
if (useFullReflection)
{
this.assembler.SynchronizeUsingFullReflection(this.cache);
}
else
{
this.assembler.Synchronize(this.cache);
}
this.assembler.Synchronize(this.cache);

// Assert
Assert.Multiple(() =>
Expand All @@ -239,9 +203,8 @@ public void Synchronize_ShouldSetExpectedReferenceToExpectedReference(bool useFu
});
}

[TestCase(true)]
[TestCase(false)]
public void Synchronize_ShouldThrow_WhenReferenceNotFound(bool useFullReflection)
[Test]
public void Synchronize_ShouldThrow_WhenReferenceNotFound()
{
// Arrange
var classElement = new Class
Expand All @@ -254,20 +217,11 @@ public void Synchronize_ShouldThrow_WhenReferenceNotFound(bool useFullReflection
classElement.SingleValueReferencePropertyIdentifiers.Add("NameExpression", "NonExistentReference");
this.cache.Add(classElement.XmiId, classElement);

// Act & Assert
if (useFullReflection)
{
Assert.Throws<NullReferenceException>(() => this.assembler.SynchronizeUsingFullReflection(this.cache));
}
else
{
Assert.Throws<NullReferenceException>(() => this.assembler.Synchronize(this.cache));
}
Assert.Throws<NullReferenceException>(() => this.assembler.Synchronize(this.cache));
}

[TestCase(true)]
[TestCase(false)]
public void Synchronize_ShouldThrow_WhenElementNotIReferenceable(bool useFullReflection)
[Test]
public void Synchronize_ShouldThrow_WhenElementNotIReferenceable()
{
// Arrange
var classElement = new Class
Expand All @@ -282,15 +236,7 @@ public void Synchronize_ShouldThrow_WhenElementNotIReferenceable(bool useFullRef
this.cache.Add(classElement.XmiId, classElement);
this.cache.Add(invalidElement.XmiId, invalidElement);

// Act & Assert
if (useFullReflection)
{
Assert.Throws<InvalidOperationException>(() => this.assembler.SynchronizeUsingFullReflection(this.cache));
}
else
{
Assert.Throws<InvalidOperationException>(() => this.assembler.Synchronize(this.cache));
}
Assert.Throws<InvalidOperationException>(() => this.assembler.Synchronize(this.cache));
}
}
}
Loading

0 comments on commit 8070e08

Please sign in to comment.