public void ValidatesDeckIdTest() { using DbContext context = CreateContext(); CardCommitValidator validator = new CardCommitValidator(context); Card card = new Card() { CardTemplateId = 1, CardId = 1 }; card.Fields.Add(new CardField() { CardId = 1, FieldName = "TestField", Value = "test" }); //not successful string error = validator.Validate(card); Assert.IsFalse(string.IsNullOrEmpty(error)); //successful card.DeckId = 1; error = validator.Validate(card); Assert.IsTrue(string.IsNullOrEmpty(error)); }