public void Test() { _sagaState = new SoftwareProgrammingSagaState(Guid.NewGuid(), SoftwareProgrammingSaga.States.MakingCoffee); _sagaState.RememberPerson(Guid.NewGuid()); _sagaState.ClearEvents(); var data = DomainSerializer.Serialize(_sagaState); _restoredState = DomainSerializer.Deserialize <SoftwareProgrammingSagaState>(data); }
/// <summary> /// Gets the shell user info. /// </summary> /// <param name="userName">Name of the user.</param> /// <param name="passWord">The pass word.</param> /// <returns></returns> public ShellUserInfo GetShellUserInfo(string userName, string passWord) { var r = ShellDomainGenerator .CreateMockShellUserInfo(); var path = HostingEnvironment.MapPath(ShellConst.ShellUserInfoXmlPath); DomainSerializer <ShellUserInfo> .Serialize(r, path); return(r); }
public void DomainSerializerTest() { var serializer = new DomainSerializer(); var customerRepository = new CustomerRepository(); var customer = customerRepository.CreateNew(0, "No"); customer.MainAddress = new Address("1", "1", null, null, new Phone("!23", 1), null); customer.OtherAddresses.AddRange(new[] { new Address("2", "2", null, null, new Phone("9123", 1), null), new Address("3", "3", null, null, new Phone("123123", 1), null), }); var serializedCustomer = serializer.Serialize(customer); var customerCopy = serializer.Deserialize <Customer>(serializedCustomer); Assert.IsTrue(ObjectComparer.Default.DeepEquals(customer, customerCopy)); var invoiceRepository = new InvoiceRepository(); var invoice = invoiceRepository.Create(); var line = invoice.CreateNewLine(); line.Quantity = 0.5m; line.ProductId = 1; line.SetKey(1); line = invoice.CreateNewLine(); line.Quantity = 0.7m; line.ProductId = 2; line.SetKey(2); var serializedInvoice = serializer.Serialize(invoice); var invoiceCopy = serializer.Deserialize <Invoice>(serializedInvoice); Assert.IsTrue(ObjectComparer.Default.DeepEquals(invoice, invoiceCopy)); }
public void SaveBoutiqueOptions() { DomainSerializer <ObservableCollection <BoutiqueOption> > .Serialize(BoutiqueOptions, XmlConfigPath); }