public void TestMethodUpdate() { OptionInstance.ConfigAutomapper(); EmployeeRepo repo = new EmployeeRepo(@"Persist Security Info=False;Integrated Security=true;Initial Catalog=RJD.Test;Server=localhost"); // TODO: при указании миллисекунд, тест падает DateTime dateTime = new DateTime(2019, 8, 12, 20, 22, 59); var createDto = new EmployeeDto { Id = Guid.NewGuid(), Name = "Иван", Surname = "Иванов" }; repo.Create(createDto); createDto.BornDate = dateTime; repo.Update(createDto); var readDto = repo.Read(createDto.Id); Assert.AreEqual(readDto, createDto); }
/// <summary> /// Adds an option to this instance. /// </summary> /// <param name="newOption"> /// The new option. /// </param> /// <exception cref="System.ArgumentNullException"> /// <paramref name="newOption"/> is <c>null</c>. /// </exception> public void AddOption(OptionInstance newOption) { if (this.Options is null) { this.Options = new ProcessorOptions(newOption.AsEnumerableSingleton()); } else { this.Options = new ProcessorOptions( this.Options.Options.Concat(newOption), this.Options.Arguments); } }
static void Main(string[] args) { OptionInstance.ConfigAutomapper(); EmployeeRepo repo = new EmployeeRepo(@"Persist Security Info=False;Integrated Security=true;Initial Catalog=RJD;Server=localhost"); var createDto = new EmployeeDto { Id = Guid.NewGuid(), Name = "Иван", Surname = "Иванов" }; repo.Create(createDto); }
public void TestMethodCreate() { OptionInstance.ConfigAutomapper(); EmployeeRepo repo = new EmployeeRepo(@"Persist Security Info=False;Integrated Security=true;Initial Catalog=RJD.Test;Server=localhost"); var createDto = new EmployeeDto { Id = Guid.NewGuid(), Name = "Иван", Surname = "Иванов" }; repo.Create(createDto); var readDto = repo.Read(createDto.Id); Assert.AreEqual(readDto, createDto); }
public void TestMethodDelete() { OptionInstance.ConfigAutomapper(); EmployeeRepo repo = new EmployeeRepo(@"Persist Security Info=False;Integrated Security=true;Initial Catalog=RJD.Test;Server=localhost"); var createDto = new EmployeeDto { Id = Guid.NewGuid(), Name = "Иван", Surname = "Иванов", BornDate = new DateTime(2019, 8, 12, 20, 22, 59) }; repo.Create(createDto); bool isCreated = !repo.Read(createDto.Id).IsNull(); repo.Delete(createDto); var readDto = repo.Read(createDto.Id); Assert.IsTrue(isCreated && readDto.IsNull()); }
protected override void OnStartup(StartupEventArgs e) { OptionInstance.ConfigAutomapper(); base.OnStartup(e); }