public void Should_Construct_ConstructionWork() { ConstructionWork constructionWork = new ConstructionWork(); _ = constructionWork.ParentID; _ = constructionWork.NameAr; _ = constructionWork.NameEn; _ = constructionWork.ConstructionWorkId; _ = constructionWork.ParentWork; _ = constructionWork.SubWorks; _ = constructionWork.TenderConstructionWorks; constructionWork.ShouldNotBeNull(); }
public async Task CreateNewWorkAsync(ConstructionWorksInputModel input) { ConstructionCategory category = this.context.ConstructionCategories.SingleOrDefault(x => x.Name == input.ConstructionCategory); MetricsType metric = this.context.MetricsTypes.SingleOrDefault(x => x.Name == input.Metric); ConstructionWork work = new ConstructionWork() { Title = input.Title, Metric = metric, Price = input.Price, ConstructionCategory = category, }; await this.context.ConstructionWorks.AddAsync(work); await this.context.SaveChangesAsync(); }