コード例 #1
0
        public void BitFieldOperator_Get_ShouldReturn(bool expected)
        {
            var testStruct = new TestStruct()
            {
                DoubleField  = 0,
                BitField     = expected,
                IntegerField = 0
            };

            var random        = new FastRandom(20210728);
            var parameterSet  = new ParameterSet();
            var fieldOperator = new BitFieldOperator <TestStruct>("BitField", random, parameterSet);

            var result = (bool)fieldOperator.GetValue(testStruct);

            result.Should().Be(expected);
        }
コード例 #2
0
        public void BitFieldOperator_Set_ShouldSet(bool expected)
        {
            var testStruct = new TestStruct()
            {
                DoubleField  = 0.0,
                BitField     = !expected,
                IntegerField = 0
            };

            var random        = new FastRandom(20210728);
            var parameterSet  = new ParameterSet();
            var fieldOperator = new BitFieldOperator <TestStruct>("BitField", random, parameterSet);

            object testObject = testStruct;

            fieldOperator.SetValue(testObject, expected);

            ((TestStruct)testObject).BitField.Should().Be(expected);
        }