예제 #1
0
        public void ShouldBeOneOf()
        {
            DocExampleWriter.Document(() =>
            {
                var apu = new Person {
                    Name = "Apu"
                };
                var homer = new Person {
                    Name = "Homer"
                };
                var skinner = new Person {
                    Name = "Skinner"
                };
                var barney = new Person {
                    Name = "Barney"
                };
                var theBeSharps = new List <Person> {
                    homer, skinner, barney
                };

                apu.ShouldBeOneOf(theBeSharps.ToArray());
            }, _testOutputHelper);
        }
 public void ShouldAllBeEqual()
 {
     DocExampleWriter.Document(() =>
     {
         var lisa = new Person()
         {
             Name = "Lisa"
         };
         var bart = new Person()
         {
             Name = "Bart"
         };
         var maggie = new Person()
         {
             Name = "Maggie"
         };
         var simpsonsKids = new List <Person>()
         {
             bart, lisa, maggie, maggie
         };
         simpsonsKids.ShouldAllBeEqual();
     }, _testOutputHelper);
 }
예제 #3
0
        public void ShouldNotContain()
        {
            DocExampleWriter.Document(() =>
            {
                var homerSimpson = new Person {
                    Name = "Homer"
                };
                var homerGlumplich = new Person {
                    Name = "Homer"
                };
                var lenny = new Person {
                    Name = "Lenny"
                };
                var carl = new Person {
                    Name = "carl"
                };
                var clubOfNoHomers = new List <Person> {
                    homerSimpson, homerGlumplich, lenny, carl
                };

                clubOfNoHomers.ShouldNotContain(homerSimpson);
            }, _testOutputHelper);
        }
예제 #4
0
        public void Enumerables()
        {
            DocExampleWriter.Document(() =>
            {
                var apu = new Person {
                    Name = "Apu"
                };
                var homer = new Person {
                    Name = "Homer"
                };
                var skinner = new Person {
                    Name = "Skinner"
                };
                var barney = new Person {
                    Name = "Barney"
                };
                var theBeSharps = new List <Person> {
                    homer, skinner, barney
                };

                theBeSharps.ShouldBe(new[] { apu, homer, skinner, barney });
            }, _testOutputHelper);
        }
        public void ShouldNotContain_Predicate()
        {
            DocExampleWriter.Document(() =>
            {
                var mrBurns = new Person()
                {
                    Name = "Mr.Burns", Salary = 3000000
                };
                var kentBrockman = new Person()
                {
                    Name = "Homer", Salary = 3000000
                };
                var homer = new Person()
                {
                    Name = "Homer", Salary = 30000
                };
                var millionares = new List <Person>()
                {
                    mrBurns, kentBrockman, homer
                };

                millionares.ShouldNotContain(m => m.Salary < 1000000);
            }, _testOutputHelper);
        }
        public void ShouldContain()
        {
            DocExampleWriter.Document(() =>
            {
                var mrBurns = new Person()
                {
                    Name = "Mr.Burns", Salary = 3000000
                };
                var kentBrockman = new Person()
                {
                    Name = "Kent Brockman", Salary = 3000000
                };
                var homer = new Person()
                {
                    Name = "Homer", Salary = 30000
                };
                var millionares = new List <Person>()
                {
                    kentBrockman, homer
                };

                millionares.ShouldContain(mrBurns);
            }, _testOutputHelper);
        }
예제 #7
0
 public void ShouldThrowFunc()
 {
     DocExampleWriter.Document(() => { Should.Throw <ArgumentNullException>(() => new Person("Homer")); }, _testOutputHelper);
 }
예제 #8
0
 public void ShouldNotBeSameAs()
 {
     DocExampleWriter.Document(() =>
     {
     }, _testOutputHelper);
 }