Пример #1
0
        public void TestAddNewActor_Returns_True()
        {
            ActorRepository actors = new ActorRepository();

            actors.Add(new Actor("Emilia", "Lviv", 5, 1));
            actors.Add(new Actor("John", "Lviv", 5, 3));
            actors.Add(new Actor("Billy", "Kyiv", 5, 10));

            bool result = actors.HasElement(new Actor("Emilia", "Lviv", 5, 1));

            //assert
            Assert.IsTrue(result);
        }
Пример #2
0
        public void TestSizeOfActorList_Returns_SizeList()
        {
            IRepository <Actor> actors = new ActorRepository();

            actors.Add(new Actor("Emilia", "Lviv", 5, 1));
            actors.Add(new Actor("John", "Lviv", 6, 3));
            actors.Add(new Actor("Billy", "Kyiv", 10, 10));

            int sizeActual   = actors.GetSizeArr();
            int sizeExpected = actors.Array().Count;

            //assert
            Assert.AreEqual(sizeActual, sizeExpected);
        }
Пример #3
0
        public void TestTheMostPopularActor_Returns_ActorwithTheBiggestRatting()
        {
            ActorRepository actors = new ActorRepository();

            actors.Add(new Actor("Emilia", "Lviv", 5, 1));
            actors.Add(new Actor("John", "Lviv", 5, 3));
            actors.Add(new Actor("Billy", "Kyiv", 5, 10));

            string thisResult = actors.PopularObjStr();

            string expectedResult = actors.ReturnActorInArrByIndex(2).ToString();

            //assert
            Assert.AreEqual(thisResult, expectedResult);
        }
Пример #4
0
        public IAsyncResult BeginGetOrderDetails(string customerId, string orderId, AsyncCallback callback, object state)
        {
            Guid requestId = CombGuid.Generate();

            var actor = new OrderDetailRequestActor(requestId);

            ActorRepository.Add(actor);

            AsyncCallback asyncCallback = ar =>
            {
                ActorRepository.Remove(actor);

                callback(ar);
            };

            IAsyncResult asyncResult = actor.BeginAction(asyncCallback, state);

            Bus.Endpoint.Send(new InitiateOrderDetailsRequest()
            {
                RequestId  = requestId,
                OrderId    = orderId,
                CustomerId = customerId,
            });

            return(asyncResult);
        }
Пример #5
0
        public void  TestRemoveActorByIndex_Returns_False()
        {
            ActorRepository actors = new ActorRepository();

            actors.Add(new Actor("Emilia", "Lviv", 5, 1));
            actors.Add(new Actor("John", "Lviv", 5, 3));
            actors.Add(new Actor("Billy", "Kyiv", 5, 10));

            actors.RemoveByIndex(1);// will be removed index=0

            Actor actorTemp = new Actor("Emilia", "Lviv", 5, 1);

            bool result = actors.IsExist(actorTemp);

            //assert
            Assert.IsFalse(result);
        }
Пример #6
0
 public ActionResult AddActor([Bind(Prefix = "Actor")] Actor item)
 {
     _acRep.Add(item);
     return(RedirectToAction("ActorList"));
 }
Пример #7
0
 public void AddActor(actor actor)
 {
     _actorRepository.Add(actor);
 }