public void SetValuesOfAllIn_ListOfTypeWithPrivateSetOnlyProperty_ValueIsNotSet() { var privateSetOnlyType = new MyClassWithGetOnlyPropertySpy(); propertyNamer.SetValuesOfAllIn(new List <MyClassWithGetOnlyPropertySpy> { privateSetOnlyType }); Assert.That(privateSetOnlyType.IsSet, Is.False); }
public void SetValuesOfAllIn_ClassWithNullCharConst_CharConstantIsNotSetByNamer() { var propertyNamer = new RandomValuePropertyNamer(); List<MyClassWithCharConst> list = new List<MyClassWithCharConst>() { new MyClassWithCharConst() }; propertyNamer.SetValuesOfAllIn(list); foreach (var item in list) { Assert.That(item.GetNullCharConst(), Is.EqualTo(MyClassWithCharConst.NullCharConst)); Assert.That(item.GetNonNullCharConst(), Is.EqualTo(MyClassWithCharConst.NonNullCharConst)); } Assert.Pass("A System.FieldAccessException was not thrown because NBuilder didn't try to set the value of the constant"); }
public void SetValuesOfAllIn_ClassWithNullCharConst_CharConstantIsNotSetByNamer() { var builderSetup = new BuilderSettings(); var propertyNamer = new RandomValuePropertyNamer(builderSetup); List <MyClassWithCharConst> list = new List <MyClassWithCharConst>() { new MyClassWithCharConst() }; propertyNamer.SetValuesOfAllIn(list); foreach (var item in list) { item.GetNullCharConst().ShouldBe(MyClassWithCharConst.NullCharConst); item.GetNonNullCharConst().ShouldBe(MyClassWithCharConst.NonNullCharConst); } }
public void SetValuesOfAllIn_ClassWithNullCharConst_CharConstantIsNotSetByNamer() { var propertyNamer = new RandomValuePropertyNamer(); List <MyClassWithCharConst> list = new List <MyClassWithCharConst>() { new MyClassWithCharConst() }; propertyNamer.SetValuesOfAllIn(list); foreach (var item in list) { Assert.That(item.GetNullCharConst(), Is.EqualTo(MyClassWithCharConst.NullCharConst)); Assert.That(item.GetNonNullCharConst(), Is.EqualTo(MyClassWithCharConst.NonNullCharConst)); } Assert.Pass("A System.FieldAccessException was not thrown because NBuilder didn't try to set the value of the constant"); }