public void InOrderAtLeastAdditionalItemAtMiddlePassesTest()
 {
     AssertPasses(
         Items("one", "and a half", "two", "three"),
         AList.InOrder().WithAtLeast(AString.EqualToValues("one", "two", "three"))
         );
 }
 public void InOrderExactMissingItemFailsTest()
 {
     AssertFails(
         Items("one", "two"),
         AList.InOrder().WithOnly(AString.EqualToValues("one", "two", "three"))
         );
 }
 public void InOrderAtLeastPassesTest()
 {
     AssertPasses(
         Items("one", "two", "three"),
         AList.InOrder().WithAtLeast(AString.EqualToValues("one", "two", "three"))
         );
 }
 public void InOrderAtLeastPrimitiveIntItemsPass()
 {
     AssertPasses(
         Items(1, 2, 3),
         AList.InOrder().WithAtLeast(AnInt.EqualTo(1))
         );
 }
 public void ArrayInOrderAtLeastMissingItemMiddleFailsTest()
 {
     AssertFails(
         Array("one", "three"),
         AList.InOrder().WithAtLeast(AString.EqualToValues("one", "two", "three"))
         );
 }
 public void ArrayInOrderAtLeastOutOfOrderItemsFailsTest()
 {
     AssertFails(
         Array("two", "one", "three"),
         AList.InOrder().WithAtLeast(AString.EqualToValues("one", "two", "three"))
         );
 }
 public void ArrayInOrderExactPassesTest()
 {
     AssertPasses(
         Array("one", "two", "three"),
         AList.InOrder().WithOnly(AString.EqualToValues("one", "two", "three"))
         );
 }
 public void InOrderAtLeastMissingItemAtEndFailsTest()
 {
     AssertFails(
         Items("one", "two"),
         AList.InOrder().WithAtLeast(AString.EqualToValues("one", "two", "three"))
         );
 }
 public void InOrderAtLeastAdditionalItemAtStartAndEndPassesTest()
 {
     AssertPasses(
         Items("zero", "one", "two", "three", "four"),
         AList.InOrder().WithAtLeast(AString.EqualToValues("one", "two", "three"))
         );
 }
        //for a bug raised where List matcher becomes confused with property matchers for
        //classes which have subclasses
        public void CanSubClassMatcherAndMatchOnSuperTypePocoTest()
        {
            IList <Employee> employees = new List <Employee>()
            {
                new Employee("Bob")
            };
            IList <Human> humans = new List <Human>()
            {
                new Human("Bob")
            };

            AssertPasses(
                humans,
                AList.InOrder().WithOnly(AHuman.With().Name("Bob"))
                );

            AssertPasses(
                employees,
                AList.InOrder().WithOnly(AnEmployee.With().Name("Bob"))
                );

            AssertPasses(
                employees,
                AList.InOrder().WithOnly(AHuman.With().Name("Bob"))
                );
        }
        public void InOrderAtLeastPrimitiveGuidItemsPass()
        {
            System.Collections.Generic.IEnumerable <Guid> list = new System.Collections.Generic.List <Guid> ();

            if (!typeof(System.Collections.Generic.IEnumerable <Guid>).IsInstanceOfType(list))
            {
                throw new ArgumentException("types don't match");
            }
            Guid g = Guid.NewGuid();

            AssertPasses(
                Items(g, Guid.NewGuid()),
                AList.InOrder().WithAtLeast(AGuid.EqualTo(g))
                );
        }
        public void InjectsDependencies()
        {
            User         user;
            IAuthService authService;

            Scenario()
            .Given(authService = AMock <IAuthService>()
                                 .WhereMethod(svc => svc.GetGroups("Mary")).Returns(new[] { "users", "administrators" })
                                 .Instance)
            .Given(new DependencyInjector
            {
                AuthService = authService,
            })
            .Given(user = new User("Mary"))

            .Then(user.Groups, Is(AList.InOrder().WithOnly(
                                      AString.EqualTo("users"),
                                      AString.EqualTo("administrators")
                                      )));
            ;
        }