Skip to content
Merged

Lab5 #45

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion NetSdrClient.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetSdrClientApp", "NetSdrCl
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetSdrClientAppTests", "NetSdrClientAppTests\NetSdrClientAppTests.csproj", "{D0155366-89B4-4BA4-90E2-2ECC8C1EB915}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EchoServer", "EchoTspServer\EchoServer.csproj", "{9179F2F7-EBEE-4A5D-9FD9-F6E3C18DD263}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EchoServer", "EchoTcpServer\EchoServer.csproj", "{9179F2F7-EBEE-4A5D-9FD9-F6E3C18DD263}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
54 changes: 54 additions & 0 deletions NetSdrClientAppTests/ArchitectureTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using NetArchTest.Rules;
using NUnit.Framework;
using System.Linq;
using System.Reflection;
using System.Text;

namespace NetSdrClientAppTests
{
public class ArchitectureTests
{
[Test]
public void App_Should_Not_Depend_On_EchoServer()
{
var result = Types.InAssembly(typeof(NetSdrClientApp.NetSdrClient).Assembly)
.That()
.ResideInNamespace("NetSdrClientApp")
.ShouldNot()
.HaveDependencyOn("EchoServer")
.GetResult();

Assert.That(result.IsSuccessful, Is.True);
}

[Test]
public void Messages_Should_Not_Depend_On_Networking()
{
// Arrange
var result = Types.InAssembly(typeof(NetSdrClientApp.Messages.NetSdrMessageHelper).Assembly)
.That()
.ResideInNamespace("NetSdrClientApp.Messages")
.ShouldNot()
.HaveDependencyOn("NetSdrClientApp.Networking")
.GetResult();

// Assert
Assert.That(result.IsSuccessful, Is.True);
}

[Test]
public void Networking_Should_Not_Depend_On_Messages()
{
// Arrange
var result = Types.InAssembly(typeof(NetSdrClientApp.Networking.ITcpClient).Assembly)
.That()
.ResideInNamespace("NetSdrClientApp.Networking")
.ShouldNot()
.HaveDependencyOn("NetSdrClientApp.Messages")
.GetResult();

// Assert
Assert.That(result.IsSuccessful, Is.True);
}
}
}
1 change: 1 addition & 0 deletions NetSdrClientAppTests/NetSdrClientAppTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NetArchTest.Rules" Version="1.3.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="NUnit" Version="3.14.0" />
Expand Down
Loading