public void ShouldDelete()
        {
            Subtheme subtheme = new Subtheme("shouldbedeleted", this.organisation.Id, this.theme.Id);
            subtheme = this.subthemes.Create(subtheme);

            this.subthemes.Delete(subtheme.Id);

            subtheme = this.subthemes.Read(subtheme.Id);

            Assert.Null(subtheme);
        }
        public void SetUp()
        {
            FakeContext context = new FakeContext();

            this.organisations = new OrganisationRepository(context);
            this.subthemes = new SubthemeRepository(context);
            this.themes = new ThemeRepository(context);

            // all other objects than 'subtheme' are available thanks to a migration test database seed
            this.organisation = this.organisations.Read(1);
            this.theme = this.themes.Read(1);

            this.subtheme = new Subtheme("NUnitMasterRace", this.organisation.Id, this.theme.Id);
            this.subtheme = this.subthemes.Create(subtheme);
        }
        public void SetUp()
        {
            FakeContext context = new FakeContext();

            this.organisations = new OrganisationRepository(context);
            this.sessions = new SessionRepository(context);
            this.subthemes = new SubthemeRepository(context);

            // all other objects than 'session' are available thanks to a migration test database seed
            this.organisation = this.organisations.Read(1);
            this.subtheme = this.subthemes.Read(1);

            this.session = new Session(true, 0, "NUnitMasterRace", false, 10, 10, this.organisation.Id, 1, this.subtheme.Id, DateTime.Now, DateTime.Now.AddDays(2));
            this.session = this.sessions.Create(session);
        }
        public void OneTimeSetUp()
        {
            this.accounts = FakeServiceFactory.Create<Account>();
            this.organisations = FakeServiceFactory.Create<Organisation>();
            this.sessions = FakeServiceFactory.Create<Session>();
            this.subthemes = FakeServiceFactory.Create<Subtheme>();
            this.themes = FakeServiceFactory.Create<Theme>();

            this.unauthorized = "unauthorizedusersecret";
            this.authorized = "authorizedusersecret";

            Account account1 = new Account("*****@*****.**", "name1", "surname1", "picture1", this.authorized) {
                Organisations = new List<Organisation>(),
                OrganisedSessions = new List<Session>(),
                ParticipatingSessions = new List<Session>(),
                Subthemes = new List<Subtheme>(),
                Themes = new List<Theme>()
            };
            account1 = this.accounts.Add(account1);
            Account account2 = new Account("*****@*****.**", "name2", "surname2", "picture2", this.unauthorized);
            account2 = this.accounts.Add(account2);

            Organisation organisation = new Organisation("name", account1.Id) {
                Sessions = new List<Session>(),
                Themes = new List<Theme>()
            };
            organisation = this.organisations.Add(organisation);
            account1.Organisations.Add(organisation);
            this.accounts.Change(account1);

            Theme theme = new Theme("name", "descr", organisation.Id, organisation.OrganiserId, "tag") {
                Subthemes = new List<Subtheme>()
            };
            theme = this.themes.Add(theme);
            organisation.Themes.Add(theme);
            this.organisations.Change(organisation);
            account1.Themes.Add(theme);
            this.accounts.Change(account1);

            Subtheme subtheme = new Subtheme("name", theme.OrganiserId, theme.Id) {
                Sessions = new List<Session>()
            };
            subtheme = this.subthemes.Add(subtheme);
            theme.Subthemes.Add(subtheme);
            this.themes.Change(theme);
            account1.Subthemes.Add(subtheme);
            this.accounts.Change(account1);

            Session session = new Session(true, 0, "descr", false, 10, 10, organisation.Id, 0, subtheme.Id, DateTime.Now, DateTime.Now.AddDays(5)) {
                Organisers = new List<Account>(),
                Participants = new List<Account>()
            };
            session = this.sessions.Add(session);
            subtheme.Sessions.Add(session);
            this.subthemes.Change(subtheme);
            account1.OrganisedSessions.Add(session);
            session.Organisers.Add(account1);
            account1.ParticipatingSessions.Add(session);
            session.Participants.Add(account1);
            this.accounts.Change(account1);
            this.sessions.Change(session);
        }
        public void ShouldUpdate()
        {
            this.subtheme = this.subthemes.Read(this.subtheme.Id);

            string name = "updatedname";

            this.subtheme.Name = name;

            this.subthemes.Update(subtheme);
            this.subtheme = this.subthemes.Read(this.subtheme.Id);

            Assert.AreEqual(this.subtheme.Name, name);
        }