public void AddThreeBugsToRepoAndCheckWhetherAllReturnsTheCorrectBugs() { //arrange var context = new BugLoggerDbContext(); var repo = new BugsRepository(context); var countInDbBeforeAddingThreeBugs = context.Bugs.Count(); var bug1 = new Bug { Content = "test bug 1" }; var bug2 = new Bug { Content = "test bug 2" }; var bug3 = new Bug { Content = "test bug 3" }; //act context.Bugs.Add(bug1); context.Bugs.Add(bug2); context.Bugs.Add(bug3); context.SaveChanges(); //assert var countInDbAfterAddingThreeBugs = repo.All().ToList().Count; Assert.AreEqual(3, countInDbAfterAddingThreeBugs - countInDbBeforeAddingThreeBugs); }
public LmPlatformRepositoriesContainer() { UsersRepository = new UsersRepository(_dataContext); BugsRepository = new BugsRepository(_dataContext); BugLogsRepository = new BugLogsRepository(_dataContext); GroupsRepository = new GroupsRepository(_dataContext); ProjectsRepository = new ProjectsRepository(_dataContext); ProjectUsersRepository = new ProjectUsersRepository(_dataContext); ProjectCommentsRepository = new ProjectCommentsRepository(_dataContext); StudentsRepository = new StudentsRepository(_dataContext); SubjectRepository = new SubjectRepository(_dataContext); TestsRepository = new TestsRepository(_dataContext); TestUnlocksRepository = new TestUnlockRepository(_dataContext); QuestionsRepository = new QuestionsRepository(_dataContext); UsersRepository = new UsersRepository(_dataContext); ModulesRepository = new ModulesRepository(_dataContext); LecturerRepository = new LecturerRepository(_dataContext); MessageRepository = new MessageRepository(_dataContext); MaterialsRepository = new MaterialsRepository(_dataContext); FoldersRepository = new FoldersRepository(_dataContext); SubGroupRepository = new SubGroupRepository(_dataContext); AttachmentRepository = new AttachmentRepository(_dataContext); LecturesRepository = new LecturesRepository(_dataContext); LabsRepository = new LabsRepository(_dataContext); ProjectUsersRepository = new ProjectUsersRepository(_dataContext); PracticalRepository = new PracticalRepository(_dataContext); ConceptRepository = new ConceptRepository(_dataContext); WatchingTimeRepository = new WatchingTimeRepository(_dataContext); TestQuestionPassResultsRepository = new TestQuestionPassResultsRepository(_dataContext); //todo UNUSED ProjectMatrixRequirementsRepository = new ProjectMatrixRequirementsRepository(_dataContext); }
static void Main() { UsersRepository usersRepo = new UsersRepository(); BugsRepository bugsRepo = new BugsRepository(); AppService service = new AppService(usersRepo, bugsRepo); LoginController loginController = new LoginController(service); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new LoginForm(loginController)); }
public void AddBug_WhenBugIsInvalid_ShouldThrowException() { // Arrange -> prapare the objects var repo = new BugsRepository(new BugTrackerDbContext()); var invalidBug = new Bug() { Text = null }; // Act -> perform some logic repo.Add(invalidBug); repo.SaveChanges(); // Assert -> expect an exception }
public void AddBug_WhenBugIsInvalid_ShouldThrowException() { // Arrange -> prapare the objects var repo = new BugsRepository(new BugTrackerDbContext()); var invalidBug = new Bug() { Text = null }; // Act -> perform some logic repo.Add(invalidBug); repo.SaveChanges(); // Assert -> expect an exception }
public void AddBugToRepoAndTestWhetherFindReturnsTheCorrectBug() { //arrange var context = new BugLoggerDbContext(); var repo = new BugsRepository(context); var bug = new Bug { Content = "Please fix my blog" }; //act context.Bugs.Add(bug); context.SaveChanges(); //assert var bugFromDb = repo.Find(bug.BugId); Assert.AreEqual(bug.Content, bugFromDb.Content); }
public void AddBugToRepoAndCheckWhetherTheStatusIsPending() { //arrange var context = new BugLoggerDbContext(); var repo = new BugsRepository(context); var bug = new Bug { Content = "Status should be pending" }; //act repo.Add(bug); context.SaveChanges(); //assert var bugFromDb = context.Bugs.Find(bug.BugId); Assert.AreEqual(BugStatus.Pending, bugFromDb.Status); }
public void AddBugToRepoWithNoDataShouldNotHaveADate() { //arrange var context = new BugLoggerDbContext(); var repo = new BugsRepository(context); var bug = new Bug { Content = "Status should be pending" }; //act repo.Add(bug); context.SaveChanges(); //assert var bugFromDb = context.Bugs.Find(bug.BugId); Assert.AreSame(null, bugFromDb.LogDate); Assert.AreEqual(bug.LogDate, bugFromDb.LogDate); }
public void AddBugToRepoAndTestWhetherDeleteByEntityDeletesTheBug() { //arrange var context = new BugLoggerDbContext(); var repo = new BugsRepository(context); var bug = new Bug { Content = "Please fix my blog" }; //act context.Bugs.Add(bug); context.SaveChanges(); //assert repo.Delete(bug); context.SaveChanges(); var bugInDb = context.Bugs.Find(bug.BugId); Assert.AreEqual(null, bugInDb); }
public void AddBugAndUpdateItThenCheckWhetherTheUpdatesAreReflected() { //arrange var context = new BugLoggerDbContext(); var repo = new BugsRepository(context); var bug = new Bug { Content = "New bug" }; //act repo.Add(bug); repo.SaveChanges(); bug.Status = BugStatus.Assigned; repo.SaveChanges(); //assert var bugFromDb = repo.Find(bug.BugId); Assert.AreEqual(BugStatus.Assigned, bugFromDb.Status); }
public void AddBug_WhenBugIsAddedToDb_ShouldReturnBug() { // Arrange -> prapare the objects var repo = new BugsRepository(new BugTrackerDbContext()); var bug = new Bug() { Text = "Sample New Bug", DateCreated = DateTime.Now, Status = BugStatus.New }; // Act -> perform some logic repo.Add(bug); repo.SaveChanges(); // Assert -> validate the results var bugFromDb = repo.Find(bug.Id); Assert.IsNotNull(bugFromDb); Assert.AreEqual(bug.Text, bugFromDb.Text); Assert.AreEqual(bug.Status, bugFromDb.Status); Assert.AreEqual(bug.DateCreated, bugFromDb.DateCreated); Assert.IsTrue(bugFromDb.Id != 0); }
public void AddBug_WhenBugIsAddedToDb_ShouldReturnBug() { // Arrange -> prapare the objects var repo = new BugsRepository(new BugTrackerDbContext()); var bug = new Bug() { Text = "Sample New Bug", DateCreated = DateTime.Now, Status = BugStatus.New }; // Act -> perform some logic repo.Add(bug); repo.SaveChanges(); // Assert -> validate the results var bugFromDb = repo.Find(bug.Id); Assert.IsNotNull(bugFromDb); Assert.AreEqual(bug.Text, bugFromDb.Text); Assert.AreEqual(bug.Status, bugFromDb.Status); Assert.AreEqual(bug.DateCreated, bugFromDb.DateCreated); Assert.IsTrue(bugFromDb.Id != 0); }
public BugsController() { _bugsRepository = new BugsRepository(); _hub = GlobalHost.ConnectionManager.GetHubContext <BugHub>(); }
public AppService(UsersRepository usersRepo, BugsRepository bugsRepo) { this.usersRepo = usersRepo; this.bugsRepo = bugsRepo; loggedUsers = new Dictionary <string, User>(); }
public BugsService(BugsRepository repo) { _repo = repo; }
public BugsService(BugsRepository bugrepo) { _bugrepo = bugrepo; }