Hello Telerik Team,
I am working with JustMock and I need to Mock a method that creates 5 instances of PerformanceCounters (MSFT object). My method under test then performs calculations and sets each of these 5 counters with various values. I need to check and Assert on these values in my Unit Test.
However, since these 5 objects get created inside my method under test (and I cannot change that code), I am wondering how to get access to these instances during my JustMock test. Specifically, I need to capture the RawValue property (both get and set) to make sure that the right values are sent into and returned from the property. Without any access to the actual instances, I can;t see how this is done.
As a point of reference, Microsoft Fakes has a technique that specifies 'AllInstances' and this passes in the current object as one of the parameters (see below, the 'counter' parameter)
ShimPerformanceCounter.AllInstances.IncrementByInt64 =
(counter, l) => ShimsContext.ExecuteWithoutShims(() => counter.IncrementBy(l));
Any ideas ?
I am working with JustMock and I need to Mock a method that creates 5 instances of PerformanceCounters (MSFT object). My method under test then performs calculations and sets each of these 5 counters with various values. I need to check and Assert on these values in my Unit Test.
However, since these 5 objects get created inside my method under test (and I cannot change that code), I am wondering how to get access to these instances during my JustMock test. Specifically, I need to capture the RawValue property (both get and set) to make sure that the right values are sent into and returned from the property. Without any access to the actual instances, I can;t see how this is done.
As a point of reference, Microsoft Fakes has a technique that specifies 'AllInstances' and this passes in the current object as one of the parameters (see below, the 'counter' parameter)
ShimPerformanceCounter.AllInstances.IncrementByInt64 =
(counter, l) => ShimsContext.ExecuteWithoutShims(() => counter.IncrementBy(l));
Any ideas ?