public void Next_ReturnsStringOfCorrectSize(int min, int max)
 {
     RandomStringSource source = new RandomStringSource(min, max);
     for (int x = 0; x < 10; x++)
     {
         string value = source.Next(null);
         Assert.GreaterOrEqual(value.Length, min );
         Assert.LessOrEqual(value.Length, max);
     }
 }
        public void Next_ReturnsStringOfCorrectSize(int min, int max)
        {
            RandomStringSource source = new RandomStringSource(min, max);

            for (int x = 0; x < 10; x++)
            {
                string value = source.Next(null);
                Assert.GreaterOrEqual(value.Length, min);
                Assert.LessOrEqual(value.Length, max);
            }
        }
        public void Next_ReturnsSameStringFromTwoSources()
        {
            RandomStringSource sourceOne = new RandomStringSource(0, 10);
            RandomStringSource sourceTwo = new RandomStringSource(0, 10);

            for (int x = 0; x < 10; x++)
            {
                String one = sourceOne.Next(null);
                String two = sourceTwo.Next(null);

                Assert.AreEqual(one, two);
            }
        }
Exemplo n.º 4
0
        public void Next_ReturnsSameStringFromTwoSources()
        {
            RandomStringSource sourceOne = new RandomStringSource(0, 10);
            RandomStringSource sourceTwo = new RandomStringSource(0, 10);

            for (int x = 0; x < 10; x++)
            {
                String one = sourceOne.Next(null);
                String two = sourceTwo.Next(null);

                Assert.AreEqual(one, two);
            }
        }
        public void AddResponseToProblem()
        {
            var member = _session.Single<Member>().Get();
            _conn.Collection<Member>(CollectionNames.Member).Save(member);

            var problem = _problemService.CreateProblem("Problem 3244", "Some description", member);

            var stringSource = new RandomStringSource(5, 20);
            for (int i = 0; i < 10; i++)
            {
                _problemService.AddResponse(problem.Id.ToString(), stringSource.Next(_session), member);
            }

            // Get responses from db and check them.
            var fromDb = _problemCollection.AsQueryable().Where(p => p.Id == problem.Id).First();
            Assert.That(fromDb.Responses.Count, Is.EqualTo(10));
            for (int i = 0; i < 10; i++)
            {
                Assert.That(fromDb.Responses[i].UserId, Is.EqualTo(member.Id));
            }
        }
        public void AddResponseToProblem()
        {
            var member = _session.Single <Member>().Get();

            _conn.Collection <Member>(CollectionNames.Member).Save(member);

            var problem = _problemService.CreateProblem("Problem 3244", "Some description", member);

            var stringSource = new RandomStringSource(5, 20);

            for (int i = 0; i < 10; i++)
            {
                _problemService.AddResponse(problem.Id.ToString(), stringSource.Next(_session), member);
            }

            // Get responses from db and check them.
            var fromDb = _problemCollection.AsQueryable().Where(p => p.Id == problem.Id).First();

            Assert.That(fromDb.Responses.Count, Is.EqualTo(10));
            for (int i = 0; i < 10; i++)
            {
                Assert.That(fromDb.Responses[i].UserId, Is.EqualTo(member.Id));
            }
        }