Ejemplo n.º 1
0
        public void Getting_type_for_registered_contract_returns_type()
        {
            var fakeContractType = typeof(FakeContract1);
            var sut = new DefaultContractsRegistry(fakeContractType.Assembly);

            var contractType = sut.GetType("FakeContract1");

            Assert.Equal(contractType, fakeContractType);
        }
Ejemplo n.º 2
0
        public void Getting_contract_name_with_datacontract_attribute_for_registered_type_returns_defined_name()
        {
            var fakeContractType = typeof(FakeContract1);
            var sut = new DefaultContractsRegistry(fakeContractType.Assembly);

            var contractName = sut.GetContractName(fakeContractType);

            Assert.Equal(contractName, "FakeContract1");
        }
Ejemplo n.º 3
0
        public void Getting_contract_name_without_datacontract_attribute_for_registered_type_returns_type_fullname()
        {
            var fakeContractType = typeof(FakeContractWithoutDataContract);
            var sut = new DefaultContractsRegistry(fakeContractType.Assembly);

            var contractName = sut.GetContractName(fakeContractType);

            Assert.Equal(contractName, fakeContractType.FullName);
        }
Ejemplo n.º 4
0
        public void Getting_type_for_not_registered_contract_name_throws_NullReferenceException()
        {
            var sut = new DefaultContractsRegistry();

            Assert.Throws <NullReferenceException>(() =>
            {
                sut.GetType("not registered_contract name");
            });
        }