Example #1
0
        public async Task ScenarioFromBoardExtension_SearchTasksByProjectId()
        {
            // Arrange
            HttpResponseMessage fakeResponse = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent(JsonConvert.SerializeObject(this._fileContent), Encoding.UTF8, "application/json")
            };
            FakeCakeContext fakeCakeContext = new FakeCakeContext(logBehaviour: () => new FakeCakeLog());
            HttpClient      fakeClient      = new HttpClient(new FakeHttpMessageHandler(fakeResponse))
            {
                BaseAddress = new Uri("https://app.asana.com/api/1.0")
            };
            Asana board = new Asana(fakeClient)
            {
                ProjectId = this._projectId
            };

            // Act
            IEnumerable <IWorkItem> wits = await board.GetWorkItemsByProjectIdAsync();

            // Assert
            IEnumerable <Models.Task> concreteWits = wits.Select(wit => Assert.IsType <Models.Task>(wit)).ToList();

            for (int i = 0; i < this._workItems.Count(); i++)
            {
                Assert.Equal(this._workItems.ElementAt(i).Id, concreteWits.ElementAt(i).Id);
            }
        }