Esempio n. 1
0
        public void AddComplaint_ReturnErrorMessage_WhenNullClient()
        {
            Client c      = null;
            var    CM     = new ComplaintManagement();
            var    result = CM.AddComplaint(c, exampleTopic, exmapleBody, exmapleFormOfCompensation);

            Assert.AreEqual("Client required", result);
        }
Esempio n. 2
0
        public void AddComplaint_ReturnErrorMessage_WhenEmptyTopic()
        {
            var c      = MakeStubClient();
            var CM     = new ComplaintManagement();
            var result = CM.AddComplaint(c, "", exmapleBody, exmapleFormOfCompensation);

            Assert.AreEqual("Topic and Body required", result);
        }
Esempio n. 3
0
        public void AddNewClientAndFind_ReturnClient_WhenExist()
        {
            var CM = new ComplaintManagement();

            CM.NewClient(exmapleName, exmapleSurname, exmapleNumber);

            Assert.IsNotNull(CM.FindClient(exmapleName, exmapleSurname, exmapleNumber));
        }
Esempio n. 4
0
        public void AddClient_ReturnFlase_WhenClienExist()
        {
            var CM = new ComplaintManagement();

            CM.NewClient(exmapleName, exmapleSurname, exmapleNumber);

            Assert.IsFalse(CM.NewClient(exmapleName, exmapleSurname, exmapleNumber));
        }
Esempio n. 5
0
        public void AddNewClient_Return1_WhenIsAddOneClient()
        {
            var CM = new ComplaintManagement();

            CM.NewClient(exmapleName, exmapleSurname, exmapleNumber);

            Assert.AreEqual(CM.Clients.Count, 1);
        }
Esempio n. 6
0
        async public Task <IHttpActionResult> AddNew(ComplaintManagement complaintManagement)
        {
            Db.ComplaintManagements.Add(complaintManagement);
            await Db.SaveChangesAsync();

            var ComId = (await Db.ComplaintManagements.FirstOrDefaultAsync(e => e.ProjectId == complaintManagement.ProjectId && e.ComplaintDate == complaintManagement.ComplaintDate && e.ComplaintEntertainedDate == complaintManagement.ComplaintEntertainedDate)).Id;

            return(Ok(ComId));
        }
Esempio n. 7
0
        public void AddComplaint_ReturnSuccessMessage_WhenCorrect()
        {
            var CM = new ComplaintManagement();
            var c  = MakeStubClient();

            var result = CM.AddComplaint(c, exampleTopic, exmapleBody, exmapleFormOfCompensation);

            StringAssert.Equals("Added Succesfully", result);
        }
Esempio n. 8
0
        public void DropClientStrings_ReturnFalase_WhenClientNotExist()
        {
            var CM = new ComplaintManagement();

            CM.NewClient(exmapleName, exmapleSurname, exmapleNumber);

            var result = CM.DropClient(exmapleName, exmapleSurname, "588214521");

            Assert.IsFalse(result);
        }
Esempio n. 9
0
        public void AddComplaintObjects_ReturnTopic_WhenAdded()
        {
            var c         = MakeStubClient();
            var complaint = MakeStubComplaint();
            var CM        = new ComplaintManagement();

            var result = CM.AddComplaint(c, complaint);

            Assert.AreEqual(exampleTopic, CM.Complaints[0].Topic);
        }
Esempio n. 10
0
        public void AddComplaintObjects_ReturnSuccessMessage_WhenObjectIsCorrect()
        {
            var c         = MakeStubClient();
            var complaint = MakeStubComplaint();
            var CM        = new ComplaintManagement();

            var result = CM.AddComplaint(c, complaint);

            Assert.AreEqual("Added Succesfully", result);
        }
Esempio n. 11
0
        public void DropClient_ReturnFalase_WhenOneValueIsNull()
        {
            var CM = new ComplaintManagement();

            CM.NewClient(exmapleName, exmapleSurname, exmapleNumber);

            var result = CM.DropClient(exmapleName, exmapleSurname, null);

            Assert.IsFalse(result);
        }
Esempio n. 12
0
        public void DropUClientWithStrings_ReturnTrue_WhenStringsIsCorrect()
        {
            var CM = new ComplaintManagement();

            CM.NewClient(exmapleName, exmapleSurname, exmapleNumber);

            var result = CM.DropClient(exmapleName, exmapleSurname, exmapleNumber);

            Assert.IsTrue(result);
        }
Esempio n. 13
0
        public void DropClient_ReturnFalse_ObjectNull()
        {
            var    CM = new ComplaintManagement();
            Client c  = null;

            CM.NewClient(exmapleName, exmapleSurname, exmapleNumber);

            var result = CM.DropClient(c);

            Assert.IsFalse(result);
        }
Esempio n. 14
0
        public void DropClient_ReturnFalse_WhenOneValueIsDiferent()
        {
            var CM = new ComplaintManagement();
            var c  = MakeStubClient();

            CM.NewClient(exmapleName, exmapleSurname, "513888789");

            var result = CM.DropClient(c);

            Assert.IsFalse(result);
        }
Esempio n. 15
0
        public void DropClient_RetrunTrue_WhenClientExist()
        {
            var CM = new ComplaintManagement();
            var c  = MakeStubClient();

            CM.NewClient(exmapleName, exmapleSurname, exmapleNumber);

            var result = CM.DropClient(c);

            Assert.IsTrue(result);
        }
Esempio n. 16
0
        public void AddThreeClients_ReturnListClients_CheckifFourtContains_ExpectedNot()
        {
            var CM = new ComplaintManagement();

            for (int i = 0; i < 3; i++)
            {
                CM.Clients.Add(MakeStubClient(i.ToString(), exmapleSurname, exmapleNumber));
            }
            var notAdded = MakeStubClient(exmapleName, exmapleSurname, exmapleNumber);

            CollectionAssert.DoesNotContain(CM.Clients, notAdded);
        }
Esempio n. 17
0
        public void AddThreeClients_ReturnCount4_WhenAllIsAdded()
        {
            var CM = new ComplaintManagement();

            IClient[] cc = new StubIClient[4];
            for (int i = 0; i < 4; i++)
            {
                cc[i] = MakeStubClient(i.ToString(), exmapleSurname, exmapleNumber);
                CM.Clients.Add(cc[i]);
            }

            Assert.AreEqual(CM.Clients.Count, 4);
        }
Esempio n. 18
0
        public void AddThreeClients_ReturnListClients_WhenAllAddSuccessfully()
        {
            var CM = new ComplaintManagement();

            IClient[] cc = new StubIClient[3];
            for (int i = 0; i < 3; i++)
            {
                cc[i] = MakeStubClient(i.ToString(), exmapleSurname, exmapleNumber);
                CM.Clients.Add(cc[i]);
            }

            CollectionAssert.Contains(CM.Clients, cc[1]);
        }
Esempio n. 19
0
        public void AddClient_RetrunExceptions_WhenSomeValueIsNull()
        {
            var CM = new ComplaintManagement();

            CM.NewClient(exmapleName, null, exmapleNumber);
        }
Esempio n. 20
0
        public void FindClient_ReturnNull_WhenEmptyListClients()
        {
            var CM = new ComplaintManagement();

            Assert.IsNull(CM.FindClient(exmapleName, exmapleSurname, exmapleNumber));
        }
Esempio n. 21
0
        public void MakeNewObjectComplaintManagement_Return0_WhenListComplaintsIsEmpty()
        {
            var CM = new ComplaintManagement();

            Assert.AreEqual(0, CM.Complaints.Count);
        }