public void SetValuesOfAllIn_ListOfTypeWithPrivateSetOnlyProperty_ValueIsNotSet()
        {
            var privateSetOnlyType = new MyClassWithGetOnlyPropertySpy();

            propertyNamer.SetValuesOfAllIn(new List <MyClassWithGetOnlyPropertySpy> {
                privateSetOnlyType
            });

            privateSetOnlyType.IsSet.ShouldBeFalse();
        }
        public void SetValuesOfAllIn_ClassWithNullCharConst_CharConstantIsNotSetByNamer()
        {
            var propertyNamer = new SequentialPropertyNamer(reflectionUtil, new BuilderSettings());

            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);
            }
        }
Exemplo n.º 3
0
        public void SetValuesOfAllIn_ClassWithNullCharConst_CharConstantIsNotSetByNamer()
        {
            var propertyNamer = new SequentialPropertyNamer(reflectionUtil, new BuilderSettings());

            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 propertyNamer = new SequentialPropertyNamer(reflectionUtil,new BuilderSetup());

            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");
        }