¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io
Re: [TDD] How do I unit test a Dispose method ?
It depends. If its Dispose() method has been called (its owner has requested early release of its resources), then it is required to call Dispose() on all of its IDisposable objects. However, if its
By David Burstin · #35480 ·
Re: [TDD] How do I unit test a Dispose method ?
Should an IDisposable object call Dispose on the IDisposable objects that it holds? Sent: Sunday, February 2, 2014 7:25 PM To: testdrivendevelopment@... Subject: Re: [TDD] How do I unit
By Amir Kolsky · #35479 ·
Re: [TDD] How do I unit test a Dispose method ?
Hi all. Long time listener, first time caller :) I've just finished a blog post called Growing IDisposable Guided
By David Burstin · #35478 ·
Re: [TDD] How do I unit test a Dispose method ?
.a. Yes, you are right it's an implementation detail. Would another way make things easier? For example, separate the storing of the password from the Connection. You might delegate to the
By Donaldson, John <john.m.donaldson@...> · #35477 ·
Re: [TDD] How do I unit test a Dispose method ?
Here's another way of thinking about this - Whether a member is IDisposable or not is really an implementation issue (as which members comprise an object is private). So the general question here is
By Amir Kolsky · #35476 ·
Re: Single assert / Single mock rule in practice
Some more links concerning the Command Query separation issue: Sandy Metz had a nice explanation ans slides: http://www.youtube.com/watch?v=qPfQM4w4I04&t=12m54s Similar post by Mark Seemann:
By robi.yagel · #35475 ·
Re: [TDD] How do I unit test a Dispose method ?
Isn't there already an IDisposable interface? which means you can easily create an IDisposable MOCK object and check if dispose was called on it. all you would do it then have casted IDisposable in
By Roy Osherove · #35474 ·
Re: [TDD] How do I unit test a Dispose method ?
public Connection(SecureString password) { _myPassword = password.Copy(); // creates a clone of the password which needs to be disposed } public void Dispose() { _myPassword.Dispose(); // releases
By Gishu · #35473 ·
Re: [TDD] How do I unit test a Dispose method ?
A method on Connection: hasPassword? R Ron Jeffries www.XProgramming.com You never know what is enough unless you know what is more than enough. -- William Blake
By Ron Jeffries · #35472 ·
Re: [TDD] How do I unit test a Dispose method ?
Gishu, Could you inject a mocked SecureString? Then you can check if the SecureString.Dispose is called. Seems like a good place to use a mock as it's a "tell" pattern. John D. Sent: 23 January
By Donaldson, John <john.m.donaldson@...> · #35471 ·
Re: [TDD] How do I unit test a Dispose method ?
How does a connection get its SecureString? Can you inject one for test purposes, saving a reference to it? Charlie
By Charlie Poole · #35470 ·
How do I unit test a Dispose method ?
The question is a bit .Net specific. Assuming the simple case, where I have a type which wraps a internal IDisposable member. class Connection { private SecureString password; } SecureString is
By Gishu · #35469 ·
Re: [TDD] Re: Single assert / Single mock rule in practice
I misunderstood it then, I thought the sole purpose of such alternative implementation is to double/fake the real xdep, solely for testing. Best regards, -- Mateusz ?oskot,
By Mateusz ?oskot <mateusz@...> · #35468 ·
Re: [TDD] Re: Single assert / Single mock rule in practice
Ummm.. it's not the same effect. My alternative implementation is REALLY used by the application (for example, in the weekly iteration deliverable), so no fixed return_value to set via mock magic. I'm
By Angel Java Lopez · #35467 ·
Re: [TDD] Re: Single assert / Single mock rule in practice
It makes sense to me, but if we forget Python's module name of unittest.mock uses word 'mock', then the only difference at low level of how xdep double is implemented: - you would write by hand an
By Mateusz ?oskot <mateusz@...> · #35466 ·
Re: [TDD] Single assert / Single mock rule in practice
I would not use a mock for it, since it is giving info back into the Roy, Thanks for the excellent clarification, it helps to grasp other resources of yours that I've had pleasure to
By Mateusz ?oskot <mateusz@...> · #35465 ·
Re: [TDD] Re: Single assert / Single mock rule in practice
Interesting thread! Regarding def exists(item_id): xdep.open() # opens some remote resource item = xdep.get_item(item_id) xdep.close() if item: return item.id == item_id
By Angel Java Lopez · #35464 ·
Re: [TDD] Single assert / Single mock rule in practice
Sort of, related to Tell, Don't Ask? I'll learn about it, thanks. I've always found that the most coherent and useful way to explain why you So, if the SUT cares about the value that a method returns
By Mateusz ?oskot <mateusz@...> · #35463 ·
Re: [TDD] Re: Single assert / Single mock rule in practice
On 15 January 2014 20:08, Adam Sroka <adam.sroka@...> wrote: > On Wed, Jan 15, 2014 at 12:56 PM, Mateusz ?oskot <mateusz@...>wrote: > >> On 15 January 2014 04:41, Adam Sroka
By Mateusz ?oskot <mateusz@...> · #35462 ·
Re: [TDD] Single assert / Single mock rule in practice
Here is how I define a unit of work (the thing under test) (from book chapter PDF: http://www.manning-source.com/books/osherove2/sample_ch01_Osherove2_November11.pdf) Definition A unit of work is the
By Roy Osherove · #35461 ·