Exemple #1
0
        public void CreateNewUserInProjectShouldReturnServerNotValidAnswerException()
        {
            // arrange
            var postServiceMock = new Mock <IPostService>();

            postServiceMock.Setup(
                serv => serv.SendAndGetAnswer(It.IsAny <string>(), It.IsAny <Dictionary <string, string> >()))
            .Returns("actually not a valid answer");

            IRemoteAccountService remoteAccountService = new RemoteAccountService(postServiceMock.Object);

            // act & assert
            Assert.Throws <ServerNotValidAnswerException>(
                () => remoteAccountService.CreateNewUserInProject(new UserModel()));
        }
Exemple #2
0
        public void CreateNewUserInProjectShouldSucceed()
        {
            // arrange
            var postServiceMock = new Mock <IPostService>();

            postServiceMock.Setup(
                serv => serv.SendAndGetAnswer(It.IsAny <string>(), It.IsAny <Dictionary <string, string> >()))
            .Returns(new JsonObject {
                Result = JsonValues.UserCreatedInProject
            }.ToJson());

            IRemoteAccountService remoteAccountService = new RemoteAccountService(postServiceMock.Object);

            // act & assert
            remoteAccountService.CreateNewUserInProject(new UserModel());
        }