Skip to content

Instantly share code, notes, and snippets.

public class Example
{
private IFeedRepository feedRepo;
private FeedRepos _feedRepos;
public Example(IPhotoAlbumRepository photoAlbumRepo, IUserTweetRepository userTweetRepo, IFriendRepository friendRepo, IFeedRepository feedRepo)
{
this.feedRepo = feedRepo;
var repoDictionary = new Dictionary<NSNType, IRepository>();
repoDictionary[NSNType.FRIEND] = friendRepo;
public IList<FeedItem> LoadFeedItems(int userId, int start, int size)
{
if (start < 0)
start = 0;
if (size < 1)
size = 5;
IList<Feed> feeds = feedRepo.GetUserFeeds(userId, start, size);
FeedManager feedManager = new FeedManager();
foreach (Feed feed in feeds)
{
[TestFixture]
public class FrontEndServiceTests
{
private Mock<IFriendRequestRepository> _friendRequestRepo;
private Mock<ISessionManager> _sessionManager;
private Mock<IUserRepository> _userRepo;
private Mock<IFriendRepository> _friendRepo;
[SetUp]
public void Init()
public FriendRequest AddRequestFriend(int friendUserId, string message)
{
User friendUser = userRepo.FindById(friendUserId);
if (friendUser == null)
{
throw new Exception("Cannot request not existed user.");
}
User myUser = sessionManager.GetUser();
if (friendUserId == myUser.UserId
|| friendRepo.IsFriend(myUser.UserId, friendUserId)
using System;
namespace Glimpse.Core.Extensibility
{
/// <summary>
/// The context passed into the <c>Setup</c> method of <see cref="IInspector"/>.
/// </summary>
public class InspectorContext : IInspectorContext
{
[TestFixture]
pubilc class GuardTess{
[Test]
pubilc void throws_exeption_when_null(){
Assert.Throws<ArgumentNullException>(()=> Guard.IsNotNull(null) );
}
[Test]
pubilc void does_not_throw_exeption_when_not_null(){
Assert.DoesNotThrow( Guard.IsNotNull(new object()) );
}
public class Guard{
public void IsNotNull(object o, string oname){
if(null == o) throw ArgumentNullException(oname);
}
}
using System;
namespace Glimpse.Core.Extensibility
{
/// <summary>
/// The context passed into the <c>Setup</c> method of <see cref="IInspector"/>.
/// </summary>
public class InspectorContext : IInspectorContext
{
using System;
using Glimpse.Core.Extensibility;
using Glimpse.Core.Framework;
using Glimpse.Core;
using Moq;
using Xunit;
namespace Glimpse.Test.Core.Framework
{
public class InspectorContextShould
public ObjectA OrchestratorMethodExample(Guid objectCReference, Guid objectBReference)
{
var objectA = new ObjectAClass();
_serviceX.ReferenceC = obectCReference;
_serviceX.ReferenceB = obectBReference;
_serviceX.SetSomeValue(objectA )
return objectA;
}