コード例 #1
0
ファイル: DeleteTests.cs プロジェクト: fzany/DevContact
        public void Remove_Existing_Guid_Ensure_Removal()
        {
            // Arrange
            string knownGuid = "5c1911e0d41c4a400480c864";

            // Act
            //Fetch all User count.
            ActionResult <UserResponses> okResult = control.TestGetAll();
            int count1 = ((UserResponses)((OkObjectResult)okResult.Result).Value).Data.Count();

            //Delete a single user
            ActionResult <GeneralResponse> okResponse = control.Delete(knownGuid);

            //Assert
            Assert.IsType <OkObjectResult>(okResponse.Result);

            //Get the count again
            okResult = control.TestGetAll();
            int count2 = ((UserResponses)((OkObjectResult)okResult.Result).Value).Data.Count();

            // Assert
            Assert.Equal(count1, count2 + 1);
        }
コード例 #2
0
ファイル: FetchTests.cs プロジェクト: fzany/DevContact
        public void All_Users_Returns_Ok_Result()
        {
            // Act
            ActionResult <UserResponses> okResult = control.TestGetAll();

            // Assert
            Assert.IsType <OkObjectResult>(okResult.Result);

            UserResponses user_test = (UserResponses)((OkObjectResult)okResult.Result).Value;

            //Assert list is type <List<User>
            Assert.IsType <List <User> >(user_test.Data);

            //Assert list is not empty
            Assert.NotEmpty(user_test.Data);
        }