Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 01 2016 16:24
    jeremymeng synchronize #617
  • Apr 01 2016 14:28
    blairconrad commented #490
  • Apr 01 2016 11:07
    blairconrad commented #629
  • Mar 31 2016 14:14
    PascalK starred FakeItEasy/FakeItEasy
  • Mar 31 2016 13:00
    blairconrad commented #490
  • Mar 31 2016 12:48
    drauch commented #490
  • Mar 31 2016 10:57
    blairconrad commented #617
  • Mar 31 2016 10:52
    adamralph commented #617
  • Mar 31 2016 10:42
    blairconrad commented #617
  • Mar 31 2016 10:41
    blairconrad commented #617
  • Mar 31 2016 10:29
    adamralph commented #617
  • Mar 31 2016 09:27
    adamralph commented #637
  • Mar 31 2016 08:29
    cecilphillip commented #637
  • Mar 31 2016 06:27
    M-Zuber commented #637
  • Mar 31 2016 06:25
    thecodejunkie commented #637
  • Mar 31 2016 06:25
    adamralph commented #637
  • Mar 31 2016 06:24
    adamralph commented #637
  • Mar 31 2016 06:13
    adamralph labeled #637
  • Mar 31 2016 06:13
    adamralph labeled #637
  • Mar 31 2016 06:13
    adamralph assigned #637
Blair Conrad
@blairconrad
Should().BeModuloLineEndings ?
I took out Equivalent because that already have a meaning in FluentAssertions
And I thought "Modulo" was more precise, although it might be more obscure
SecurIOTy
@SecurIOTy
Hi everyone; is this the place to ask FakeItEasy specific questions?
Blair Conrad
@blairconrad
It's a place. Welcome!
SecurIOTy
@SecurIOTy
Thanks :)
Blair Conrad
@blairconrad
Did you have a question, @SecurIOTy? If so, do ask. I'm stepping away from computers for probably an hour or two soon, but if there's a question here when I get back, I will for sure try to answer it!
SecurIOTy
@SecurIOTy
So I have an interface, IInterface that implements IInterface2 that has the same property name Property but IInterface implements that property with a new keyword modifier. FakeItEasy is having trouble keeping the value when it is cast from an IInterface to an IInterface2. Is there a FakeItEasy way to explicitly tell the fake to fake the IInterface2's property?
Sorry if it's confusing. Let me know if anything needs clarification.
Blair Conrad
@blairconrad
Code always helps, but if I understand right, and sorry if I don't, you probably want to at least specify additional interfaces for the fake to implement as in https://fakeiteasy.readthedocs.io/en/stable/creating-fakes/.
But the two properties are effectively two unrelated methods. You will have to set their values or configure their values separately.
Oh! One thing that does occur to me. After creating the Fake you might be able to configure one property to always return the value assigned to the other. e.g. (and I am not checking to see if this even compiles, but would later when I have time):
var fake = A.Fake<IInterface>(options => options.Implements<IInteface2>);
A.CallTo(() => ((IInterface2)fake).Property)).ReturnsLazily(call => ((IInterface)call.FakedObject).Property));
SecurIOTy
@SecurIOTy
Hmm I'll look into what you sent. I don't want to keep you. Thanks!
Blair Conrad
@blairconrad
But then assigning a value to IInterface2.Property later would undo that configuration (unless you configured the setter to write through to IInterface.Property similarly).
Oh, you won't keep me; I'll walk away regardless, but I'm happy to return to the question later.
If what I said doesn't apply, or just makes things worse, and you can share some sample misbehaving test code with a brief explanation, it's probably the best path to getting an answer.
SecurIOTy
@SecurIOTy
It WORKED
You're amazing @blairconrad
Blair Conrad
@blairconrad
Oh, wow. I did not see a notification for this, @SecurIOTy. I'm glad it worked. Happy FakeItEasying!
Blair Conrad
@blairconrad
Thomas Levesque
@thomaslevesque
Blair Conrad
@blairconrad
:tada:
Daniel Weinand
@devployment

Hello. I'm trying to create a fake of IOptionsMonitor<T>like this

var options = A.Fake<IOptionsMonitor<AllowedAppOptions>>();

A.CallTo(() => options.CurrentValue).Returns(new AllowedAppOptions());

As the faked object gets used by accessing CurrentValue I can see the following in the debugger

Method MetadataMethod(6000045 Microsoft.Extensions.Options.IOptionsMonitor`1::get_CurrentValue,0p) could not be resolved on type MetadataClassType(Castle.Proxies.ObjectProxy_3)

Am I missing something here or is it a general issue?

Thomas Levesque
@thomaslevesque
Hi @devployment
I haven't seen this before. Which version of FakeItEasy are you using? What's the target framework of your unit tests project?
Daniel Weinand
@devployment
Target framework is netcoreapp3.0. FakeItEasy is 5.4.0
Thomas Levesque
@thomaslevesque
Thanks. I'll see if I can reproduce it
Daniel Weinand
@devployment
If needed I can try to provide a minimal example later today.
Thomas Levesque
@thomaslevesque
When you say "I can see the following in the debugger", do you mean that the code executes correctly but prints this to the debug output?
Also, which version of Microsoft.Extensions.Options are you using? 3.0.0?
Thomas Levesque
@thomaslevesque
@devployment I'm unable to repro....
    class Program
    {
        static void Main(string[] args)
        {
            var monitor = A.Fake<IOptionsMonitor<MyOptions>>();
            A.CallTo(() => monitor.CurrentValue).Returns(new MyOptions());
            var options = monitor.CurrentValue;
        }
    }

    public class MyOptions
    {
        public string Foo { get; set; }
        public int Bar { get; set; }
    }
This code works fine, and there's nothing in the debugger output
Daniel Weinand
@devployment
@thomaslevesque, I can imagine that you're not able to reproduce. The message I see during debugging is not an issue. The issue was my code as I did not initialize the settings themselves. :anguished: So I expected an empty array but instead it returned null. Not related to FakeItEasy. All my fault. Sorry for making noise here.
Thomas Levesque
@thomaslevesque
No problem, glad you were able to resolve this!
Luke Marlin
@LukeMarlin
Hi there
I've got some time today so I wanted to finally take a look at FakeItEasy/FakeItEasy#1602
Blair Conrad
@blairconrad
:wave:
Nice!
It's a super long day here in most of Canada (25 whole hours!).
Luke Marlin
@LukeMarlin
Well @blairconrad you're quick to answer. Impressed :D
Blair Conrad
@blairconrad
If you've not updated lately, get the latest master. @thomaslevesque made things build on at least one flavour of Linux
Luke Marlin
@LukeMarlin
Yes, I noticed, thanks @thomaslevesque for all the work :)
Blair Conrad
@blairconrad
It's luck. I was sitting here trying to arrange a get-together with a cousin.
Luke Marlin
@LukeMarlin
I've been checking on my windows today because I didn't want to take time to make it all work on my arch though :)
Ah alright, glad to hear you're not sitting there all day long :)
Blair Conrad
@blairconrad
Oh. Your distro doesn't work out of the box...