Exemplo n.º 1
0
        private void when_create_a_task()
        {
            before = () =>
            {
                _snapshotStep         = new SnapshotStep();
                _expectedTaskResource = new TaskResource {
                    Id = "Task01"
                };
                var deploymentResource = new DeploymentResource {
                    TaskId = _expectedTaskResource.Id
                };
                A.CallTo(() => _deployments.Create(A <DeploymentResource> ._)).Returns(deploymentResource);
                A.CallTo(() => _tasks.Get(A <string> ._)).Returns(_expectedTaskResource);
            };

            act = () => { _actualTaskResource = _factory.Create(_snapshotStep, "Environment01"); };

            it["should return a task"] = () => { _actualTaskResource.should_be(_expectedTaskResource); };

            it["should create a deployment"] = () =>
            {
                A.CallTo(() => _deployments.Create(A <DeploymentResource> .That.Matches(x =>
                                                                                        x.ReleaseId == _snapshotStep.ReleaseId &&
                                                                                        x.ProjectId == _snapshotStep.ProjectId &&
                                                                                        x.EnvironmentId == "Environment01"
                                                                                        ))).MustHaveHappened();
            };
        }