Beispiel #1
0
        public FluentProjectField(FluentProject fluentProject)
        {
            fluentProject.ShouldNotBeNull("FluentProject");

            FluentProject       = fluentProject;
            FluentProject.Field = this;
        }
Beispiel #2
0
        public void Project_ProjectField_One_To_One_Test()
        {
            var project = new FluentProject
            {
                Code = "PRJ-" + Guid.NewGuid(),
                Name = "프로젝트 명"
            };

            project.AddLocale(English, new FluentProjectLocale {
                Name = "FluentProject Name"
            });

            project.Field.Name = project.Name + " - Field";
            project.Field.AddLocale(English, new FluentProjectFieldLocale {
                Name = "FluentProjectField Name"
            });

            UnitOfWork.CurrentSession.Specification <FluentProject>()
            .VerifyTheMappings(project);
        }
Beispiel #3
0
        public void OneToOneTest()
        {
            var project = new FluentProject
            {
                Code = "PRJ-" + Guid.NewGuid().ToString(),
                Name = "프로젝트 명"
            };

            project.AddLocale(English, new FluentProjectLocale {
                Name = "FluentProject Name"
            });

            project.Field.Name = project.Name + " - Field";
            project.Field.AddLocale(English, new FluentProjectFieldLocale {
                Name = "FluentProjectField Name"
            });

            Repository <FluentProject> .SaveOrUpdate(project);

            UnitOfWork.CurrentSession.Flush();
            UnitOfWork.Current.Clear();

            project = UnitOfWork.CurrentSession.Query <FluentProject>().FirstOrDefault();
            Assert.IsNotNull(project);

            var projects = UnitOfWork.CurrentSession.Local <FluentProject>().ToList();

            Assert.Greater(projects.Count, 0);

            Repository <FluentProject> .Delete(project);

            UnitOfWork.Current.TransactionalFlush();

            var projectCount = UnitOfWork.CurrentSession.Query <FluentProject>().Count();

            Assert.AreEqual(0, projectCount);
        }