Skip to content

Commit

Permalink
Fixes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfdezsauco committed May 3, 2023
1 parent 753498f commit f82ac21
Showing 1 changed file with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,19 @@ public class The_RemainingTimeProgressBarColor_Property
{
public static IEnumerable<object[]> Data()
{
yield return new object[]
{
TimeSpan.FromMinutes(6),
MudBlazor.Color.Success,
};
yield return new object[] { TimeSpan.FromMinutes(6), false, MudBlazor.Color.Dark };

yield return new object[]
{
TimeSpan.FromMinutes(4),
MudBlazor.Color.Warning,
};
yield return new object[] { TimeSpan.FromMinutes(6), true, MudBlazor.Color.Success };

yield return new object[]
{
TimeSpan.FromMinutes(0.5),
MudBlazor.Color.Error,
};
yield return new object[] { TimeSpan.FromMinutes(4), true, MudBlazor.Color.Warning };

yield return new object[] { TimeSpan.FromMinutes(0.5), true, MudBlazor.Color.Error };
}

[Theory]
[MemberData(nameof(Data))]
[Trait(Traits.Category, Category.Unit)]
public async Task Returns_ExpectedValues_Async(TimeSpan remainingTime, MudBlazor.Color expectedColor)
public async Task Returns_ExpectedValues_Async(TimeSpan remainingTime, bool isConnected, MudBlazor.Color expectedColor)
{
var sessionManagerMock = new Mock<ISessionManager>();

Expand All @@ -55,8 +45,11 @@ public async Task Returns_ExpectedValues_Async(TimeSpan remainingTime, MudBlazor

var accountViewModel = new AccountViewModel(new AccountInfo(), sessionManagerMock.Object, accountManagementMock.Object, deviceDisplayMock.Object);

var propertyInfo = typeof(AccountViewModel).GetProperty(nameof(AccountViewModel.RemainingTime));
propertyInfo?.SetValue(accountViewModel, remainingTime);
var remainingTimePropertyInfo = typeof(AccountViewModel).GetProperty(nameof(AccountViewModel.RemainingTime));
remainingTimePropertyInfo?.SetValue(accountViewModel, remainingTime);

var isConnectedPropertyInfo = typeof(AccountViewModel).GetProperty(nameof(AccountViewModel.IsConnected));
isConnectedPropertyInfo?.SetValue(accountViewModel, isConnected);

accountViewModel.RemainingTimeProgressBarColor.Should().Be(expectedColor);
}
Expand Down

0 comments on commit f82ac21

Please sign in to comment.