Skip to content

Commit

Permalink
Repository update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cwetanow committed Mar 2, 2017
1 parent e49764b commit 97595fe
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/Logs.Data.Tests/EfGenericRepositoryTests/UpdateTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Logs.Data.Contracts;
using Logs.Data.Tests.Fakes;
using Moq;
using NUnit.Framework;

namespace Logs.Data.Tests.EfGenericRepositoryTests
{
[TestFixture]
public class UpdateTests
{
[Test]
public void TestAdd_ShouldCallDbContextSetUpdated()
{
// Arrange
var mockedDbContext = new Mock<ILogsDbContext>();

var repository = new EfGenericRepository<FakeGenericRepositoryType>(mockedDbContext.Object);

var entity = new Mock<FakeGenericRepositoryType>();

// Act
repository.Update(entity.Object);

// Assert
mockedDbContext.Verify(c => c.SetUpdated(entity.Object), Times.Once);
}
}
}

0 comments on commit 97595fe

Please sign in to comment.