Can somebody help me resolve this exception:
Test method
KravmagaTests.Model.Entities.StudentTest.Create_Valid_Student threw
exception: System.NotSupportedException: Unable to create a constant
value of type 'Kravmaga.Models.Account'. Only primitive types ('such
as Int32, String, and Guid') are supported in this context.
I get this when I run this test method:
[TestMethod]
public void Create_Valid_Student()
{
Student student = new Student()
{
Username = "username",
Firstname = "firstname",
Surname = "surname",
Email = "[email protected]",
Password = "password",
};
KravmagaContext context = new KravmagaContext();
context.AddToAccounts(student);
context.Save();
bool exists = context.Accounts.Contains(student); // THIS THROWS EXCEPTION
Assert.IsTrue(exists);
}
Thanks a lot.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…