public PaymentVoucherControllerTest() { validUser = A.Fake<IUserRepository>(); A.CallTo(() => validUser.CurrentUserId).Returns(1); A.CallTo(() => validUser.CurrentUserName).Returns("Valid User"); invalidUser = A.Fake<IUserRepository>(); A.CallTo(() => invalidUser.CurrentUserId).Returns(2); A.CallTo(() => invalidUser.CurrentUserName).Returns("Invalid User"); projectRepository = new MockProjectRepository(); paymentVoucherRepository = new MockPaymentVoucherRepository(); controller = new PaymentVoucherController(projectRepository, paymentVoucherRepository, validUser); //Create some test data //User 1 creates a project var firstProject = new Project(); firstProject.Name = "Owned Project"; firstProject.OwnerID = validUser.CurrentUserId; projectRepository.Create(firstProject); //User 2 creates a project var secondProject = new Project(); secondProject.Name = "Shared project"; secondProject.OwnerID = invalidUser.CurrentUserId; projectRepository.Create(secondProject); //User 2 invites user 1 to the project var acl = projectRepository.CreateCollaboration(secondProject.ID, "*****@*****.**"); //User 1 accepts projectRepository.AcceptCollaboration(acl.ID, validUser.CurrentUserId); }