public void ShouldBeAbleToSaveAndQueryNonSerializable() { ObjectRepository repo = GetTestObjectRepository(MethodBase.GetCurrentMethod().Name); string name = "This is a the name"; DateTime date = DateTime.Now.Subtract(TimeSpan.FromDays(365 * 5)); NotSerializable value = new NotSerializable { Name = name, BooleanProperty = true, BirthDate = date }; repo.Save(value); NotSerializable check = repo.Query <NotSerializable>((ns) => ns.BirthDate == date).FirstOrDefault(); Expect.IsNotNull(check); Expect.AreEqual(name, check.Name); Expect.IsTrue(check.BooleanProperty); Expect.AreEqual(date, check.BirthDate); }
public void XmlSerialization_WrongSerialize() { try { NotSerializable wrongObj = new NotSerializable { A = 2, B = 3 }; wrongObj.Serialize(); throw new AssertFailedException( "Объект не должен был сериализоваться в xml."); } catch { // так и должно быть } }