Esempio n. 1
0
        public void Return_10_if_value_of_private_field_is_10()
        {
            //Arrange
            object instance = new PrivateFieldClass(10);

            privateTester = new Core.PrivateTester <PrivateFieldClass>();

            //Act
            var fieldValue = privateTester.GetPrivateField(instance, "privateInt");

            //Assert
            Assert.Equal(10, fieldValue);
        }
Esempio n. 2
0
        public void Throws_if_property_is_public()
        {
            //Arrange
            object @object = new PrivateFieldClass(10);

            privateTester = new Core.PrivateTester <PrivateFieldClass>();

            //Assert
            var fieldName = "publicInt";

            Assert.Throws <PrivatePropertyException>(
                () => privateTester.GetPrivateField(@object, fieldName)
                );
        }
Esempio n. 3
0
        public void Throws_if_property_not_present()
        {
            //Arrange
            object @object = new PrivateFieldClass(10);

            privateTester = new Core.PrivateTester <PrivateFieldClass>();

            //Assert
            var fieldName = "nonExistingField";

            Assert.Throws <PrivatePropertyException>(
                () => privateTester.GetPrivateField(@object, fieldName)
                );
        }