public void ShouldDelete() { Session session = new Session(true, 0, "new and shiny", false, 10, 10, this.organisation.Id, 1, this.subtheme.Id, DateTime.Now, DateTime.Now.AddDays(1)); session = this.sessions.Create(session); this.sessions.Delete(session.Id); session = this.sessions.Read(session.Id); Assert.Null(session); }
public void SetUp() { FakeContext context = new FakeContext(); this.sessions = new SessionRepository(context); this.sessioncards = new SessionCardRepository(context); // all other objects than 'sessioncard' are available thanks to a migration test database seed this.session = this.sessions.Read(1); this.sessioncard = new SessionCard("testimage", this.session.Id, "some text"); this.sessioncard = this.sessioncards.Create(sessioncard); }
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 SetUp() { FakeContext context = new FakeContext(); this.accounts = new AccountRepository(context); this.messages = new ChatMessageRepository(context); this.sessions = new SessionRepository(context); // all other objects than 'message' are available thanks to a migration test database seed this.account = this.accounts.Read(1); this.session = this.sessions.Read(1); this.message = new ChatMessage(account.Id, session.Id, "some message", DateTime.Now); this.message = this.messages.Create(message); }
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.session = this.sessions.Read(this.session.Id); bool cardCreationAllowed = false; int currentPlayerIndex = 1; bool isFinished = true; int maxCardsToChoose = 11; int maxParticipants = 11; this.session.CardCreationAllowed = cardCreationAllowed; this.session.CurrentPlayerIndex = currentPlayerIndex; this.session.IsFinished = isFinished; this.session.MaxCardsToChoose = maxCardsToChoose; this.session.MaxParticipants = maxParticipants; string unchangedDescription = this.session.Description; int unchangedRound = this.session.Round; this.sessions.Update(session); this.session = this.sessions.Read(this.session.Id); Assert.AreEqual(this.session.CardCreationAllowed, cardCreationAllowed); Assert.AreEqual(this.session.CurrentPlayerIndex, currentPlayerIndex); Assert.AreEqual(this.session.Description, unchangedDescription); Assert.AreEqual(this.session.IsFinished, isFinished); Assert.AreEqual(this.session.MaxCardsToChoose, maxCardsToChoose); Assert.AreEqual(this.session.MaxParticipants, maxParticipants); Assert.AreEqual(this.session.Round, unchangedRound); }