public void CanAddLocation() { IContactRepository sut = new MemoryContactRepository(); Contact added = sut.Add(new Contact { FirstName = FIRST_NAME, LastName = LAST_NAME }); var location = sut.AddLocation(added.Id, new Location { Address1 = ADDRESS1, Address2 = ADDRESS2, City = CITY, State = STATE, PostalCode = POSTAL_CODE }); sut[added.Id].Locations.Should().HaveCount(1); location.Address1.Should().BeEquivalentTo(ADDRESS1); location.Address2.Should().BeEquivalentTo(ADDRESS2); location.City.Should().BeEquivalentTo(CITY); location.State.Should().BeEquivalentTo(STATE); location.PostalCode.Should().BeEquivalentTo(POSTAL_CODE); }
public void CanBeConstructed() { Action act = () => { IContactRepository sut = new MemoryContactRepository(); sut.Should().BeAssignableTo <MemoryContactRepository>(); }; act.ShouldNotThrow(); }
public void CanRemove() { IContactRepository sut = new MemoryContactRepository(); Contact added = sut.Add(new Contact { FirstName = "Joe", LastName = "Blaugh" }); sut.Remove(added.Id); sut.All.Should().HaveCount(0); }
public void CanAdd() { IContactRepository sut = new MemoryContactRepository(); Contact added = sut.Add(new Contact { FirstName = "Joe", LastName = "Blaugh" }); sut.All.Should().HaveCount(1); sut[added.Id].FirstName.ShouldBeEquivalentTo("Joe"); sut[added.Id].LastName.ShouldBeEquivalentTo("Blaugh"); }
public void CanUpdate() { IContactRepository sut = new MemoryContactRepository(); Contact added = sut.Add(new Contact { FirstName = "Joe", LastName = "Blaugh" }); Contact updated = new Contact { Id = added.Id, FirstName = "Jane", LastName = "Daugh" }; sut.Update(updated); sut.All.Should().HaveCount(1); sut[added.Id].FirstName.ShouldBeEquivalentTo("Jane"); sut[added.Id].LastName.ShouldBeEquivalentTo("Daugh"); }
public void CanDeleteLocation() { IContactRepository sut = new MemoryContactRepository(); Contact added = sut.Add(new Contact { FirstName = FIRST_NAME, LastName = LAST_NAME }); var location = sut.AddLocation(added.Id, new Location { Address1 = ADDRESS1, Address2 = ADDRESS2, City = CITY, State = STATE, PostalCode = POSTAL_CODE }); sut.RemoveLocation(added.Id, location.Id); added.Locations.Should().HaveCount(0); }