Skip to content

Commit da1be54

Browse files
committed
improve code coverage
1 parent e0afe0e commit da1be54

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

test/Solnet.Programs.Test/StakePoolProgramTest.cs

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
using Microsoft.VisualStudio.TestTools.UnitTesting;
22
using Solnet.Programs.StakePool;
33
using Solnet.Programs.StakePool.Models;
4-
using Solnet.Programs.TokenSwap.Models;
5-
using Solnet.Rpc.Models;
64
using Solnet.Wallet;
75
using System;
86
using System.Linq;
7+
using System.Collections.Generic;
98

109
namespace Solnet.Programs.Test
1110
{
@@ -403,4 +402,51 @@ public void UpdateStaleStakePool_CreatesCorrectInstructions()
403402
}
404403
}
405404
}
405+
406+
[TestClass]
407+
public class StakePoolModelsTest
408+
{
409+
[TestMethod]
410+
public void Fee_StoresCorrectValues()
411+
{
412+
// Arrange
413+
var fee = new Fee(100, 1000);
414+
415+
// Act & Assert
416+
Assert.AreEqual(100UL, fee.Numerator, "Fee numerator not stored correctly.");
417+
Assert.AreEqual(1000UL, fee.Denominator, "Fee denominator not stored correctly.");
418+
}
419+
420+
[TestMethod]
421+
public void Fee_DefaultIsZero()
422+
{
423+
// Arrange
424+
var fee = new Fee();
425+
426+
// Act & Assert
427+
Assert.AreEqual(0UL, fee.Numerator, "Default fee numerator should be zero.");
428+
Assert.AreEqual(0UL, fee.Denominator, "Default fee denominator should be zero.");
429+
}
430+
431+
[TestMethod]
432+
public void PreferredValidatorType_ValuesAreConsistent()
433+
{
434+
// Assuming that PreferredValidatorType is an enum with defined underlying values,
435+
// you might for example have:
436+
// Deposit = 0, Withdraw = 1 (adjust as per your actual enum definition).
437+
uint depositValue = (uint)PreferredValidatorType.Deposit;
438+
uint withdrawValue = (uint)PreferredValidatorType.Withdraw;
439+
440+
// Assert that they are different and non-negative.
441+
Assert.AreNotEqual(depositValue, withdrawValue, "PreferredValidatorType values must differ.");
442+
Assert.IsTrue(depositValue < withdrawValue, "Expected Deposit value to be less than Withdraw value.");
443+
}
444+
445+
[TestMethod]
446+
public void FundingType_ValuesAreConsistent()
447+
{
448+
byte solDeposit = (byte)FundingType.SolDeposit;
449+
Assert.AreEqual(1, solDeposit, "FundingType.SolDeposit is expected to be 1.");
450+
}
451+
}
406452
}

0 commit comments

Comments
 (0)