Exemple #1
0
        public void TestMethod_Update_NullEntity_Throws()
        {
            IDeskService service = _unityContainer.Resolve <IDeskService>();
            Action       act     = () => service.Update(null);

            AssertExtension.AssertInnerThrows <NullReferenceException>(act, "Nessuna eccezione di ritorno. Era attesa una NullReferenceException");
        }
Exemple #2
0
        public async Task TestMethod_Insert_NotThrows()
        {
            IDeskService    service    = _unityContainer.Resolve <IDeskService>();
            IDataUnitOfWork unitOfWork = _unityContainer.Resolve <IDataUnitOfWork>();

            Desk desk = CustomElements.CreateDeskModel();

            service.Create(desk);
            await unitOfWork.SaveChangesAsync();

            Desk deskSaved = service.Queryable().FirstOrDefault(f => f.UniqueId == CustomElements.DeskId);

            Assert.IsNotNull(deskSaved);
        }
Exemple #3
0
        public async Task TestMethod_Update_NotThrows()
        {
            IDeskService    service    = _unityContainer.Resolve <IDeskService>();
            IDataUnitOfWork unitOfWork = _unityContainer.Resolve <IDataUnitOfWork>();

            Desk desk = CustomElements.CreateDeskModel();

            service.Create(desk);
            await unitOfWork.SaveChangesAsync();

            Desk deskToUpdate = service.Queryable().FirstOrDefault(f => f.UniqueId == CustomElements.DeskId);

            deskToUpdate.Description = "Unit Test - Modifica";
            service.Update(deskToUpdate);
            await unitOfWork.SaveChangesAsync();

            Desk deskModified = service.Queryable().FirstOrDefault(f => f.UniqueId == CustomElements.DeskId);

            Assert.IsNotNull(deskModified);
            Assert.AreEqual("Unit Test - Modifica", deskModified.Description);
        }