public void CanSaveConstant_PrimitiveTypes <T>(T value1, T value2, T value3) { Assert.That(dataContext.Select <TestingConstant <T> >().ToArray(), Is.Empty); var values = new T[] { value1, value2, value3 }; foreach (var value in values) { var constant = new TestingConstant <T> { Значение = value }; dataContext.Save(constant); var loadedConstants = dataContext.Select <TestingConstant <T> >().ToArray(); AssertSingleConstant(loadedConstants, constant); } }
public void SavingConstant_ReferenceType() { Assert.That(dataContext.Select <TestingConstant <string> >().ToArray(), Is.Empty); var constant = new TestingConstant <string> { Значение = null }; dataContext.Save(constant); var loadedConstants = dataContext.Select <TestingConstant <string> >().ToArray(); AssertSingleConstant(loadedConstants, constant); constant.Значение = "a"; var loadedConstant = dataContext.Select <TestingConstant <string> >().ToArray().Single(); Assert.That(loadedConstant.Значение, Is.EqualTo(null)); dataContext.Save(constant); loadedConstant = dataContext.Select <TestingConstant <string> >().ToArray().Single(); Assert.That(loadedConstant.Значение, Is.EqualTo("a")); }