Esempio n. 1
0
        public async Task DeleteMessageWorksCorrectlyIfDataIsRight()
        {
            // Arrange
            var db      = DatabaseInitializer.InitializeForInboxService();
            var service = new InboxService(db);

            // Act

            var result = await service.DeleteMessage("georgi", 1);

            //Assert
            result.Should().Be(true);
        }
Esempio n. 2
0
        public void DeleteMessage_WithId_ReturnsTrueWhenSuccessful()
        {
            // Arrange
            Guid id = Guid.NewGuid();

            RestResource resource = new InboxMessagesResource(id);

            RestResponse response = new RestResponse()
            {
                StatusCode = HttpStatusCode.OK
            };

            mockRestClient
            .Setup(rc => rc.Delete(resource))
            .Returns(response);

            // Act
            bool actualResult = service.DeleteMessage(id);

            // Assert
            Assert.IsTrue(actualResult);
        }
Esempio n. 3
0
        public async Task DeleteMessageReturnFalseNotExceptionIfDataIsWrong()
        {
            // Arrange
            var db      = DatabaseInitializer.InitializeForInboxService();
            var service = new InboxService(db);

            // Act

            var result = await service.DeleteMessage("georgi", 10);

            //Assert
            result.Should().Be(false);
        }