public async Task CreateShouldSucceed()
        {
            //Arrange
            var code   = "TestCode";
            var name   = "TestName";
            var source = "TestSource";

            var TypePlanning = new TypePlanning(Guid.NewGuid(), code, name, source);

            //Act
            await _repository.CreateAsync(TypePlanning);

            //Asssert
            var data = RepositoryHelper.ForTypePlanning.GetTypePlannings();

            data.Should().HaveCount(1);
            var result = data.First();

            result.Name.Should().Be(name);
            result.Code.Should().Be(code);
            result.Source.Should().Be(source);
        }
Ejemplo n.º 2
0
            public static TypePlanning CreateTypePlanning(string name, string description, string source)
            {
                // prepare
                var writeRepository = new TypePlanningWriteRepository(new DataContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)));
                var readRepository  = new TypePlanningReadRepository(new DataContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)));

                // create
                var typePlanning = new TypePlanning(Guid.NewGuid(), name, description, source);
                IEnumerable <TypePlanning> typePlannings = new List <TypePlanning>()
                {
                    typePlanning
                };

                typePlannings.ToList().ForEach(x => writeRepository.CreateAsync(x).GetAwaiter().GetResult());

                // result
                var result = readRepository.GetAsync(typePlanning.Id).Result;

                return(result);
            }