Skip to content

Commit

Permalink
test: add tests for BrowserFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
Per Kops committed Oct 1, 2024
1 parent 0fddf9d commit 43e6326
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/Atc.Opc.Ua.Tests/Factories/BrowserFactoryTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace Atc.Opc.Ua.Tests.Factories;

public sealed class BrowserFactoryTests
{
[Theory, AutoNSubstituteData]
public void GetForwardBrowser_ShouldReturnConfiguredBrowser(ISession session)
{
// Act
var browser = BrowserFactory.GetForwardBrowser(session);

// Assert
Assert.NotNull(browser);
Assert.Equal(BrowseDirection.Forward, browser.BrowseDirection);
Assert.Equal((int)NodeClass.Object | (int)NodeClass.Variable, browser.NodeClassMask);
Assert.Equal(ReferenceTypeIds.HierarchicalReferences, browser.ReferenceTypeId);
Assert.True(browser.IncludeSubtypes);
}

[Theory, AutoNSubstituteData]
public void GetBackwardsBrowser_ShouldReturnConfiguredBrowser(ISession session)
{
// Act
var browser = BrowserFactory.GetBackwardsBrowser(session);

// Assert
Assert.NotNull(browser);
Assert.Equal(BrowseDirection.Inverse, browser.BrowseDirection);
Assert.Equal((int)NodeClass.Object, browser.NodeClassMask);
Assert.Equal(ReferenceTypeIds.HierarchicalReferences, browser.ReferenceTypeId);
}
}
3 changes: 3 additions & 0 deletions test/Atc.Opc.Ua.Tests/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
global using Atc.Opc.Ua.Factories;
global using Opc.Ua;
global using Opc.Ua.Client;

0 comments on commit 43e6326

Please sign in to comment.