-1

Hey I'm trying to Define a mock database . I'm encountering an error while trying to equate var to Mock<'Repository'> The error is :

The contextual keyword 'var' may only appear within a local variable declaration Or In Script Code.

The Code that I have written is :

 public   class MockingDatabse
{
    //Mock a Payment Info
    var newPayment = new Mock<IPayment>();
}

I know that I can replace 'var' with 'Mock<"Repository">'. But I wanna know I'm not able to use 'var'

sujay kodamala
  • 317
  • 1
  • 5
  • 17

1 Answers1

1

Try this:

 public   class MockingDatabse
{
    //Mock a Payment Info
    Mock<IPayment> newPayment = new Mock<IPayment>();
}
Hari Lubovac
  • 622
  • 4
  • 14