This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class FrontEndServiceTests | |
{ | |
private Mock<IFriendRequestRepository> _friendRequestRepo; | |
private Mock<ISessionManager> _sessionManager; | |
private Mock<IUserRepository> _userRepo; | |
private Mock<IFriendRepository> _friendRepo; | |
[SetUp] | |
public void Init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
{ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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()) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Guard{ | |
public void IsNotNull(object o, string oname){ | |
if(null == o) throw ArgumentNullException(oname); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
{ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ObjectA OrchestratorMethodExample(Guid objectCReference, Guid objectBReference) | |
{ | |
var objectA = new ObjectAClass(); | |
_serviceX.ReferenceC = obectCReference; | |
_serviceX.ReferenceB = obectBReference; | |
_serviceX.SetSomeValue(objectA ) | |
return objectA; | |
} |
NewerOlder