public void StockAggregateQuotationsShouldBeUpdatedIfQuotationAlreadyExists() { var quotation = new Quotation(DateTime.Parse("2016-01-01 00:00:00"), DateTime.Now, 5, 10, 10, 5); var quotationNew = new Quotation(DateTime.Parse("2016-01-01 00:00:00"), DateTime.Now.AddDays(1), 55, 10, 10, 5); var aggregate = new StockAggregate(); aggregate.AddOrChangeQuotation(quotation); aggregate.AddOrChangeQuotation(quotationNew); var snapshot = aggregate.GetSnapshot() as StockAggregateSnapshot; snapshot.Quotations.Should().NotBeNull(); snapshot.Quotations.Should().HaveCount(1); snapshot.Quotations.FirstOrDefault().Open.Should().Be(55); }
public void StockAggregateQuotationShouldBeAdded() { var quotation = new Quotation(DateTime.Parse("2016-01-01 00:00:00"), DateTime.Now, 5, 10, 10, 5); var aggregate = new StockAggregate(); aggregate.AddOrChangeQuotation(quotation); var snapshot = aggregate.GetSnapshot() as StockAggregateSnapshot; snapshot.Quotations.Should().NotBeNull(); snapshot.Quotations.Should().HaveCount(1); snapshot.Quotations.FirstOrDefault().Open.Should().Be(5); }