public void SetSiteTest_SpecifiedProperties()
        {
            var siteServiceMock = new Mock <ISiteService>();

            var sites     = new List <ISite>();
            var siteMock1 = new Mock <ISite>();

            siteMock1.SetupGet(x => x.DisplayName).Returns("My Site1");
            siteMock1.SetupGet(x => x.SiteName).Returns("MySite1");
            siteMock1.SetupGet(x => x.DomainName).Returns("localhost1");
            sites.Add(siteMock1.Object);

            var siteMock2 = new Mock <ISite>();

            siteMock2.SetupGet(x => x.DisplayName).Returns("My Site2");
            siteMock2.SetupGet(x => x.SiteName).Returns("MySite2");
            siteMock2.SetupGet(x => x.DomainName).Returns("localhost2");
            sites.Add(siteMock2.Object);

            siteServiceMock.SetupGet(x => x.Sites).Returns(sites);

            var businessLayer = new SetCmsSiteBusiness
            {
                WriteDebug   = Assert.NotNull,
                WriteVerbose = Assert.NotNull,

                SiteService = siteServiceMock.Object,
            };

            businessLayer.Set("My Site3", "MySite1", SiteStatusEnum.Running, "localhost");

            siteServiceMock.Verify(x => x.Update(
                                       It.Is <ISite>(i => i.DisplayName == "My Site3" && i.SiteName == "MySite1" &&
                                                     i.Status == SiteStatusEnum.Running && i.DomainName == "localhost"), false));
        }
        public void SetSiteTest_SpecifiedObject()
        {
            var siteServiceMock = new Mock <ISiteService>();

            var businessLayer = new SetCmsSiteBusiness
            {
                WriteDebug   = Assert.NotNull,
                WriteVerbose = Assert.NotNull,

                SiteService = siteServiceMock.Object,
            };

            var siteMock1 = new Mock <ISite>();

            siteMock1.SetupGet(x => x.DisplayName).Returns("My Site1");
            siteMock1.SetupGet(x => x.SiteName).Returns("MySite1");
            siteMock1.SetupGet(x => x.Status).Returns(SiteStatusEnum.Running);
            siteMock1.SetupGet(x => x.DomainName).Returns("localhost1");

            businessLayer.Set(siteMock1.Object);

            siteServiceMock.Verify(x => x.Update(siteMock1.Object, true));
        }