/// <summary> /// Initializes a new instance of a detected /// <see cref="DotNetVersion"/> of the specified version, with /// the specified service packs and of the specified profile types. /// </summary> /// <remarks> /// Not that the <see cref="DotNetProfiles"/> is a flag enumeration /// meaning that it can represent more than one type of profile. /// </remarks> /// <param name="version"> /// The detected .NET version. /// </param> /// <param name="servicePacks"> /// The detected service packs for the .NET version. /// </param> /// <param name="profiles"> /// The detected .NET profiles. /// </param> public DotNetVersion( Version version, IEnumerable <Version> servicePacks, DotNetProfiles profiles ) { if (version == null) { throw new ArgumentNullException("version"); } if (servicePacks == null) { throw new ArgumentNullException("servicePacks"); } if (!Enum.IsDefined(typeof(DotNetProfiles), profiles)) { throw new ArgumentOutOfRangeException("profiles"); } _version = version; _servicePacks = servicePacks; _profiles = profiles; }
/// <summary> /// Initializes a new instance of a detected /// <see cref="DotNetVersion"/> of the specified version, with /// the specified service packs and of the specified profile types. /// </summary> /// <remarks> /// Not that the <see cref="DotNetProfiles"/> is a flag enumeration /// meaning that it can represent more than one type of profile. /// </remarks> /// <param name="version"> /// The detected .NET version. /// </param> /// <param name="servicePacks"> /// The detected service packs for the .NET version. /// </param> /// <param name="profiles"> /// The detected .NET profiles. /// </param> public DotNetVersion( Version version, IEnumerable<Version> servicePacks, DotNetProfiles profiles ) { if (version == null) { throw new ArgumentNullException("version"); } if (servicePacks == null) { throw new ArgumentNullException("servicePacks"); } if (!Enum.IsDefined(typeof(DotNetProfiles), profiles)) { throw new ArgumentOutOfRangeException("profiles"); } _version = version; _servicePacks = servicePacks; _profiles = profiles; }
public void ToStringNiceRepresentation( string v, string sp, DotNetProfiles p, string res ) { // Fixture setup... // Exercise SUT... var version = new DotNetVersion( new Version(v), string.IsNullOrWhiteSpace(sp) ? new Version[0] : sp.Split(new[] { ',' }).Select(spv => new Version(spv)), p ); // Verify SUT... Assert.That(version.ToString(), Is.EqualTo(res)); // Fixture teardown by GC... }
/// <summary> /// Initializes a new instance of a detected /// <see cref="DotNetVersion"/> of the specified version, with /// no service packs and the specified profiles. /// </summary> /// <param name="version"> /// The detected .NET version. /// </param> /// <param name="profiles"> /// The detected .NET profiles. /// </param> public DotNetVersion(Version version, DotNetProfiles profiles) : this(version, new Version[0], profiles) { }