public void Create_SamePipingStochasticSoilProfileMultipleTimes_ReturnSameEntity() { // Setup PipingSoilProfile soilProfile = PipingSoilProfileTestFactory.CreatePipingSoilProfile(); var stochasticSoilProfile = new PipingStochasticSoilProfile(0.4, soilProfile); var registry = new PersistenceRegistry(); // Call PipingStochasticSoilProfileEntity entity1 = stochasticSoilProfile.Create(registry, 0); PipingStochasticSoilProfileEntity entity2 = stochasticSoilProfile.Create(registry, 0); // Assert Assert.AreSame(entity1, entity2); }
public void Create_PersistenceRegistryNull_ThrowsArgumentNullException() { // Setup var stochasticSoilProfile = new PipingStochasticSoilProfile(0.4, PipingSoilProfileTestFactory.CreatePipingSoilProfile()); // Call TestDelegate test = () => stochasticSoilProfile.Create(null, 0); // Assert string parameterName = Assert.Throws <ArgumentNullException>(test).ParamName; Assert.AreEqual("registry", parameterName); }
public void Create_DifferentStochasticSoilProfilesWithSamePipingSoilProfile_ReturnsPipingStochasticSoilProfileEntityWithSameSoilProfileEntitySet() { // Setup PipingSoilProfile testPipingSoilProfile = PipingSoilProfileTestFactory.CreatePipingSoilProfile(); var firstStochasticSoilProfile = new PipingStochasticSoilProfile(new Random(21).NextDouble(), testPipingSoilProfile); var secondStochasticSoilProfile = new PipingStochasticSoilProfile(new Random(21).NextDouble(), testPipingSoilProfile); var registry = new PersistenceRegistry(); // Call PipingStochasticSoilProfileEntity firstEntity = firstStochasticSoilProfile.Create(registry, 0); PipingStochasticSoilProfileEntity secondEntity = secondStochasticSoilProfile.Create(registry, 0); // Assert Assert.AreSame(firstEntity.PipingSoilProfileEntity, secondEntity.PipingSoilProfileEntity); }
public void Create_WithCollector_ReturnsPipingStochasticSoilProfileEntityWithPropertiesSet() { // Setup var random = new Random(21); double probability = random.NextDouble(); int order = random.Next(); var stochasticSoilProfile = new PipingStochasticSoilProfile(probability, PipingSoilProfileTestFactory.CreatePipingSoilProfile()); var registry = new PersistenceRegistry(); // Call PipingStochasticSoilProfileEntity entity = stochasticSoilProfile.Create(registry, order); // Assert Assert.IsNotNull(entity); Assert.AreEqual(probability, entity.Probability); Assert.IsNotNull(entity.PipingSoilProfileEntity); Assert.AreEqual(order, entity.Order); }