Mocking Encoding.UTF8.GetBytes throws NotImplementedException

2 posts, 0 answers
  1. Andrew
    Andrew avatar
    1 posts
    Member since:
    Nov 2016

    Posted 13 Nov 2016 Link to this post

    Trying to arrange Encoding.UTF8.GetBytes to return some bytes is throwing an NotImplementedException with the message "You can't call the original implementation of a method that does not have one (abstract or interface method). I'm able to successfully mock out Encoding.UTF8.GetString in the exact same way, so this confuses me. Is it a bug?
  2. Svetlozar
    Admin
    Svetlozar avatar
    294 posts

    Posted 16 Nov 2016 Link to this post

    Hi,

    I am really sorry for the inconvenience!

    Could you please send us a complete sample that demonstrates the issue? 

    I tried with 

    Mock.Arrange(() => Encoding.UTF8.GetBytes(Arg.AnyString)).Returns(new byte[] { });
    var bytes = Encoding.UTF8.GetBytes("sample");

    and it is working on my side. I am sorry if I am missing something.

    Regards,
    Svetlozar
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top