public async Task IsReadyTest(int tfmCount, UpgradeReadiness readiness) { // Arrange var fixture = new Fixture(); var tfms = fixture.CreateMany <TargetFrameworkMoniker>(tfmCount).ToArray(); using var mock = AutoMock.GetLoose(); var readyCheck = mock.Create <MultiTargetFrameworkCheck>(); var project = new Mock <IProject>(); project.Setup(p => p.TargetFrameworks).Returns(tfms); var options = mock.Mock <UpgradeReadinessOptions>(); // Act var result = await readyCheck.IsReadyAsync(project.Object, options.Object, CancellationToken.None).ConfigureAwait(false); // Assert Assert.Equal(readiness, result); }
public async Task ChecksProperty(string isCentrallyManaged, UpgradeReadiness isReady) { // Arrange using var mock = AutoMock.GetLoose(); var file = mock.Mock <IProjectFile>(); file.Setup(f => f.GetPropertyValue("EnableCentralPackageVersions")).Returns(isCentrallyManaged); var project = mock.Mock <IProject>(); project.Setup(f => f.GetFile()).Returns(file.Object); var options = mock.Mock <UpgradeReadinessOptions>(); // Act var result = await mock.Create <CentralPackageManagementCheck>().IsReadyAsync(project.Object, options.Object, default).ConfigureAwait(false); // Assert Assert.Equal(isReady, result); }