File tree Expand file tree Collapse file tree 4 files changed +74
-22
lines changed
examples/Smdn.Net.MuninNode/multigraph
src/Smdn.Net.MuninNode/Smdn.Net.MuninPlugin
Smdn.Net.MuninNode.Protocol Expand file tree Collapse file tree 4 files changed +74
-22
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ // SPDX-FileCopyrightText: 2025 smdn <smdn@smdn.jp>
2+ // SPDX-License-Identifier: MIT
3+ using System ;
4+ using System . Collections . Generic ;
5+
6+ namespace Smdn . Net . MuninPlugin ;
7+
8+ public class MultigraphPlugin : IMultigraphPlugin {
9+ /// <inheritdoc cref="IPlugin.Name"/>
10+ public string Name { get ; }
11+
12+ /// <inheritdoc cref="IMultigraphPlugin.Plugins"/>
13+ public IReadOnlyCollection < IPlugin > Plugins { get ; }
14+
15+ /// <inheritdoc cref="IPlugin.DataSource"/>
16+ public IPluginDataSource DataSource => throw new NotSupportedException ( ) ;
17+
18+ /// <inheritdoc cref="IPlugin.GraphAttributes"/>
19+ public IPluginGraphAttributes GraphAttributes => throw new NotSupportedException ( ) ;
20+
21+ /// <inheritdoc cref="IPlugin.SessionCallback"/>
22+ public INodeSessionCallback ? SessionCallback => throw new NotSupportedException ( ) ;
23+
24+ public MultigraphPlugin ( string name , IReadOnlyCollection < IPlugin > plugins )
25+ {
26+ ArgumentExceptionShim . ThrowIfNullOrWhiteSpace ( name , nameof ( name ) ) ;
27+
28+ Name = name ;
29+ Plugins = plugins ?? throw new ArgumentNullException ( nameof ( plugins ) ) ;
30+ }
31+ }
Original file line number Diff line number Diff line change @@ -19,14 +19,6 @@ namespace Smdn.Net.MuninNode.Protocol;
1919
2020[ TestFixture ]
2121public partial class MuninProtocolHandlerTests {
22- private class MultigraphPlugin ( string name , IReadOnlyCollection < IPlugin > plugins ) : IMultigraphPlugin {
23- public string Name { get ; } = name ;
24- public IReadOnlyCollection < IPlugin > Plugins { get ; } = plugins ;
25- public IPluginDataSource DataSource => throw new NotSupportedException ( ) ;
26- public IPluginGraphAttributes GraphAttributes => throw new NotSupportedException ( ) ;
27- public INodeSessionCallback ? SessionCallback => throw new NotSupportedException ( ) ;
28- }
29-
3022 private class PluginProvider ( IReadOnlyCollection < IPlugin > plugins ) : IPluginProvider {
3123 public IReadOnlyCollection < IPlugin > Plugins { get ; } = plugins ;
3224 public INodeSessionCallback ? SessionCallback => null ;
Original file line number Diff line number Diff line change 1+ // SPDX-FileCopyrightText: 2025 smdn <smdn@smdn.jp>
2+ // SPDX-License-Identifier: MIT
3+ using System ;
4+
5+ using NUnit . Framework ;
6+
7+ namespace Smdn . Net . MuninPlugin ;
8+
9+ [ TestFixture ]
10+ public class MultigraphPluginTests {
11+ [ TestCase ( null , typeof ( ArgumentNullException ) ) ]
12+ [ TestCase ( "" , typeof ( ArgumentException ) ) ]
13+ [ TestCase ( " " , typeof ( ArgumentException ) ) ]
14+ [ TestCase ( "name" , null ) ]
15+ public void Ctor_Name ( string ? name , Type ? expectedArgumentExceptionType )
16+ => Assert . That (
17+ ( ) => new MultigraphPlugin (
18+ name : name ! ,
19+ plugins : [ ]
20+ ) ,
21+ expectedArgumentExceptionType is null
22+ ? Throws . Nothing
23+ : Throws
24+ . TypeOf ( expectedArgumentExceptionType )
25+ . With
26+ . Property ( nameof ( ArgumentException . ParamName ) )
27+ . EqualTo ( "name" )
28+ ) ;
29+
30+ [ TestCase ]
31+ public void Ctor_Plugins_ArgumentNull ( )
32+ => Assert . That (
33+ ( ) => new MultigraphPlugin (
34+ name : "multigraph" ,
35+ plugins : null !
36+ ) ,
37+ Throws
38+ . ArgumentNullException
39+ . With
40+ . Property ( nameof ( ArgumentNullException . ParamName ) )
41+ . EqualTo ( "plugins" )
42+ ) ;
43+ }
You can’t perform that action at this time.
0 commit comments