This is a migrated thread and some comments may be shown as answers.

Mocking Encoding.UTF8.GetBytes throws NotImplementedException

1 Answer 408 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 14 Nov 2016, 12:55 AM
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?

1 Answer, 1 is accepted

Sort by
0
Svetlozar
Telerik team
answered on 16 Nov 2016, 03:41 PM
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
Tags
General Discussions
Asked by
Andrew
Top achievements
Rank 1
Answers by
Svetlozar
Telerik team
Share this question
or