Exemplo n.º 1
0
        public void EmitType_OfDerivedInterface_ShouldSucceed()
        {
            //Arrange
            var  emitter = new OwnedStateClassEmitter();
            Type myType  = null;

            //Act
            var exception = Record.Exception((Action)(() => myType = StateTypeEmitter.EmitType(typeof(MyDerivedOfNameAndSalary), emitter)));

            //Assert
            exception.Should().BeNull();
            myType.Should().NotBeNull();
            myType.Should().Implement(typeof(MyDerivedOfNameAndSalary));
            myType.Should().Implement(typeof(MyBaseWithNameAndSalary));
        }
Exemplo n.º 2
0
        public void EmitType_OfInterfaceDerivingFromTwoInterfaceWithSameNamedButDifferntTypeProperty_ShouldImplementPropertiesExplicitly()
        {
            //Arrange
            var  emitter = new OwnedStateClassEmitter();
            Type myType  = null;

            //Act
            var exception = Record.Exception((Action)(() => myType = StateTypeEmitter.EmitType(typeof(MyDerivedOfIntAndStringValues), emitter)));

            //Assert
            exception.Should().BeNull();
            myType.Should().NotBeNull();
            myType.Should().Implement(typeof(MyDerivedOfIntAndStringValues));
            myType.Should().Implement(typeof(MyBaseWithStringValue));
            myType.Should().Implement(typeof(MyBaseWithIntValue));
        }