public void Should_Throw_If_Adding_Source_That_Has_Already_Been_Added() { // Given var fixture = new NuGetSourcesFixture(); fixture.Source = "existingsource"; fixture.GivenSourceAlreadyHasBeenAdded(); // When var result = Record.Exception(() => fixture.AddSources()); // Then Assert.IsType <InvalidOperationException>(result); Assert.Equal("The source 'existingsource' already exist.", result.Message); }