public void Delete_EntityIsNull() { // Arrange var inMemory = new InMemory <TestEntity>(new Context(null)); // Act inMemory.Delete(null); // Assert }
public void TestCreate() { _inMemory.Create(_user); _inMemory.Update(_user); _inMemory.ReadAll(); _inMemory.ReadByUserId(_user.Id.ToString()); _inMemory.ReadByUserEmail("*****@*****.**"); _inMemory.Delete(_user); _inMemory.DeleteAll(); Assert.AreEqual(true, true); }
public void TestDelete() { //Arrange User user = new User("*****@*****.**"); InMemory actual = _harness; //Act _harness.Create(user); _harness.Delete(user); //Assert Assert.AreEqual(_harness.ToString(), actual.ToString()); }
public void Delete_Success() { // Arrange var mockDbSet = new Mock <DbSet <TestEntity> >(); mockDbSet.Setup(d => d.Remove(It.IsAny <TestEntity>())); var mockContext = new Mock <IContext>(); mockContext.Setup(c => c.Set <TestEntity>()).Returns(mockDbSet.Object); mockContext.Setup(c => c.SaveChanges()); var inMemory = new InMemory <TestEntity>(mockContext.Object); // Act inMemory.Delete(new TestEntity()); // Assert mockDbSet.Verify(d => d.Remove(It.IsAny <TestEntity>()), Times.Once); mockContext.Verify(c => c.Set <TestEntity>(), Times.Once); mockContext.Verify(c => c.SaveChanges(), Times.Once); }
public void TestDelete() { // Arrange var harness = new InMemory(); var expected = new Blab { Id = 1, CreatedBy = -1, CreatedDate = DateTime.Now, LastModifiedBy = null, LastModifiedDate = null, Message = "This is a really cool app!", UserId = 1 }; // Act harness.Create(expected); var blab = harness.Read(0); harness.Delete(blab); var actual = harness.Read(0); // Assert Assert.IsNull(actual); }
public static T Remove <T>(this Key key) => InMemory <T> .Delete(key.Value);