示例#1
0
        public void ThatASubstanceFactoryCanCreateSubstanceUsingSubstanceDto()
        {
            var dto  = SubstanceTestFixtures.GetSubstanceDtoWithoutGroup();
            var fact = new SubstanceFactory(dto);

            Assert.IsInstanceOfType(fact.Get(), typeof(Substance));
        }
示例#2
0
        public void ThatSubstanceFactoryCreatesSubstanceWithGroup()
        {
            var dto  = SubstanceTestFixtures.GetSubstanceWithGroup();
            var fact = new SubstanceFactory(dto);

            Assert.IsNotNull(fact.Get().SubstanceGroup);
        }
示例#3
0
        public void ThatSubstanceFactoryCreatesSubstanceWithGroup()
        {
            var dto = SubstanceTestFixtures.GetSubstanceWithGroup();
            var fact = new SubstanceFactory(dto);

            Assert.IsNotNull(fact.Get().SubstanceGroup);
        }
示例#4
0
        public void ThatASubstanceFactoryCanCreateSubstanceUsingSubstanceDto()
        {
            var dto = SubstanceTestFixtures.GetSubstanceDtoWithoutGroup();
            var fact = new SubstanceFactory(dto);

            Assert.IsInstanceOfType(fact.Get(), typeof(Substance));
        }
示例#5
0
        public void ThatSubstanceCreatedWithSubstanceGroupContainsThatSubstance()
        {
            var dto   = SubstanceTestFixtures.GetSubstanceWithGroup();
            var fact  = new SubstanceFactory(dto);
            var subst = fact.Get();

            Assert.IsNotNull(subst.SubstanceGroup.Substances.First() == subst);
        }
示例#6
0
        public void ThatSubstanceCreatedWithSubstanceGroupContainsThatSubstance()
        {
            var dto = SubstanceTestFixtures.GetSubstanceWithGroup();
            var fact = new SubstanceFactory(dto);
            var subst = fact.Get();

            Assert.IsNotNull(subst.SubstanceGroup.Substances.First() == subst);
        }
示例#7
0
        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);
        }
示例#8
0
        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);
        }
示例#9
0
        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));
        }
示例#10
0
        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));
        }