Exemplo n.º 1
0
        public void CourseImplementation_StartDay_ImplementationOrder()
        {
            // Arrange
            CourseImplementation implementation = new CourseImplementation
            {
                Days = new DateTime[]
                {
                    new DateTime(2016, 12, 7),
                    new DateTime(2016, 12, 6),
                    new DateTime(2016, 12, 8),
                    new DateTime(2016, 12, 5),
                }
            };

            // Assert
            Assert.AreEqual(new DateTime(2016, 12, 5), implementation.StartDay);
        }
Exemplo n.º 2
0
        public async Task E_Possivel_Realizar_CRUD_Course()
        {
            using (var context = _serviceProvide.GetService <MyContext>())
            {
                CourseImplementation _repositorio = new CourseImplementation(context);
                CourseEntity         _entity      = new CourseEntity
                {
                    Name             = Faker.Name.FullName(),
                    Capacity         = 5,
                    NumberOfStudents = 0
                };

                var _registroCriado = await _repositorio.InsertAsync(_entity);

                Assert.NotNull(_registroCriado);
                Assert.Equal(_entity.Name, _registroCriado.Name);
                Assert.False(_registroCriado.Id == Guid.Empty);

                _entity.Name = Faker.Name.First();
                var _registroAtualizado = await _repositorio.UpdateAsync(_entity);

                Assert.NotNull(_registroAtualizado);
                Assert.Equal(_entity.Name, _registroAtualizado.Name);

                var _registroExiste = await _repositorio.ExistAsync(_registroAtualizado.Id);

                Assert.True(_registroExiste);

                var _registroSelecionado = await _repositorio.SelectAsync(_registroAtualizado.Id);

                Assert.NotNull(_registroSelecionado);
                Assert.Equal(_registroAtualizado.Name, _registroSelecionado.Name);

                var _todosRegistros = await _repositorio.SelectAsync();

                Assert.NotNull(_todosRegistros);
                Assert.True(_todosRegistros.Count() > 1);

                var _removeu = await _repositorio.DeleteAsync(_registroSelecionado.Id);

                Assert.True(_removeu);
            }
        }