Example #1
0
        public void Test0020()
        {
            var testHelper = new TestHelper();

            testHelper.DeleteData(() =>
            {
                var tickerSymbol = "ABC";
                var fundName     = "My Mutual Fund";
                var currencyCode = "USD";

                var mutualFundEventTypeForCreate = new MutualFundEventTypeForCreate();

                var mutualFundCreateEvent = mutualFundEventTypeForCreate.CreateEvent(
                    new DateTime(2010, 1, 1),
                    tickerSymbol,
                    fundName,
                    new CurrencyCode(currencyCode));

                testHelper.InsertMutualFundDomainEvent(mutualFundCreateEvent);

                var mutualFundRepository = testHelper.CreateRepository();

                var mutualFundResult = mutualFundRepository.GetByTickerSymbol(tickerSymbol);

                Assert.True(mutualFundResult.HasValue);
                Assert.False(mutualFundResult.DoesNotHaveValue);
                Assert.Equal(tickerSymbol, mutualFundResult.Value.TickerSymbol);
                Assert.Equal("My Mutual Fund", mutualFundResult.Value.Name);
                Assert.Equal("USD", mutualFundResult.Value.CurrencyCodeAsString);
            });
        }
Example #2
0
        public void Test0060()
        {
            var testHelper = new TestHelper();

            testHelper.DeleteData(() =>
            {
                var tickerSymbol = "ABC";
                var fundName     = "Original Fund Name";
                var currencyCode = "USD";

                var mutualFundEventTypeForCreate = new MutualFundEventTypeForCreate();

                var mutualFundCreateEvent = mutualFundEventTypeForCreate.CreateEvent(
                    new DateTime(2010, 1, 1),
                    tickerSymbol,
                    fundName,
                    new CurrencyCode(currencyCode));

                var mutualFund = mutualFundCreateEvent.Process();

                var mutualFundEventTypeForInceptionDateChange = new MutualFundEventTypeForInceptionDateChange();

                var mutualFundNameChangeEvent = mutualFundEventTypeForInceptionDateChange.CreateEvent(
                    new DateTime(2010, 1, 2),
                    new DateTime(2000, 1, 1),
                    mutualFund);

                // Insert name change first
                testHelper.InsertMutualFundDomainEvent(mutualFundNameChangeEvent);
                testHelper.InsertMutualFundDomainEvent(mutualFundCreateEvent);

                var mutualFundRepository = testHelper.CreateRepository();

                var mutualFundResult = mutualFundRepository.GetByTickerSymbol(tickerSymbol);

                Assert.True(mutualFundResult.HasValue);
                Assert.False(mutualFundResult.DoesNotHaveValue);
                Assert.Equal(tickerSymbol, mutualFundResult.Value.TickerSymbol);
                Assert.NotNull(mutualFundResult.Value);
                Assert.Equal(new DateTime(2000, 1, 1), mutualFundResult.Value.InceptionDate);
            });
        }