Ejemplo n.º 1
0
        public void LoadProductBacklog()
        {
            // In-memory database only exists while the connection is open
            var connection = new SqliteConnection("DataSource=:memory:");

            connection.Open();
            try
            {
                var options = new DbContextOptionsBuilder <ScrumContext>()
                              .UseSqlite(connection)
                              .Options;

                // Create the schema in the database
                using (var context = new ScrumContext(options))
                {
                    context.Database.EnsureCreated();
                }

                // Run the test against one instance of the context
                using (var context = new ScrumContext(options))
                {
                    var       service   = new GroupRepository(context);
                    UserStory userStory = new UserStory("user story message", 3, 0, 1);
                    bool      added     = service.AddStory(userStory);
                    Assert.AreEqual(true, added);
                    var PB      = service.LoadProductBacklog(1);
                    var message = PB.userStories[1].userStory;
                    Assert.AreEqual(message, context.UserStories.Find(2).Story);
                }
            }
            finally
            {
                connection.Close();
            }
        }
 public bool AddStory(UserStory userStory)
 {
     return(_groupRepository.AddStory(userStory));
 }