示例#1
0
        public void GetHomeViewModelSingleModelTest()
        {
            var name = "fancy stuff";

            var homebllmock =
                MockHelperBll.GetHomeBll(
                    new List <Module>
            {
                new Module
                {
                    Name = name
                }
            }
                    );

            var rolesMock = MockHelperRoles.GetRoles(new List <String>());

            var target = new HomeService(new NLogLoggerFactory())
            {
                HomeBll = homebllmock,
                Roles   = rolesMock
            };

            var actual = target.GetHomeViewModel();

            actual.Modules.ToList()
            .Count.Should()
            .Be(1);
            actual.Modules.ToList()[0].Name.Should()
            .Be(name);
        }
示例#2
0
        public void GetHomeViewModelEmptyTest()
        {
            var homebllmock =
                MockHelperBll.GetHomeBll(
                    new List <Module>()
                    );

            var rolesMock = MockHelperRoles.GetRoles(new List <String>());

            var target = new HomeService(new NLogLoggerFactory())
            {
                HomeBll = homebllmock,
                Roles   = rolesMock
            };

            var actual = target.GetHomeViewModel();

            actual.Modules.ToList()
            .Count.Should()
            .Be(0);
        }
示例#3
0
        public void GetHomeViewModel2ModelTest()
        {
            var n1 = "TheMightyOne";
            var n2 = "TheMightyTwo";

            var homebllmock =
                MockHelperBll.GetHomeBll(
                    new List <Module>
            {
                new Module {
                    Name = n1
                }
                ,
                new Module {
                    Name = n2
                }
            }
                    );

            var rolesMock = MockHelperRoles.GetRoles(new List <String>());

            var target = new HomeService(new NLogLoggerFactory())
            {
                HomeBll = homebllmock,
                Roles   = rolesMock
            };

            var actual = target.GetHomeViewModel();

            actual.Modules.ToList()
            .Count.Should()
            .Be(2);

            actual.Modules.ToList()[0].Name.Should()
            .Be(n1);
            actual.Modules.ToList()[1].Name.Should()
            .Be(n2);
        }