public async Task PostType_TypeDetailsSelectionWithOrganisationId_RedirectsToCorrectControllerAction(OrganisationType type, string action)
        {
            // Arrange
            OrganisationData orgData = new OrganisationData
            {
                OrganisationType = type,
                Id = Guid.NewGuid()
            };

            IWeeeClient weeeClient = A.Fake<IWeeeClient>();
            A.CallTo(() => weeeClient.SendAsync(A<string>._, A<VerifyOrganisationExistsAndIncomplete>._))
                .Returns(true);
            A.CallTo(() => weeeClient.SendAsync(A<string>._, A<GetOrganisationInfo>._))
                .Returns(orgData);

            ISearcher<OrganisationSearchResult> organisationSearcher = A.Dummy<ISearcher<OrganisationSearchResult>>();

            OrganisationRegistrationController controller = new OrganisationRegistrationController(
                () => weeeClient,
                organisationSearcher);

            OrganisationTypeViewModel model = new OrganisationTypeViewModel(
                type,
                new Guid("35EFE82E-0706-4E80-8AFA-D81C4B58102A"));

            // Act
            ActionResult result = await controller.Type(model);

            // Assert
            var redirectToRouteResult = ((RedirectToRouteResult)result);

            Assert.Equal(action, redirectToRouteResult.RouteValues["action"]);
        }
        public async Task GetType_OrganisationIdIsValid_ReturnsOrganisationTypeViewModel()
        {
            // Arrange
            IWeeeClient weeeClient = A.Fake<IWeeeClient>();
            A.CallTo(() => weeeClient.SendAsync(A<string>._, A<VerifyOrganisationExistsAndIncomplete>._))
                .Returns(true);
            A.CallTo(() => weeeClient.SendAsync(A<string>._, A<GetOrganisationInfo>._))
                .Returns(new OrganisationData());

            ISearcher<OrganisationSearchResult> organisationSearcher = A.Dummy<ISearcher<OrganisationSearchResult>>();

            OrganisationRegistrationController controller = new OrganisationRegistrationController(
                () => weeeClient,
                organisationSearcher);

            // Act
            ActionResult result = await controller.Type(A.Dummy<string>(), A.Dummy<Guid>());

            // Assert
            var model = ((ViewResult)result).Model;
            Assert.IsType<OrganisationTypeViewModel>(model);
        }
        public async Task PostType_TypeDetailsSelectionWithoutOrganisationId_RedirectsToCorrectControllerAction(string selection, string action)
        {
            // Arrange
            IWeeeClient weeeClient = A.Dummy<IWeeeClient>();
            ISearcher<OrganisationSearchResult> organisationSearcher = A.Dummy<ISearcher<OrganisationSearchResult>>();

            OrganisationRegistrationController controller = new OrganisationRegistrationController(
                () => weeeClient,
                organisationSearcher);

            OrganisationTypeViewModel model = new OrganisationTypeViewModel();
            model.SelectedValue = selection;
            model.OrganisationId = null;

            // Act
            ActionResult result = await controller.Type(model);

            // Assert
            var redirectToRouteResult = ((RedirectToRouteResult)result);

            Assert.Equal(action, redirectToRouteResult.RouteValues["action"]);
        }
        public async Task GetType_OrganisationIdIsInvalid_ThrowsArgumentException()
        {
            // Arrange
            IWeeeClient weeeClient = A.Fake<IWeeeClient>();
            A.CallTo(() => weeeClient.SendAsync(A<string>._, A<VerifyOrganisationExistsAndIncomplete>._))
                .Returns(false);

            ISearcher<OrganisationSearchResult> organisationSearcher = A.Dummy<ISearcher<OrganisationSearchResult>>();

            OrganisationRegistrationController controller = new OrganisationRegistrationController(
                () => weeeClient,
                organisationSearcher);

            // Act
            Func<Task<ActionResult>> action = async () => await controller.Type(A.Dummy<string>(), A.Dummy<Guid>());

            // Assert
            await Assert.ThrowsAsync<ArgumentException>(action);
        }