public void Transform_StochasticSoilProfileNull_ThrowsArgumentNullException() { // Setup PipingSoilProfile soilProfile = PipingSoilProfileTestFactory.CreatePipingSoilProfile(); // Call TestDelegate test = () => PipingStochasticSoilProfileTransformer.Transform(null, soilProfile); // Assert var exception = Assert.Throws <ArgumentNullException>(test); Assert.AreEqual("stochasticSoilProfile", exception.ParamName); }
public void Transform_PipingSoilProfileNull_ThrowsArgumentNullException() { // Setup var mockRepository = new MockRepository(); var soilProfile = mockRepository.Stub <ISoilProfile>(); mockRepository.ReplayAll(); StochasticSoilProfile stochasticSoilProfile = StochasticSoilProfileTestFactory.CreateStochasticSoilProfileWithValidProbability(soilProfile); // Call TestDelegate test = () => PipingStochasticSoilProfileTransformer.Transform(stochasticSoilProfile, null); // Assert var exception = Assert.Throws <ArgumentNullException>(test); Assert.AreEqual("soilProfile", exception.ParamName); mockRepository.VerifyAll(); }
public void Transform_ValidStochasticSoilProfile_ReturnsExpectedPipingStochasticSoilProfile() { // Setup var random = new Random(21); var mockRepository = new MockRepository(); var soilProfile = mockRepository.Stub <ISoilProfile>(); mockRepository.ReplayAll(); PipingSoilProfile pipingSoilProfile = PipingSoilProfileTestFactory.CreatePipingSoilProfile(); var stochasticSoilProfile = new StochasticSoilProfile(random.NextDouble(), soilProfile); // Call PipingStochasticSoilProfile pipingStochasticSoilProfile = PipingStochasticSoilProfileTransformer.Transform(stochasticSoilProfile, pipingSoilProfile); // Assert Assert.AreEqual(stochasticSoilProfile.Probability, pipingStochasticSoilProfile.Probability); Assert.AreSame(pipingSoilProfile, pipingStochasticSoilProfile.SoilProfile); mockRepository.VerifyAll(); }
public void Transform_InvalidStochasticSoilProfile_ThrowsImportedDataTransformException() { // Setup var mocks = new MockRepository(); var soilProfile = mocks.Stub <ISoilProfile>(); mocks.ReplayAll(); PipingSoilProfile pipingSoilProfile = PipingSoilProfileTestFactory.CreatePipingSoilProfile(); var stochasticSoilProfile = new StochasticSoilProfile(double.NaN, soilProfile); // Call TestDelegate call = () => PipingStochasticSoilProfileTransformer.Transform(stochasticSoilProfile, pipingSoilProfile); // Assert var exception = Assert.Throws <ImportedDataTransformException>(call); Exception innerException = exception.InnerException; Assert.IsInstanceOf <ArgumentException>(innerException); Assert.AreEqual(innerException.Message, exception.Message); }