public void AddUserStoryToSprint() { // 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); Sprint sprint = new Sprint(3); sprint.sprintId = 1; UserStory userStory = new UserStory("user story message", 3, 0, -1); userStory.sprintId = 1; userStory.storyId = 1; bool added = service.AddUserStoryToSprint(userStory); Assert.AreEqual(1, context.UserStories.Find(1).SprintId); Assert.AreEqual(true, added); } } finally { connection.Close(); } }
public bool addUserStoryToSprint(UserStory userStory) { return(_groupRepository.AddUserStoryToSprint(userStory)); }