private void when_build_a_snapshot_component()
        {
            act = () => _actualComponents = _builder.Build();

            context["with a product project"] = () =>
            {
                before = () => { _projectResource.ProjectGroupId = ProductsProjectGroupId; };

                it["should not build a component"] = () => { _actualComponents.should_be_empty(); };
            };

            context["with a component project"] = () =>
            {
                before = () => { _projectResource.ProjectGroupId = ComponentsProjectGroupId; };

                act = () => _actualComponent = _actualComponents.Single();

                it["should build a component"] = () => { _actualComponents.should_not_be_empty(); };

                it["should build a component with expected project id"] =
                    () => { _actualComponent.ProjectId.should_be(ExpectedProjectId); };

                it["should build a component with expected project group name"] =
                    () => { _actualComponent.ProjectGroupName.should_be(ComponentsProjectGroupName); };

                it["should build a component with expected project name"] =
                    () => { _actualComponent.ProjectName.should_be(ExpectedProjectName); };
            };
        }
 private void before_each()
 {
     _versions       = A.Fake <IBuildSnapshotComponentVersions>(x => x.Strict());
     _builder        = new SnapshotStepBuilder(_versions);
     _component1     = new SnapshotComponent("Databases", "ProjectId", "ProjectGroupName");
     _component2     = new SnapshotComponent("WorkflowCookbooks", "ProjectId", "ProjectGroupName");
     _releaseId      = "Release01";
     _releaseVersion = "ReleaseVersion01";
 }
        private void before_each()
        {
            var environment      = A.Fake <ISnapshotEnvironment>(x => x.Strict());
            var repository       = A.Fake <IOctopusRepository>(x => x.Strict());
            var componentBuilder = A.Fake <IBuildSnapshotComponents>(x => x.Strict());

            _builder = new SnapshotComponentVersionBuilder(environment, repository, componentBuilder);

            var environmentId = "Env01";
            var projectId     = "Proj01";

            _releaseId      = "Release01";
            _releaseVersion = "ReleaseVersion01";

            A.CallTo(() => environment.Id).Returns(environmentId);

            _expectedComponent = new SnapshotComponent(projectId, "project name", "project group name");
            var components = new List <SnapshotComponent> {
                _expectedComponent
            };

            A.CallTo(() => componentBuilder.Build()).Returns(components);

            _itemResource = new DashboardItemResource
            {
                EnvironmentId  = environmentId,
                ProjectId      = projectId,
                ReleaseId      = _releaseId,
                ReleaseVersion = _releaseVersion
            };
            var dashboardResource = new DashboardResource
            {
                Items = new List <DashboardItemResource> {
                    _itemResource
                }
            };
            var dashboardRepository = A.Fake <IDashboardRepository>(x => x.Strict());

            A.CallTo(() => dashboardRepository.GetDashboard()).Returns(dashboardResource);
            A.CallTo(() => repository.Dashboards).Returns(dashboardRepository);
        }