コード例 #1
0
        public void GetAddressByCode_AddressDoesNotExists_ReturnsNull()
        {
            var view = new GetAddressesView();

            view.Handle(null, _addressAddedToAssociationEvent);
            view.Handle(null, _codeAssignedToAddressEvent);

            view.GetAddressByCode("code123").ShouldBe(null);
        }
コード例 #2
0
        public void GetAddressCodes_AssociationExistsButCantFindAddress_ReturnsNull()
        {
            var view = new GetAddressesView();

            _addressAddedToAssociationEvent.Id = "address567";

            view.Handle(null, _addressAddedToAssociationEvent);

            view.GetAddressCodes("ass123", "address123").ShouldBe(null);
        }
コード例 #3
0
        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");
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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");
        }
コード例 #6
0
        public void GetAddressCodes_AssociationDoesNotExists_ReturnsNull()
        {
            var view = new GetAddressesView();

            view.GetAddressCodes("ass123", "address123").ShouldBe(null);
        }