Esempio n. 1
0
        public void Should_fail_when_derived_type_is_not_serializable_when_presented_as_base_class()
        {
            // arrange
            AddressDto target = fixture.Create <DerivedFromAddressDto>();

            // act
            Action act = () => target.Should().BeJsonSerializable();

            // assert
            act.Should().Throw <Xunit.Sdk.XunitException>("The derived class is not serializable due to a JsonIgnore attribute");
        }
Esempio n. 2
0
        public void Should_Map()
        {
            // Arrange
            Address    address     = FakeVenues.WeiherhofSchule.Address;
            AddressDto expectedDto = VenueDtoData.WeiherhofSchule.Address;

            // Act
            AddressDto dto = _mapper.Map <AddressDto>(address);

            // Assert
            dto.Should().BeEquivalentTo(expectedDto);
        }
Esempio n. 3
0
        public void Should_fail_when_subject_is_not_same_type_as_the_specified_generic_type()
        {
            // arrange
            var target = new AddressDto();

            // act
            Action act = () => target.Should().BeJsonSerializable <SimplePocoWithPrimitiveTypes>();

            // assert
            act.Should().Throw <Xunit.Sdk.XunitException>(because: "This is consistent with BeBinarySerializable() and BeDataContractSerializable()")
            .Which.Message
            .Should().Contain("is not assignable to")
            .And.Contain(nameof(SimplePocoWithPrimitiveTypes));
        }