public void ShouldThrowWhenMappingDuplicateIds() { var mappedComponent = new MappedComponent(0, typeof(TestComponent)); var mappedMethod = mappedComponent.MapMethod(0, typeof(TestComponent).GetMethod("PublicMethod")); Action action = () => mappedComponent.MapMethod(mappedMethod.Id, typeof(TestComponent).GetMethod("PublicMethod")); action.ShouldThrow <ArgumentException>(); }
public void ShouldGetMappedMethodByMethodInfo() { var mappedComponent = new MappedComponent(0, typeof(TestComponent)); var mappedMethod = mappedComponent.MapMethod(0, typeof(TestComponent).GetMethod("PublicMethod")); var foundMethod = mappedComponent.GetMethod(mappedMethod.MethodInfo); foundMethod.ShouldBe(mappedMethod); }
public void ShouldMapMethod() { var mappedComponent = new MappedComponent(0, typeof(TestComponent)); var mappedMethod = mappedComponent.MapMethod(0, typeof(TestComponent).GetMethod("PublicMethod")); mappedComponent.MappedMethods.ShouldContain(mappedMethod); mappedMethod.Id.ShouldBe((byte)0); mappedMethod.MethodInfo.ShouldBe(typeof(TestComponent).GetMethod("PublicMethod")); mappedMethod.MappedComponent.ShouldBe(mappedComponent); }