using System; using System.Collections.Generic; using System.Linq; using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Integration.IO.Assembly; namespace Ringtoets.Integration.IO.Test.Assembly { [TestFixture] public class ExportableFailureMechanismTest { [Test] public void Constructor_SectionsNull_ThrowsArgumentNullException() { // Setup var random = new Random(21); IEnumerable> sectionAssemblyResults = Enumerable.Empty>(); var code = random.NextEnumValue(); var group = random.NextEnumValue(); // Call TestDelegate call = () => new ExportableFailureMechanism(null, sectionAssemblyResults, code, group); // Assert var exception = Assert.Throws(call); Assert.AreEqual("sections", exception.ParamName); } [Test] public void Constructor_SectionAssemblyResultsNull_ThrowsArgumentNullException() { // Setup var random = new Random(21); IEnumerable sections = Enumerable.Empty(); var code = random.NextEnumValue(); var group = random.NextEnumValue(); // Call TestDelegate call = () => new ExportableFailureMechanism(sections, null, code, group); // Assert var exception = Assert.Throws(call); Assert.AreEqual("sectionAssemblyResults", exception.ParamName); } [Test] public void Constructor_ExpectedValues() { // Setup var random = new Random(21); IEnumerable sections = Enumerable.Empty(); IEnumerable> sectionAssemblyResults = Enumerable.Empty>(); var code = random.NextEnumValue(); var group = random.NextEnumValue(); // Call var failureMechanism = new ExportableFailureMechanism(sections, sectionAssemblyResults, code, group); // Assert Assert.AreSame(sections, failureMechanism.Sections); Assert.AreSame(sectionAssemblyResults, failureMechanism.SectionAssemblyResults); Assert.AreEqual(code, failureMechanism.Code); Assert.AreEqual(group, failureMechanism.Group); } } }