15,747,637 members
Home / Discussions / C#

C#

 Re: problem to make a second recording ago248619-Mar-20 0:59 ago2486 19-Mar-20 0:59
 Re: problem to make a second recording ago248619-Mar-20 2:06 ago2486 19-Mar-20 2:06
 Re: problem to make a second recording OriginalGriff19-Mar-20 2:26 OriginalGriff 19-Mar-20 2:26
 Re: problem to make a second recording ago248619-Mar-20 3:04 ago2486 19-Mar-20 3:04
 Re: problem to make a second recording OriginalGriff19-Mar-20 3:22 OriginalGriff 19-Mar-20 3:22
 Re: problem to make a second recording ago248619-Mar-20 3:27 ago2486 19-Mar-20 3:27
 Re: problem to make a second recording ZurdoDev19-Mar-20 3:51 ZurdoDev 19-Mar-20 3:51
 How to solve 100 Doors Kata using TDD in C# User-862169518-Mar-20 5:30 User-8621695 18-Mar-20 5:30
 Hi Guys, I'm trying to write 100 Doors Kata using TDD. I have created the logic like below C# ```// Logic Behind this Kata // 1, 2,....100 // take first example 36- 36 is a perfect square of 6 and it is divisble by 36,18,12,9,6,4,3,2,1 which is 9 Odd // take first example 25- 25 is a perfect square of 5 and it is divisble by 25,5,1 which is 3 Odd // If we talk about not perfect square then - 50 is divisble by 50,25,10,5,2,1 which is 6 Even // If we talk about not perfect square then - 8 is divisble by 8,4,2,1 which is 4 Even // Now take example of 25 => 25 (Open), 5(Close), 1 (Open) // Now 36 => 36(Open),18(Close),12(Open),9(Close),6(Open),4(Close),3(Open),2(Close),1 (Open) // It means every perfect square has Open door // And Every non perfect square has Closed Door ``` But not sure from where I should start to write the Test. I've written 2 test cases like C# ```[TestMethod] public void TestIfAllDoorsAreClosedAtBiginning() { bool[] result = _100DoorsKata.CheckDoorState(0); for (int i = 1; i <= 100; i++) { Assert.IsFalse(result[i]); } } [TestMethod] public void TestIfAllDoorsAreOpenedAfterFirstRound() { bool[] result = _100DoorsKata.CheckDoorState(1); for (int i = 1; i <= 100; i++) { Assert.IsTrue(result[i]); } } ``` And code seems to be: C# ```public bool[] CheckDoorState(int pass) { bool[] doors = new bool[101]; for (int i = 1; i <= 100; i++) { if (pass == 0) { doors[i] = false; } else { doors[i] = true; } } return doors; } ``` Can someone please help me to complete it. Thanksmodified 18-Mar-20 11:37am.
 Re: How to solve 100 Doors Kata using TDD in C# Bohdan Stupak19-Mar-20 5:12 Bohdan Stupak 19-Mar-20 5:12
 problem retrieving info from one table to insert it into another ago248618-Mar-20 3:13 ago2486 18-Mar-20 3:13
 Re: problem retrieving info from one table to insert it into another OriginalGriff18-Mar-20 3:50 OriginalGriff 18-Mar-20 3:50
 Re: problem retrieving info from one table to insert it into another ago248618-Mar-20 4:11 ago2486 18-Mar-20 4:11
 Re: problem retrieving info from one table to insert it into another OriginalGriff18-Mar-20 4:17 OriginalGriff 18-Mar-20 4:17
 Re: problem retrieving info from one table to insert it into another ago248618-Mar-20 4:24 ago2486 18-Mar-20 4:24
 Re: problem retrieving info from one table to insert it into another OriginalGriff18-Mar-20 5:01 OriginalGriff 18-Mar-20 5:01
 Re: problem retrieving info from one table to insert it into another ago248618-Mar-20 5:12 ago2486 18-Mar-20 5:12
 Re: problem retrieving info from one table to insert it into another OriginalGriff18-Mar-20 5:13 OriginalGriff 18-Mar-20 5:13
 Re: problem retrieving info from one table to insert it into another OriginalGriff18-Mar-20 5:16 OriginalGriff 18-Mar-20 5:16
 Re: problem retrieving info from one table to insert it into another ago248618-Mar-20 5:30 ago2486 18-Mar-20 5:30
 Re: problem retrieving info from one table to insert it into another ago248618-Mar-20 5:33 ago2486 18-Mar-20 5:33
 Re: problem retrieving info from one table to insert it into another OriginalGriff18-Mar-20 5:39 OriginalGriff 18-Mar-20 5:39
 Re: problem retrieving info from one table to insert it into another ago248618-Mar-20 5:42 ago2486 18-Mar-20 5:42
 Re: problem retrieving info from one table to insert it into another OriginalGriff18-Mar-20 5:52 OriginalGriff 18-Mar-20 5:52
 Re: problem retrieving info from one table to insert it into another ago248618-Mar-20 5:56 ago2486 18-Mar-20 5:56
 Re: problem retrieving info from one table to insert it into another OriginalGriff18-Mar-20 6:01 OriginalGriff 18-Mar-20 6:01
 Last Visit: 31-Dec-99 18:00     Last Update: 2-Oct-23 9:04 Refresh ᐊ Prev1...213214215216217218219220221222 Next ᐅ