Example #1
0
        public void CanGetListOfLabels()
        {
            var labelRepository = new LocalRepository <Label>();

            labelRepository.Add(new Label()
            {
                Id = 1, Name = "Label 1"
            });
            labelRepository.Add(new Label()
            {
                Id = 2, Name = "Label 2"
            });
            labelRepository.Add(new Label()
            {
                Id = 3, Name = "Label 3"
            });

            var clientRepository = new LocalRepository <Client>();
            var controller       = new LabelController(labelRepository, clientRepository);
            var result           = controller.Index() as ViewResult;
            var resultModel      = result.Model as LabelsViewModel;

            Assert.AreEqual(3, resultModel.Labels.Count);
            Assert.IsTrue(resultModel.Labels.Any(l => l.Id == 1 && l.Name == "Label 1"));
            Assert.IsTrue(resultModel.Labels.Any(l => l.Id == 2 && l.Name == "Label 2"));
            Assert.IsTrue(resultModel.Labels.Any(l => l.Id == 3 && l.Name == "Label 3"));
        }
        public void UserCanSeeAllTheCompaniesInTheSystem()
        {
            ViewResult     res = _controller.Index(_ownerApproved.User) as ViewResult;
            IndexViewModel vm  = (IndexViewModel)res?.Model;

            Assert.Equal(_context.Companies, vm.Companies);
        }
Example #3
0
        public void CanGetEmptyListOfLabels()
        {
            var labelRepository  = new LocalRepository <Label>();
            var clientRepository = new LocalRepository <Client>();
            var controller       = new LabelController(labelRepository, clientRepository);
            var result           = controller.Index() as ViewResult;
            var resultModel      = result.Model as LabelsViewModel;

            Assert.AreEqual(0, resultModel.Labels.Count);
        }