public static IInvoiceStatus MockSavedWithKey(this IInvoiceStatus entity, Guid key) { entity.Key = key; ((Entity)entity).AddingEntity(); entity.ResetDirtyProperties(); return(entity); }
private static string GetInvoiceStatusJson(IInvoiceStatus invoiceStatus) { return(JsonConvert.SerializeObject( new { key = invoiceStatus.Key, name = invoiceStatus.Name, alias = invoiceStatus.Alias, reportable = invoiceStatus.Reportable, active = invoiceStatus.Active, sortOrder = invoiceStatus.SortOrder }, Formatting.None)); }
/// <summary> /// Initializes a new instance of the <see cref="Invoice"/> class. /// </summary> /// <param name="invoiceStatus"> /// The invoice status. /// </param> /// <param name="billToAddress"> /// The bill to address. /// </param> /// <param name="lineItemCollection"> /// The line item collection. /// </param> /// <param name="orders"> /// The orders. /// </param> internal Invoice(IInvoiceStatus invoiceStatus, IAddress billToAddress, LineItemCollection lineItemCollection, OrderCollection orders) { Mandate.ParameterNotNull(invoiceStatus, "invoiceStatus"); Mandate.ParameterNotNull(billToAddress, "billToAddress"); Mandate.ParameterNotNull(lineItemCollection, "lineItemCollection"); Mandate.ParameterNotNull(orders, "orders"); _invoiceStatus = invoiceStatus; _billToName = billToAddress.Name; _billToAddress1 = billToAddress.Address1; _billToAddress2 = billToAddress.Address2; _billToLocality = billToAddress.Locality; _billToRegion = billToAddress.Region; _billToPostalCode = billToAddress.PostalCode; _billToCountryCode = billToAddress.CountryCode; _billToPhone = billToAddress.Phone; _items = lineItemCollection; _orders = orders; _invoiceDate = DateTime.Now; }
internal Invoice(IInvoiceStatus invoiceStatus, IAddress billToAddress, LineItemCollection lineItemCollection, OrderCollection orders) { Mandate.ParameterNotNull(invoiceStatus, "invoiceStatus"); Mandate.ParameterNotNull(billToAddress, "billToAddress"); Mandate.ParameterNotNull(lineItemCollection, "lineItemCollection"); Mandate.ParameterNotNull(orders, "orders"); _invoiceStatus = invoiceStatus; _billToName = billToAddress.Name; _billToAddress1 = billToAddress.Address1; _billToAddress2 = billToAddress.Address2; _billToLocality = billToAddress.Locality; _billToRegion = billToAddress.Region; _billToPostalCode = billToAddress.PostalCode; _billToCountryCode = billToAddress.CountryCode; _billToPhone = billToAddress.Phone; _items = lineItemCollection; _orders = orders; _invoiceDate = DateTime.Now; }
/// <summary> /// Initializes a new instance of the <see cref="Invoice"/> class. /// </summary> /// <param name="invoiceStatus"> /// The invoice status. /// </param> /// <param name="billToAddress"> /// The bill to address. /// </param> internal Invoice(IInvoiceStatus invoiceStatus, IAddress billToAddress) : this(invoiceStatus, billToAddress, new LineItemCollection(), new OrderCollection(), Enumerable.Empty<INote>().ToArray()) { }
/// <summary> /// Initializes a new instance of the <see cref="Invoice"/> class. /// </summary> /// <param name="invoiceStatus"> /// The invoice status. /// </param> internal Invoice(IInvoiceStatus invoiceStatus) : this(invoiceStatus, new Address()) { }
/// <summary> /// Initializes a new instance of the <see cref="Invoice"/> class. /// </summary> /// <param name="invoiceStatus"> /// The invoice status. /// </param> /// <param name="billToAddress"> /// The bill to address. /// </param> internal Invoice(IInvoiceStatus invoiceStatus, IAddress billToAddress) : this(invoiceStatus, billToAddress, new LineItemCollection(), new OrderCollection()) { }
/// <summary> /// Initializes a new instance of the <see cref="Invoice"/> class. /// </summary> /// <param name="invoiceStatus"> /// The invoice status. /// </param> /// <param name="billToAddress"> /// The bill to address. /// </param> internal Invoice(IInvoiceStatus invoiceStatus, IAddress billToAddress) : this(invoiceStatus, billToAddress, new LineItemCollection(), new OrderCollection()) { }
/// <summary> /// Initializes a new instance of the <see cref="Invoice"/> class. /// </summary> /// <param name="invoiceStatus"> /// The invoice status. /// </param> internal Invoice(IInvoiceStatus invoiceStatus) : this(invoiceStatus, new Address()) { }
protected override void Initialize() { _invoiceService = new InvoiceService(new MockUnitOfWorkProvider(), new RepositoryFactory()); _invoice = _invoiceService.CreateInvoice(_customer, _invoiceStatus, "test111", "name", "address1", "address2", "city", "state", "98225", "US", "*****@*****.**", string.Empty, string.Empty); Before = null; After = null; _beforeInvoice = null; _afterInvoice = null; _statusBefore = false; _statusAfter = false; _customer = MockCustomerDataMaker.CustomerForInserting().MockSavedWithKey(111); _invoiceStatus = MockInvoiceStatusDataMaker.InvoiceStatusUnpaidMock(); _anonymous = MockAnonymousCustomerDataMaker.AnonymousCustomerForInserting().MockSavedWithKey(Guid.NewGuid()); InvoiceService.Saving += delegate(IInvoiceService sender, SaveEventArgs <IInvoice> args) { BeforeTriggered = true; Before = args.SavedEntities.FirstOrDefault(); }; InvoiceService.Saved += delegate(IInvoiceService sender, SaveEventArgs <IInvoice> args) { AfterTriggered = true; After = args.SavedEntities.FirstOrDefault(); }; InvoiceService.Created += delegate(IInvoiceService sender, Core.Events.NewEventArgs <IInvoice> args) { AfterTriggered = true; After = args.Entity; }; InvoiceService.Deleting += delegate(IInvoiceService sender, DeleteEventArgs <IInvoice> args) { BeforeTriggered = true; Before = args.DeletedEntities.FirstOrDefault(); }; InvoiceService.Deleted += delegate(IInvoiceService sender, DeleteEventArgs <IInvoice> args) { AfterTriggered = true; After = args.DeletedEntities.FirstOrDefault(); }; InvoiceService.StatusChanging += delegate(IInvoiceService sender, StatusChangeEventArgs <IInvoice> args) { _statusBefore = true; _beforeInvoice = args.StatusChangedEntities; }; InvoiceService.StatusChanged += delegate(IInvoiceService sender, StatusChangeEventArgs <IInvoice> args) { _statusAfter = true; _afterInvoice = args.StatusChangedEntities; }; // General tests MockDatabaseUnitOfWork.Committed += delegate { CommitCalled = true; }; }
/// <summary> /// The get invoice status JSON. /// </summary> /// <param name="invoiceStatus"> /// The invoice status. /// </param> /// <returns> /// The <see cref="string"/>. /// </returns> private static string GetInvoiceStatusJson(IInvoiceStatus invoiceStatus) { return JsonConvert.SerializeObject( new { key = invoiceStatus.Key, name = invoiceStatus.Name, alias = invoiceStatus.Alias, reportable = invoiceStatus.Reportable, active = invoiceStatus.Active, sortOrder = invoiceStatus.SortOrder }, Formatting.None); }
/// <summary> /// Initializes a new instance of the <see cref="Invoice"/> class. /// </summary> /// <param name="invoiceStatus"> /// The invoice status. /// </param> /// <param name="billToAddress"> /// The bill to address. /// </param> internal Invoice(IInvoiceStatus invoiceStatus, IAddress billToAddress) : this(invoiceStatus, billToAddress, new LineItemCollection(), new OrderCollection(), Enumerable.Empty <INote>().ToArray()) { }