public void GetAddressByCode_AddressDoesNotExists_ReturnsNull() { var view = new GetAddressesView(); view.Handle(null, _addressAddedToAssociationEvent); view.Handle(null, _codeAssignedToAddressEvent); view.GetAddressByCode("code123").ShouldBe(null); }
public void GetAddressCodes_AssociationAndAddressExists_ReturnsListOfCodes() { var view = new GetAddressesView(); _addressAddedToAssociationEvent.Id = "address123"; _codeAssignedToAddressEvent.AddressId = "address123"; _codeAssignedToAddressEvent.Code = "code123"; view.Handle(null, _addressAddedToAssociationEvent); view.Handle(null, _codeAssignedToAddressEvent); view.GetAddressCodes("ass123", "address123").ShouldContain("code123"); }
public void GetAddressByCode_AddressHasBeenRemovedFromAssociation_ReturnsNull() { var view = new GetAddressesView(); _addressAddedToAssociationEvent.Id = "address123"; _codeAssignedToAddressEvent.AddressId = "address123"; _codeAssignedToAddressEvent.Code = "code123"; _addressRemovedFromAssociationEvent.Id = "address123"; view.Handle(null, _addressAddedToAssociationEvent); view.Handle(null, _codeAssignedToAddressEvent); view.Handle(null, _addressRemovedFromAssociationEvent); view.GetAddressByCode("code123").ShouldBe(null); }
public void GetAddressByCode_AddressExists_ReturnsAddressWithCodeAndAssociationId() { var view = new GetAddressesView(); _addressAddedToAssociationEvent.Id = "address123"; _codeAssignedToAddressEvent.AddressId = "address123"; _codeAssignedToAddressEvent.Code = "code123"; view.Handle(null, _addressAddedToAssociationEvent); view.Handle(null, _codeAssignedToAddressEvent); view.GetAddressByCode("code123").AssociationId.ShouldBe("ass123"); view.GetAddressByCode("code123").Codes.ShouldContain("code123"); view.GetAddressByCode("code123").Id.ShouldBe("address123"); }
public void GetAddressCodes_AssociationExistsButCantFindAddress_ReturnsNull() { var view = new GetAddressesView(); _addressAddedToAssociationEvent.Id = "address567"; view.Handle(null, _addressAddedToAssociationEvent); view.GetAddressCodes("ass123", "address123").ShouldBe(null); }