Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace MyNamespace
- {
- [SetUpFixture]
- public class MySetUpClass
- {
- [SetUp]
- public void GlobalInit()
- {
- //Code placed here is going to be executed once per group of fixtures (group of fixtures = fixtures in the same namespace).
- }
- [TearDown]
- public void GlobalDispose()
- {
- //Code placed here is going to be executed once per group of fixtures (group of fixtures = fixtures in the same namespace).
- }
- }
- [TestFixture]
- public class UserTests
- {
- [TestFixtureSetUp]
- public void GeneralInit()
- {
- //Code placed here is going to be executed once per fixture.
- }
- [TestFixtureTearDown]
- public void GeneralDispose()
- {
- //Code placed here is going to be executed once per fixture.
- }
- [SetUp]
- public void Init()
- {
- //Code placed here going to be executed once per test.
- }
- [TearDown]
- public void Dispose()
- {
- //Code placed here going to be executed once per test.
- }
- [Test]
- public void Authenticate_WithoutPassword_ReturnsFailedState()
- {
- //Arrange
- var queryableExpectedResult = Enumerable.Empty<UserDTO>().AsQueryable();
- var userRepositoryStub = new Mock<IUserRepository>();
- userRepositoryStub.Setup(x => x.GetUsersByUsernameAndPassword(It.IsAny<string>(), It.IsAny<string>()))
- .Returns(queryableExpectedResult);
- var userService = new UserService(userRepositoryStub.Object) { Username = "admin2", Password = "" };
- //Act, Assert
- Assert.IsFalse(userService.Authenticate());
- }
- }
- }
Add Comment
Please, Sign In to add comment