Ejemplo n.º 1
0
        public void SettingEnrollmentFor_WithAnEntity_ShouldChangeToSepcializedSecretary()
        {
            var school = new LocalSchool("Test", @"C:\Test");
            school.Specializations.Add<TestEntity>(FileType.File, null);

            var sut = new Enrollment
            {
                Secretary = new Secretary(),
                FileType = FileType.File,
                School = school
            };

            sut.For<TestEntity>();

            var secretary = sut.Secretary as Secretary<TestEntity>;

            Assert.NotNull(secretary);
            Assert.Equal(FileType.File, sut.FileType);
        }
Ejemplo n.º 2
0
        private void Sample_ApplicationStartup()
        {
            var webMusicSchool = new HttpSchool("webMusicSchool", "localhost", "/dawn");
            webMusicSchool.Specializations.Add<Artist>(FileType.Audio, a => a.Id.ToString());

            var musicSchool = new LocalSchool("MusicSchool", @"C:\test\music");

            musicSchool.Specializations.Add<Artist>(FileType.Audio, a => a.Id.ToString());
            musicSchool.Specializations.Add<Artist>(a => @"temp\" + a.Id.ToString());

            var imageSchool = new LocalSchool("ImageSchool", @"C:\test\images");

            imageSchool.Specializations.Add<Artist>(FileType.Image, a => a.Id.ToString());
            imageSchool.Specializations.Add<User>(FileType.Image, u => u.Id.ToString());

            musicSchool.Enroll().SpecializingIn(FileType.Audio).For<Artist>();
            musicSchool.Enroll().For<Artist>();

            imageSchool.Enroll().SpecializingIn(FileType.Image).For<Artist>();
            imageSchool.Enroll().SpecializingIn(FileType.Image).For<User>();

            webMusicSchool.Enroll().SpecializingIn(FileType.Audio).For<Artist>();

            var ceremony = new GraduationCeremony(musicSchool.Enrollments);
            var grads = new List<Secretary>();

            grads.AddRange(ceremony.GetGraduates());

            ceremony = new GraduationCeremony(imageSchool.Enrollments);

            grads.AddRange(ceremony.GetGraduates());

            ceremony = new GraduationCeremony(webMusicSchool.Enrollments);

            grads.AddRange(ceremony.GetGraduates());

            Locate.InitializeWith(grads);
        }