-
CSharp example of using Rhino Mock constraints
What is Rhino Mock constraint? constraint help us to check that method arguments or properties values are matching with our criteria or not [ more info ].
Example Injecting dependencies into production code is not always easy and simple . Sometimes you come across with other scenarios such as below
public void SetupAndRegisterNewDevice(int id,string name) { Device device=new Device(){Id = id,Name = name}; _deviceManager.Add(device); _deviceManager.AddedSucessfully = true; _deviceManager.special = _deviceManager.
-
Csharp example of using Rhino AutoMocker Structuremap
What is AtuoMocker? Structuremap Automocker is an IOC container that help us to construct classes with all of its dependencies.you can download Structuremap via Nuget . [more info]
When using it ? Sometimes your class has too many dependencies and you don’t want to worry about them. Also it is useful when your classes’s constructor change frequently and you don’t want to break your tests.
Example In the code below we have Machine class which have two dependencies i.
-
Google Unofficial factors in SEO
Unofficial ranking factors are always argued between SEO experts. Some of them are totally rejected by search engine as a cheating, like “link farming” (Google, Link schemes, 2011), “clock threading” (Google, Cloaking, sneaky Javascript redirects, and dorway pages, 2011), “hidden text” (Google, Hidden text and links, 2011) and “automated queries” (Google, Automated queries, 2011) but still there are plenty of methods that never officially accepted or rejected by Google.
-
Head tags in SEO
Head tags Webmasters can use concise phrases when describing the content of a page via multiple HTML heading size tags such as “<h1>”, “<h2>” and “<h3>”. These are important to inform the search engine about the hierarchical structure of their website and their important texts. Heading tags are an important component of the website which help visitors to more easily navigate a website .They are visual signs to make visitors pay more attention to the content which underneath the heading text could be useful for them.
-
Optimise images in SEO
“ALT” attribute can help webmaster to provide image-related information for their pages (Google, Search Engine Optimization starter guide, 2010) (Google, Image publishing guidelines, 2011) (Linsley, 2009). Google suggests webmasters to put related content around their images using brief but descriptive text in the “ALT” attribute of their images. This will help Googlebots more easily distinguish the topic of their pages (Falls, Goradia, & Perez, 2010).
Figure 20: ALT attributes describe the image (Google, 2010)
-
C# example of hand mock test
What is hand mock ? You faking the dependency by implementing it in your test class and inject it to your production code .
Example Production code Imagine you have Machine class which have couple of dependency like below
Machin classC#
public class Machine { private readonly IPrinter _printer; private readonly IConfigureSystem _systemConfiguration; public Machine(IPrinter printer, IConfigureSystem systemConfiguration) { _printer = printer; _systemConfiguration = systemConfiguration; } } Then there is a Action method inside it , which check the type of passing action and do the appropriate action, like below
-
Anchor text in SEO
Anchor text is a clickable text that a user sees on a link (Google, Search Engine Optimization starter guide, 2010). The anchor text helps a website to describe its content to search engines and visitors. The number of relevant links to a webpage will show its usability and popularity (Google, BlogHer 2007: Building your audience, 2007) (Google, Search Engine Optimization starter guide, 2010).
Figure : Internal links help GoogleBots (randfish, 2007) Short but descriptive anchor text makes it easier for both Google and users to understand the content of the page while choosing off-topic anchor text which has no relation to the content of target page and is of no use.
-
Link structure in SEO
A website with a proper linking structure can help both Google and users to have better exploration experience and also help it to achieve a better visibility in search results ( Szymanski, Far, & Naumann, Sharing advice from our London site clinic, 2011).
Google uses mature text-matching algorithms to return pages which are both relevant and important for each search query and links are one of the most important factors which can get pages “authority” and “importance”.
-
importance of “content” in SEO
Creating unique and fresh content for users with relevant information helps Google to reach its goal, which is “give people the most relevant answers to their queries as quickly as possible” (Singhal & Cutts, Finding more high-quality sites in search, 2011).
Therefore, useful content is one of the most important signals that Google considers in its ranking algorithm. Users like good content and usually share them with others via social media, forums and email services.
-
Sitemap in SEO
Google in 2005 undertook an experiment i.e. “Sitemaps (Sitemaps, 2008) to make the web a better place for users and webmasters as it can help Google to improve the freshness and coverage of its index (Shivakumar, 2005).
Google (Google, About Sitemaps, 2011) suggested to the webmasters to use sitemaps if their websites has
Dynamic content Few links to it A large archive of content but are not links together properly Have pages that are not easily get crawled by Googlebot.