Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt unit tests for PR 42 Add custom formatting for TimeSpan #43

Merged
Merged
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
2 changes: 1 addition & 1 deletion czishrink/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@

<!-- Version -->
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<VersionPrefix>1.1.5<!--bugfix/timespan_format_greater_than_24h--></VersionPrefix>
<VersionPrefix>1.1.6<!--bugfix/timespan_format_greater_than_24h_addendum--></VersionPrefix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace netczicompressTests.ViewModels;
using System.ComponentModel;

using netczicompress.ViewModels;
using netczicompress.ViewModels.Formatters;

/// <summary>
/// Tests for <see cref="AggregateStatisticsViewModel"/>.
Expand All @@ -23,7 +24,7 @@ public void Properties_AfterCreation_HaveExpectedValues()
var sut = fixture.Create<AggregateStatisticsViewModel>();

// ASSERT
sut.Should().BeEquivalentTo(AggregateStatistics.Empty, options => options.Excluding(o => o.Duration));
sut.Should().BeEquivalentTo(AggregateStatistics.Empty);
}

[Fact]
Expand All @@ -48,7 +49,7 @@ public void OnNext_WhenCalled_ChangesPropertyValues()
Times.Once);
propertyListener.VerifyNoOtherCalls();

sut.Should().BeEquivalentTo(newValue, options => options.Excluding(o => o.Duration));
sut.Should().BeEquivalentTo(newValue);
}

[Fact]
Expand Down Expand Up @@ -81,8 +82,15 @@ private static void WhenCalled_DoesNotDoAnything(Action<IObserver<AggregateStati
{
// ARRANGE
IFixture fixture = CreateFixture();

var timeSpanFormatterMock = fixture.Freeze<Mock<ITimeSpanFormatter>>();
timeSpanFormatterMock
.Setup(x => x.FormatTimeSpan(It.IsAny<TimeSpan>()))
.Returns(string.Empty);

var oldValue = fixture.Create<AggregateStatistics>();
var sut = fixture.Create<AggregateStatisticsViewModel>();

sut.OnNext(oldValue);

// ACT
Expand All @@ -92,8 +100,8 @@ private static void WhenCalled_DoesNotDoAnything(Action<IObserver<AggregateStati
// ASSERT
monitor.OccurredEvents.Should().BeEmpty();

// Duration formatting is tested in <see cref="OnNext_WithNewDuration_HasNiceFormattedPropertySet"/>
sut.Should().BeEquivalentTo(oldValue, options => options.Excluding(o => o.Duration));
sut.Should().BeEquivalentTo(oldValue);
sut.FormattedDuration.Should().BeEquivalentTo(string.Empty);
}

private static IFixture CreateFixture()
Expand Down
Loading