-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rpWorkspace/BaseTests/Delegates/Entity.cs → CSharpWorkspace/BaseTests/Common/Entity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
using System; | ||
|
||
namespace BaseTests.Delegates | ||
namespace BaseTests.Common | ||
{ | ||
public class Entity<T> | ||
{ | ||
|
1 change: 1 addition & 0 deletions
1
CSharpWorkspace/BaseTests/Delegates/Test.cs → ...e/BaseTests/Delegates/BaseDelegateTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
using System; | ||
using NUnit.Framework; | ||
using BaseTests.Common; | ||
|
||
namespace BaseTests.Delegates | ||
{ | ||
|
39 changes: 39 additions & 0 deletions
39
CSharpWorkspace/BaseTests/Reflections/BaseReflectionTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using BaseTests.Common; | ||
using NUnit.Framework; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace BaseTests.Reflections | ||
{ | ||
[TestFixture] | ||
public class Test | ||
{ | ||
private Entity<string> _entity; | ||
private const string HelloReflection = "Hello Reflection"; | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
_entity = new Entity<string>(); | ||
_entity.Data = HelloReflection; | ||
} | ||
|
||
[Test] | ||
public void PropertyTest() | ||
{ | ||
var properties = _entity.GetType().GetProperties(); | ||
Assert.AreEqual(properties.Count(), 1); | ||
var propertyInfo = properties.Single(); | ||
Assert.AreEqual(propertyInfo.Name, nameof(_entity.Data)); | ||
var value = propertyInfo.GetValue(_entity); | ||
Assert.AreEqual(value, HelloReflection); | ||
|
||
var newValue = "New Value"; | ||
propertyInfo.SetValue(_entity, newValue); | ||
Assert.AreEqual(newValue, _entity.Data); | ||
} | ||
} | ||
} |