public void TestUpdate()
        {
            Aggregation createdAgg = new Aggregation {
                Id = testId, Name = "Test Agg Entry", Type = "SUM"
            };

            dbContext.Aggregation.Add(createdAgg);
            dbContext.SaveChanges();
            createdAgg.Name = "Entry";

            dbContext.Dispose();
            repo.Update(createdAgg);
            dbContext = new ResearcherProfilerRepositoryContext();

            // Retrieve record from database
            Aggregation updatedAgg = dbContext.Aggregation.Find(testId);

            dbContext.Aggregation.Find(testId);
            Assert.AreEqual(updatedAgg.Id, testId);
            Assert.AreEqual(updatedAgg.Name, "Entry");

            // Cleanup the inserted record
            dbContext.Aggregation.Remove(updatedAgg);
            dbContext.SaveChanges();
        }
        public void TestDelete()
        {
            Aggregation createdAgg = new Aggregation {
                Id = testId, Name = "Test Agg Entry", Type = "SUM"
            };

            dbContext.Aggregation.Add(createdAgg);
            dbContext.SaveChanges();

            dbContext.Dispose();
            repo.Delete(createdAgg);
            dbContext = new ResearcherProfilerRepositoryContext();

            Aggregation result = dbContext.Aggregation.Find(testId);

            Assert.AreEqual(result, null);
        }
 private void Initialize(ResearcherProfilerRepositoryContext databaseContext)
 {
     dbContext = databaseContext;
 }
 public BaseResearcherRepo(ResearcherProfilerRepositoryContext databaseContext)
 {
     Initialize(databaseContext);
 }
Example #5
0
 public void Setup()
 {
     dbContext = new ResearcherProfilerRepositoryContext();
 }
 public void Setup()
 {
     repo      = new TestAggregateRepo();
     dbContext = new ResearcherProfilerRepositoryContext();
     testId    = Guid.NewGuid();
 }