public void Connection_Connect_Behaviour_ConnectTwice()
        {
            User dummy = new User() { Name = "Crash Test Dummy", Password = "******" };
            PieServiceClient pieService = new PieServiceClient();

            pieService.Connect(dummy);
            pieService.Connect(dummy);
            //It's okay for a user to connect twice
        }
 public void Connection_Connect_Parameter_Null()
 {
     PieServiceClient pieService = new PieServiceClient();
     try
     {
         pieService.Connect(null);
         Assert.Fail("Was able to connect a null-user");
     }
     catch (Exception e)
     {
         if (!e.Message.Contains("Value cannot be null"))
             Assert.Fail(e.Message);
     }
 }
        public void Connection_Connect_Parameter_UnknownUserName()
        {
            User dummy = new User() { Name = "Unknown Crash Test Dummy", Password = "******" };
            PieServiceClient pieService = new PieServiceClient();

            try
            {
                pieService.Connect(dummy);
                Assert.Fail("Was able to connect a user that does not exist");
            }
            catch (Exception e)
            {
                if (!e.Message.Contains("Unknown user or password"))
                    Assert.Fail(e.Message);
            }
        }
        public void Connection_PushVersion_Parameter_UserPasswordNull()
        {
            User dummy = new User() { Name = "Crash Test Dummy", Password = "******" };
            int versionNumber = 1;

            PieServiceClient pieService = new PieServiceClient();

            pieService.Connect(dummy);

            string[] changes = new string[]{AbstractChange.ItemCreationMark + "SomeFileName.txt",
                                            AbstractChange.BlockSeparatorMark,
                                            AbstractChange.LineInsertionMark + "0" + AbstractChange.LineInsertionMark + "This is inserted",
                                            AbstractChange.BlockSeparatorMark};

            dummy.Password = null;

            try
            {
                pieService.PushVersion("", versionNumber, changes, dummy);
                Assert.Fail("Possible to submit changes when user's password is null");
            }
            catch (Exception e)
            {
                if (!e.Message.Contains("User's password is invalid"))
                    Assert.Fail(e.Message);
            }
        }
        public void Connection_PushVersion_Parameter_ChangesNull()
        {
            User dummy = new User() { Name = "Crash Test Dummy", Password = "******" };
            int versionNumber = 1;

            PieServiceClient pieService = new PieServiceClient();

            pieService.Connect(dummy);

            string[] changes = null;

            try
            {
                pieService.PushVersion("", versionNumber, changes, dummy);
                Assert.Fail("Possible to submit changes when null");
            }
            catch (Exception e)
            {
                if (!e.Message.Contains("Value cannot be null"))
                    Assert.Fail(e.Message);
            }
        }
        public void Connection_Disconnect_Parameter_UserWithNullPassword()
        {
            User user = new User() { Name = "Crash Test Dummy", Password = "******" };
            PieServiceClient pieService = new PieServiceClient();

            pieService.Connect(user);
            user.Password = null;
            try
            {
                pieService.Disconnect(user);
                Assert.Fail("Was able to disconnect a user with a null-password");
            }
            catch (Exception e)
            {
                if (!e.Message.Contains("Invalid string for username or password"))
                    Assert.Fail(e.Message);
            }
        }
        public void Connection_Disconnect_Parameter_User()
        {
            User user = new User() { Name = "Crash Test Dummy", Password = "******" };
            PieServiceClient pieService = new PieServiceClient();

            pieService.Connect(user);
            pieService.Disconnect(user);
        }
        public void Connection_Disconnect_Behaviour_DisconnectTwice()
        {
            User dummy = new User() { Name = "Crash Test Dummy", Password = "******" };
            PieServiceClient pieService = new PieServiceClient();

            pieService.Connect(dummy);

            pieService.Disconnect(dummy);
            pieService.Disconnect(dummy);
        }
        public void Connection_Connect_Parameter_WrongPassword()
        {
            User dummy = new User() { Name = "Crash Test Dummy", Password = "******" };
            PieServiceClient pieService = new PieServiceClient();

            try
            {
                pieService.Connect(dummy);
                Assert.Fail("Was able to connect a user with a wrong password");
            }
            catch (Exception e)
            {
                if (!e.Message.Contains("Unknown user or password"))
                    Assert.Fail(e.Message);
            }
        }
Example #10
0
 public void Connection_Connect_Parameter_UserWithNullName()
 {
     User dummy = new User() { Name = null, Password = "******" };
     PieServiceClient pieService = new PieServiceClient();
     try
     {
         pieService.Connect(dummy);
         Assert.Fail("Was able to connect a user was null-name");
     }
     catch (Exception e)
     {
         if (!e.Message.Contains("Invalid string for username or password"))
             Assert.Fail(e.Message);
     }
 }
Example #11
0
        public void Connection_Connect_Parameter_UserWithEmptyPassword()
        {
            User dummy = new User() { Name = "Crash Test Dummy", Password = "" };
            PieServiceClient pieService = new PieServiceClient();

            try
            {
                pieService.Connect(dummy);
                Assert.Fail("Was able to connect a user with an empty password");
            }
            catch (Exception e)
            {
                if (!e.Message.Contains("Invalid string for username or password"))
                    Assert.Fail(e.Message);
            }
        }