Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions YA_UserRepositoryTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Text;
using Moq;
using NUnit.Framework;
using TestProject2.BL;

namespace TestProject2
{
[TestFixture]
public class UserTests
{
[Test]
public void Throw_Exception_When_User_Not_Exist_In_Current_Context()
{
var userRepository = new UserRepository();
Assert.That(() =>
{
userRepository.GetUserInfo(0);
}, Throws.Exception);
}
[Test]
public void Get_User_By_Id()
{
var mock = new Mock<IUserRepository>();
mock.Setup(x => x.GetUserInfo(It.IsAny<int>())).Returns(new User());
var actualUser = mock.Object.GetUserInfo(4);
Assert.NotNull(actualUser);
}
}
}