Beispiel #1
0
        public void ShouldNotFindInpection()
        {
            using (var context = InitAndGetDbContext())
            {
                //Arrange
                var repositori = new InspectionRepository(context);

                //Act
                Inspection result = repositori.Find(Guid.NewGuid());

                //Assert
                Assert.Null(result);
            }
        }
Beispiel #2
0
        public void ShouldRemoveInpection()
        {
            using (var context = InitAndGetDbContext())
            {
                //Arrange
                var repositori = new InspectionRepository(context);

                //Act
                repositori.Delete(testId);
                Inspection result = repositori.Find(testId);

                //Assert
                Assert.False(result.Active);
            }
        }
        public void ShouldCreateWithInspectorInpection()
        {
            using (var context = InitAndGetDbContext())
            {
                //Arrange
                var repositori = new InspectionRepository(context);

                Inspector Inspector1 = new Inspector()
                {
                    Name = "Inspector 1", Created = DateTime.Today
                };
                Inspection Inspection1 = new Inspection()
                {
                    Customer     = "Customer 1",
                    Address      = "Address 1",
                    Observations = "Observation 1",
                    Status       = Status.Done,
                    Created      = DateTime.Today
                };
                InspectionInspector relation1 = new InspectionInspector()
                {
                    InspectionDate = DateTime.Today.AddDays(-1), InspectionId = Inspection1.Id, InspectorId = Inspector1.Id
                };
                Inspection1.InspectionInspector = new List <InspectionInspector>()
                {
                    relation1
                };

                //Act
                repositori.Create(Inspection1);
                Inspection result = repositori.Find(Inspection1.Id);

                //Assert
                Assert.NotNull(result);
            }
        }
        public void ShouldCreateInpection()
        {
            using (var context = InitAndGetDbContext())
            {
                //Arrange
                var repositori = new InspectionRepository(context);

                Inspection Inspection1 = new Inspection()
                {
                    Customer     = "Customer 1",
                    Address      = "Address 1",
                    Observations = "Observation 1",
                    Status       = Status.Done,
                    Created      = DateTime.Today
                };

                //Act
                repositori.Create(Inspection1);
                Inspection result = repositori.Find(Inspection1.Id);

                //Assert
                Assert.NotNull(result);
            }
        }