???????????У?????????????μ???????ó?????????????????????????????????????????????????????????????ɡ??????????????????????????μ???????????????????μ????

public class Blog : UIHelperBase

{


    // ????????

 

    public string Title { get; private set; }


 

    // ??????????

    public string Permalink { get; private set; }


 

 

    // ?????????????

    public string MenuText { get; private set; }

 

 

    public string Owner { get; private set; }

 

 

    public Blog(TestLibrary settings?? string title??

        string permalink?? string menutext?? string owner)

        : base(settings)

    {


        Title = title;

        Permalink = permalink;

        MenuText = menutext;

 

        Owner = owner;

    }

 

    // ??????????????????????????

 

    //

    // PostSetting??????????????????????μ?????????

    // ???????±?????????.


    public Post CreatePost(PostSettings settings)

    {

 

        if (settings == null)

 

            throw new CaseErrorException(new ArgumentNullException("settings"));

 

        if (!String.IsNullOrEmpty(settings.Body))


            throw new CaseErrorException("Set post body is not implemented yet!");

        if (settings.PublishDateTime.HasValue)

 

            throw new CaseErrorException("PublishDateTime is not implemented yet!");


 

 

        // selenium???????????????????????????????????????????

        selenium.Open("/");

 

        selenium.Click("link=Admin");


        selenium.WaitForPageToLoad(TestLibrary.Consts.TimeToWaitForPageToLoad);

        selenium.Click("link=Manage Blogs");


        selenium.WaitForPageToLoad("60000");

        selenium.Click(String.Format("link={0}"?? Title));


        selenium.WaitForPageToLoad(TestLibrary.Consts.TimeToWaitForPageToLoad);

        selenium.Click("link=New Post");

        selenium.WaitForPageToLoad(TestLibrary.Consts.TimeToWaitForPageToLoad);

 

        selenium.Type("Routable_Title"?? settings.Title);

        selenium.Type("Tags"?? settings.Tags);

 

        if (settings.Permalink != null)

 

            selenium.Type("Routable_Slug"?? settings.Permalink);


        if (settings.DisableNewComments)

            selenium.Click("CommentsActive");

 

        if (settings.PublishSetting == PostSettings.PublishSettings.PublishNow)


            selenium.Click("Command_PublishNow");

        else if ( settings.PublishSetting == PostSettings.PublishSettings.PublishLater )

 

            throw new CaseErrorException("PublishLater is not implemented yet!");


 

 

        selenium.Click("submit.Save");

        selenium.WaitForPageToLoad(TestLibrary.Consts.TimeToWaitForPageToLoad);

 

 

        return new Post(TestSettings?? settings?? this);

 

    }

}

 

public class PostSettings

{


    public enum PublishSettings

    {

 

        SaveDraft??

        PublishNow??

 

        PublishLater


    }

 

    public string Title { get; set; }


 


    public string Permalink { get; set; }

 

 

    public string Body { get; set; }

 

 

    public string Tags { get; set; }

 

 

    public bool DisableNewComments { get; set; }


 

    public PublishSettings PublishSetting { get; set; }

 

    public DateTime? PublishDateTime { get; set; }


}

 

 

public class Post : UIHelperBase

 

{


// ???????????μ?????????

 

    public PostSettings Settings { get; private set; }


 

 

    // ???μ???? – ?????????

 

    public string Title { get { return selenium.Read(...); } }

 

// ?????????????????????


// ...

 

    public Post(TestLibrary settings?? PostSettings postSettings?? Blog blog)


        : base(settings)


    {

        Settings = postSettings;

        ContainerBlog = blog;


}

 

// ?????????????????????


// ...

 
}