public async Task Person_is_deleted() { var person = MockContext.Object.Persons.First(p => p.TaxCode == "taxcode1"); await PersonService.DeletePerson(person); MockSet.Verify(m => m.Remove(person), Times.Once); MockContext.Object.Persons.Count().ShouldBeEquivalentTo(1); MockContext.Verify(m => m.SaveChangesAsync(), Times.Once); }
public void ItExists() { // Arrange // Act var thing = Repository.Get(It.IsAny <int>()); // Assert Assert.Null(thing); MockSet.Verify(set => set.Find(It.IsAny <int>()), Times.Once); }
public async Task New_person_is_saved() { var person = new Person() { TaxCode = "taxcode3", Firstname = "firstname3", Surname = "surname3" }; await PersonService.AddPerson(person); MockSet.Verify(m => m.Add(person), Times.Once); MockContext.Object.Persons.Count().ShouldBeEquivalentTo(3); MockContext.Verify(m => m.SaveChangesAsync(), Times.Once); }