Click here to Skip to main content
15,888,527 members
Home / Discussions / C#
   

C#

 
AnswerRe: Create Custom File Property/Attribute Pin
OriginalGriff22-Mar-20 10:14
mveOriginalGriff22-Mar-20 10:14 
GeneralRe: Create Custom File Property/Attribute Pin
Kevin Marois22-Mar-20 13:02
professionalKevin Marois22-Mar-20 13:02 
AnswerRe: Abuse Standard File Property/Attribute Pin
Luc Pattyn22-Mar-20 10:36
sitebuilderLuc Pattyn22-Mar-20 10:36 
GeneralRe: Abuse Standard File Property/Attribute Pin
Kevin Marois22-Mar-20 13:04
professionalKevin Marois22-Mar-20 13:04 
Questionupdate problem Pin
ago248619-Mar-20 23:31
ago248619-Mar-20 23:31 
AnswerRe: update problem Pin
OriginalGriff20-Mar-20 0:03
mveOriginalGriff20-Mar-20 0:03 
GeneralRe: update problem Pin
ago248620-Mar-20 0:08
ago248620-Mar-20 0:08 
GeneralRe: update problem Pin
ago248620-Mar-20 2:52
ago248620-Mar-20 2:52 
GeneralRe: update problem Pin
OriginalGriff20-Mar-20 3:00
mveOriginalGriff20-Mar-20 3:00 
GeneralRe: update problem Pin
ago248620-Mar-20 3:10
ago248620-Mar-20 3:10 
Questionproblem to make a second recording Pin
ago248618-Mar-20 23:58
ago248618-Mar-20 23:58 
AnswerRe: problem to make a second recording Pin
OriginalGriff19-Mar-20 0:06
mveOriginalGriff19-Mar-20 0:06 
GeneralRe: problem to make a second recording Pin
ago248619-Mar-20 0:29
ago248619-Mar-20 0:29 
GeneralRe: problem to make a second recording Pin
OriginalGriff19-Mar-20 0:35
mveOriginalGriff19-Mar-20 0:35 
GeneralRe: problem to make a second recording Pin
ago248619-Mar-20 0:48
ago248619-Mar-20 0:48 
GeneralRe: problem to make a second recording Pin
OriginalGriff19-Mar-20 0:52
mveOriginalGriff19-Mar-20 0:52 
GeneralRe: problem to make a second recording Pin
ago248619-Mar-20 0:59
ago248619-Mar-20 0:59 
GeneralRe: problem to make a second recording Pin
ago248619-Mar-20 2:06
ago248619-Mar-20 2:06 
GeneralRe: problem to make a second recording Pin
OriginalGriff19-Mar-20 2:26
mveOriginalGriff19-Mar-20 2:26 
GeneralRe: problem to make a second recording Pin
ago248619-Mar-20 3:04
ago248619-Mar-20 3:04 
GeneralRe: problem to make a second recording Pin
OriginalGriff19-Mar-20 3:22
mveOriginalGriff19-Mar-20 3:22 
GeneralRe: problem to make a second recording Pin
ago248619-Mar-20 3:27
ago248619-Mar-20 3:27 
QuestionRe: problem to make a second recording Pin
ZurdoDev19-Mar-20 3:51
professionalZurdoDev19-Mar-20 3:51 
QuestionHow to solve 100 Doors Kata using TDD in C# Pin
User-862169518-Mar-20 5:30
User-862169518-Mar-20 5:30 
AnswerRe: How to solve 100 Doors Kata using TDD in C# Pin
Bohdan Stupak19-Mar-20 5:12
professionalBohdan Stupak19-Mar-20 5:12 
IMO it's a bit impractical to use TDD here since you should have a test case for every door, which means having 100 cases.
What you can do to reduce number of test cases is to use test oracle technique. You implement the simplest algorithm possible and compare your solution to output it renders. For example
C#
public static void OracleImplementation(bool[] doors)
{
	for (int p = 0; p < 100; p++)
	{
		for (int d = 0; d < 100; d++)
		{
			if ((d + 1) % (p + 1) == 0)
			{
				doors[d] = !doors[d];
			}
		}
	}
}

[Fact]
public void Test() 
{
	var a = new bool[100];
	OracleImplementation(a);

	var b = new bool[100];
	YourCleverImplementation(b);	

	b.Should().Equal(a);
}

Note that I've used here a rough sketch of what FluentAssertions do. It may be incomplete tho.
Now in YourCleverImplementation you can come up with more witty solution i.e. select all perfect squares from 1 to 100 and just set your array items to true at indices that are perfect square - 1.
Alternatively, you can use this approach as a test oracle and come up with one more implementation.
I'll leave the rest up to you Smile | :)

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.