コード例 #1
0
        public void ParameterAccess_WriteProtectionIsSetToSameValue_WriteProtectionChangedIsNotRaised(bool initialValue, bool updatedValue)
        {
            // arrange
            var access = new ParameterAccess
            {
                IsWriteProtected = initialValue,
            };

            // act
            void Act()
            {
                access.IsWriteProtected = updatedValue;
            }

            // assert
            Event.Monitor <ParameterWriteProtectionChangedEventArgs>(access, nameof(ParameterAccess.WriteProtectionChanged)).
            When(Act).AssertEventNotRaised();
        }
コード例 #2
0
        public void ParameterAccess_WriteProtectionIsUpdated_WriteProtectionChangedIsRaised(bool initialValue, bool updatedValue)
        {
            // arrange
            var access = new ParameterAccess
            {
                IsWriteProtected = initialValue,
            };

            // act
            void Act()
            {
                access.IsWriteProtected = updatedValue;
            }

            // assert
            Event.Monitor <ParameterWriteProtectionChangedEventArgs>(access, nameof(ParameterAccess.WriteProtectionChanged)).
            When(Act).AssertEventRaised().WithSender(access).WithArgument(x => x.IsWriteProtected, updatedValue);
        }
コード例 #3
0
        public void ParameterAccess_HandlingIsSetToSameValue_HandlingChangedIsNotRaised(ParameterHandling initialValue, ParameterHandling updatedValue)
        {
            // arrange
            var access = new ParameterAccess
            {
                Handling = initialValue,
            };

            // act
            void Act()
            {
                access.Handling = updatedValue;
            }

            // assert
            Event.Monitor <ParameterHandlingChangedEventArgs>(access, nameof(ParameterAccess.HandlingChanged)).
            When(Act).AssertEventNotRaised();
        }
コード例 #4
0
        public void ParameterAccess_HandlingIsUpdated_HandlingChangedIsRaised(ParameterHandling initialValue, ParameterHandling updatedValue)
        {
            // arrange
            var access = new ParameterAccess
            {
                Handling = initialValue,
            };

            // act
            void Act()
            {
                access.Handling = updatedValue;
            }

            // assert
            Event.Monitor <ParameterHandlingChangedEventArgs>(access, nameof(ParameterAccess.HandlingChanged)).
            When(Act).AssertEventRaised().WithSender(access).WithArgument(x => x.Handling, updatedValue);
        }
コード例 #5
0
        public void ParameterAccess_Initialized_WriteProtectionIsFalse()
        {
            var access = new ParameterAccess();

            Assert.AreEqual(access.IsWriteProtected, false);
        }
コード例 #6
0
        public void ParameterAccess_Initialized_HandlingIsReadWrite()
        {
            var access = new ParameterAccess();

            Assert.AreEqual(access.Handling, ParameterHandling.ReadWrite);
        }