I have the following contract:
pragma solidity ^0.4.17;
//import "github.com/ethereum/dapp-bin/library/stringUtils.sol";
import "github.com/OpenZeppelin/zeppelin-solidity/contracts/ownership/Ownable.sol";
contract TodoList is Ownable {
event NewTodo(uint todoId, string value);
event DeleteTodo(uint todoId, string value);
//every user has an array of todo items
mapping(uint => address) todoOwner;
//every address has a certain number of todos on it
mapping(address => uint) ownerTodoCount;
TodoItem[] public todoItems;
struct TodoItem {
string value;
bool active;
}
function createTodo(string _value) public returns(uint) {
uint id = todoItems.push(TodoItem(_value, true)) - 1;
todoOwner[id] = msg.sender;
ownerTodoCount[msg.sender]++;
NewTodo(id, _value);
return id;
}
}
Now I would like to write a test on remix to check the behavior of the contract.
pragma solidity ^0.4.17;
import "github.com/trufflesuite/truffle/build/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "./TodoList.sol";
contract TestTodoList {
TodoList todolist = TodoList(DeployedAddresses.TodoList());
// Testing the adopt() function
function testUserCanAddTodo() public {
uint returnedTodo = todolist.createTodo("test");
uint expectedValue = 1;
Assert.equal(returnedTodo, expectedValue, "Todo should be added to the list and return 1.");
}
}
As you can I imported the Assert.sol
file from github, but havent imported the
DeployableContract.sol` file, as it seems that this is automatically generated by truffle.
Any suggestions how to still write my test within the remix browser IDE?
I appreciate your replies