public void ThatASubstanceFactoryCanCreateSubstanceUsingSubstanceDto() { var dto = SubstanceTestFixtures.GetSubstanceDtoWithoutGroup(); var fact = new SubstanceFactory(dto); Assert.IsInstanceOfType(fact.Get(), typeof(Substance)); }
public void ThatSubstanceFactoryCreatesSubstanceWithGroup() { var dto = SubstanceTestFixtures.GetSubstanceWithGroup(); var fact = new SubstanceFactory(dto); Assert.IsNotNull(fact.Get().SubstanceGroup); }
public void ThatSubstanceCreatedWithSubstanceGroupContainsThatSubstance() { var dto = SubstanceTestFixtures.GetSubstanceWithGroup(); var fact = new SubstanceFactory(dto); var subst = fact.Get(); Assert.IsNotNull(subst.SubstanceGroup.Substances.First() == subst); }
public void ThatWhenSubstanceIsRemovedFromGroupAssociationsAreRemoved() { var dto = SubstanceTestFixtures.GetSubstanceWithGroup(); var fact = new SubstanceFactory(dto); var subst = fact.Get(); Assert.AreEqual(subst, subst.SubstanceGroup.Substances.First()); subst.RemoveFromSubstanceGroup(); Assert.IsNull(subst.SubstanceGroup); }
public void ThatWhenSubstanceWithGroupIsPersistedSubstanceGroupContainsSubstance() { var dto = SubstanceTestFixtures.GetSubstanceWithGroup(); var fact = new SubstanceFactory(dto); var subst = fact.Get(); Assert.IsTrue(subst.SubstanceGroup.Substances.Contains(subst)); Context.CurrentSession().Transaction.Commit(); Context.CurrentSession().Transaction.Begin(); Assert.IsTrue(subst.SubstanceGroup.Substances.Contains(subst)); }