Exemplo n.º 1
0
        public void It_should_fail_when_id_doesnt_exist()
        {
            var repository = new Mock <IRepository <Pass> >(MockBehavior.Loose);

            repository.SetReturnsDefault <Pass>(null);

            var passes = Builder <Pass> .CreateListOfSize(1)
                         .All().With(x => x.Id = 1)
                         .Build();

            var result = new DoAllIdExists <Pass>(repository.Object, passes)
                         .IsValid();

            Assert.IsFalse(result);
        }
Exemplo n.º 2
0
        public void It_should_pass_when_all_ids_exists()
        {
            var passes = Builder <Pass> .CreateListOfSize(2)
                         .TheFirst(1).With(x => x.Id = 1)
                         .TheNext(1).With(x => x.Id  = 2)
                         .Build();

            var repository = new Mock <IRepository <Pass> >(MockBehavior.Loose);

            repository.SetReturnsDefault(passes.AsEnumerable());

            var result = new DoAllIdExists <Pass>(repository.Object, passes)
                         .IsValid();

            Assert.IsTrue(result);
        }