TEST(TodoList, Can_Delete_By_Pos) {
    // Arrange
    TodoList list;
    vector<TodoItem> v;
    TodoItem temp;

    // Act
    temp.setTitle("abc");
    temp.setPriority(1);
    list.addItem(temp);
    v.push_back(temp);

    temp.setTitle("def");
    temp.setPriority(2);
    list.addItem(temp);

    temp.setTitle("gik");
    temp.setPriority(1);
    list.addItem(temp);
    v.push_back(temp);

    list.deleteItem(1);

    // Assert
    EXPECT_EQ(list.getAll(), v);
}
    // virtual void SetUp() {}
    void ActWithExistingFile(vector<string> args_) {
        vector<const char*> options;
        TodoList list;
        TodoItem temp;

        temp.setTitle("abc");
        temp.setPriority(1);
        temp.setText("abc text");
        list.addItem(temp);

        temp.setTitle("def");
        temp.setPriority(2);
        temp.setText("");
        list.addItem(temp);

        temp.setTitle("gik");
        temp.setPriority(1);
        list.addItem(temp);
        list.save("test.txt");

        options.push_back("appname");
        for (size_t i = 0; i < args_.size(); ++i) {
            options.push_back(args_[i].c_str());
        }

        const char** argv = &options.front();
        int argc = static_cast<int>(args_.size()) + 1;

        output_ = app_(argc, argv);
    }
TEST(TodoList, Throw_When_Add_Existing_Title_By_Parameters) {
    // Arrange
    TodoList list;

    // Act
    list.addItem("abc");

    // Assert
    EXPECT_THROW(list.addItem("abc"), runtime_error);
}
TEST(TodoList, Can_Get_Item) {
    // Arrange
    TodoList list;

    // Act
    list.addItem("abc");
    list.addItem("defg");
    list.addItem("higk");

    // Assert
    EXPECT_EQ(list.getItem(1).getTitle(), "defg");
}
TEST(TodoList, Throw_When_Add_Existing_Title_By_Item) {
    // Arrange
    TodoItem item1;
    TodoItem item2;
    TodoList list;

    item1.setTitle("abc");
    item2.setTitle("abc");

    // Act
    list.addItem(item1);

    // Assert
    EXPECT_THROW(list.addItem(item2), runtime_error);
}
TEST(TodoList, Can_Get_Size) {
    // Arrange
    TodoList list;

    // Act
    list.addItem("abc");

    // Assert
    EXPECT_EQ(1, list.size());
}
TEST(TodoList, Can_Add_By_Parameters) {
    // Arrange
    TodoList list;

    // Act
    list.addItem("abc", 2);

    // Assert
    EXPECT_NE(-1, list.search("abc"));
}
TEST(TodoList, Throws_When_Delete_By_Invalid_Pos) {
    // Arrange
    TodoList list;

    // Act
    list.addItem("abc");

    // Act & Assert
    EXPECT_THROW(list.deleteItem(100500), out_of_range);
}
TEST(TodoList, Can_Add_By_Item) {
    // Arrange
    TodoItem item;
    TodoList list;

    item.setTitle("abc");

    // Act
    list.addItem(item);

    // Assert
    EXPECT_NE(-1, list.search("abc"));
}
TEST(TodoList, Can_Get_All) {
    // Arrange
    TodoList list;
    vector<TodoItem> v;
    TodoItem temp;

    // Act
    temp.setTitle("abc");
    list.addItem(temp);
    v.push_back(temp);

    temp.setTitle("def");
    list.addItem(temp);
    v.push_back(temp);

    temp.setTitle("gik");
    list.addItem(temp);
    v.push_back(temp);

    // Assert
    EXPECT_EQ(list.getAll(), v);
}
TEST(TodoList, Can_Sort_By_Priority) {
    // Arrange
    TodoList list;
    TodoItem temp1;
    TodoItem temp2;
    vector<TodoItem> v;

    // Act
    temp1.setTitle("abc");
    temp1.setPriority(0);

    temp2.setTitle("def");
    temp2.setPriority(5);

    list.addItem(temp2);
    list.addItem(temp1);
    v.push_back(temp1);
    v.push_back(temp2);

    // Assert
    EXPECT_EQ(list.sortByPriority(), v);
}