Example #1
0
            public void The_structure_can_be_converted_to_a_dictionary_null_is_included()
            {
                // Arrange
                var basicStructure = new NonNestedBasicStructure()
                {
                    Third = null
                };

                // Act
                var result = _mapper.Map(basicStructure);

                // Assert
                result.Should().BeAssignableTo <Dictionary <string, object> >();
                var dict = (Dictionary <string, object>)result;

                dict.Should().NotContainKey("Third");
            }
Example #2
0
            public void The_structure_can_be_converted_to_a_dictionary()
            {
                // Arrange
                var basicStructure = new NonNestedBasicStructure()
                {
                    First = false, Second = 123, Third = "Ok"
                };

                // Act
                var result = _mapper.Map(basicStructure);

                // Assert
                result.Should().BeAssignableTo <Dictionary <string, object> >();
                var dict = (Dictionary <string, object>)result;

                dict.Should().ContainKey("a");
                dict["a"].Should().Be(false);

                dict.Should().ContainKey("b");
                dict["b"].Should().Be(123);

                dict.Should().ContainKey("Third");
                dict["Third"].Should().Be("Ok");
            }