public void TestThatMapDataMapsDataIntoProxy(bool withBodyTranslation) { foreach (StaticTextType staticTextTypeToTest in Enum.GetValues(typeof(StaticTextType)).Cast <StaticTextType>()) { IStaticTextProxy sut = CreateSut(); Assert.That(sut, Is.Not.Null); Guid staticTextIdentifier = Guid.NewGuid(); Guid subjectTranslationIdentifier = Guid.NewGuid(); Guid? bodyTranslationIdentifier = withBodyTranslation ? Guid.NewGuid() : (Guid?)null; MySqlDataReader dataReader = CreateMySqlDataReader(staticTextIdentifier, staticTextTypeToTest, subjectTranslationIdentifier, bodyTranslationIdentifier); IFoodWasteDataProvider dataProvider = CreateFoodWasteDataProvider(); sut.MapData(dataReader, dataProvider); Assert.That(sut.Identifier, Is.Not.Null); Assert.That(sut.Identifier, Is.EqualTo(staticTextIdentifier)); Assert.That(sut.Type, Is.EqualTo(staticTextTypeToTest)); Assert.That(sut.SubjectTranslationIdentifier, Is.EqualTo(subjectTranslationIdentifier)); if (withBodyTranslation) { Assert.That(sut.BodyTranslationIdentifier, Is.Not.Null); Assert.That(sut.BodyTranslationIdentifier, Is.EqualTo(bodyTranslationIdentifier)); } else { Assert.That(sut.BodyTranslationIdentifier, Is.Null); } dataReader.AssertWasCalled(m => m.GetString("StaticTextIdentifier"), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetInt16("StaticTextType"), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetString("SubjectTranslationIdentifier"), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetOrdinal("BodyTranslationIdentifier"), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.IsDBNull(Arg <int> .Is.Equal(3)), opt => opt.Repeat.Once()); if (withBodyTranslation) { dataReader.AssertWasCalled(m => m.GetString("BodyTranslationIdentifier"), opt => opt.Repeat.Once()); } else { dataReader.AssertWasNotCalled(m => m.GetString("BodyTranslationIdentifier")); } dataProvider.AssertWasNotCalled(m => m.Clone()); } }
public void TestThatCreateCreatesSystemProxy(bool hasProperties) { ISystemProxy sut = CreateSut(); Assert.That(sut, Is.Not.Null); int number = _fixture.Create <int>(); string title = _fixture.Create <string>(); int? properties = hasProperties ? _fixture.Create <int>() : (int?)null; MySqlDataReader dataReader = CreateMySqlDataReader(number, title, properties); ISystemProxy result = sut.Create(dataReader, CreateMySqlDataProvider(), "SystemNo", "Title", "Properties"); Assert.That(result, Is.Not.Null); Assert.That(result.Nummer, Is.EqualTo(number)); Assert.That(result.Titel, Is.EqualTo(title)); if (hasProperties) { Assert.That(result.Properties, Is.EqualTo(properties)); } else { Assert.That(result.Properties, Is.EqualTo(0)); } dataReader.AssertWasCalled(m => m.GetInt32(Arg <string> .Is.Equal("SystemNo")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetString(Arg <string> .Is.Equal("Title")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetOrdinal(Arg <string> .Is.Equal("Properties")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.IsDBNull(Arg <int> .Is.Equal(2)), opt => opt.Repeat.Once()); if (hasProperties) { dataReader.AssertWasCalled(m => m.GetInt32(Arg <string> .Is.Equal("Properties")), opt => opt.Repeat.Once()); } else { dataReader.AssertWasNotCalled(m => m.GetInt32(Arg <string> .Is.Equal("Properties"))); } }
public void TestThatCreateCreatesCalenderUserProxy(bool hasUserName) { IBrugerProxy sut = CreateSut(); Assert.That(sut, Is.Not.Null); int systemNo = _fixture.Create <int>(); int userId = _fixture.Create <int>(); string userName = hasUserName ? _fixture.Create <string>() : null; string name = _fixture.Create <string>(); string initials = _fixture.Create <string>(); MySqlDataReader dataReader = CreateMySqlDataReader(systemNo, userId, userName, name, initials); ISystemProxy systemProxy = MockRepository.GenerateMock <ISystemProxy>(); IMySqlDataProvider dataProvider = CreateMySqlDataProvider(systemProxy); IBrugerProxy result = sut.Create(dataReader, dataProvider, "UserId", "Initials", "Name", "UserName", "SystemNo", "Title", "Properties"); Assert.That(result, Is.Not.Null); Assert.That(result.System, Is.Not.Null); Assert.That(result.System, Is.EqualTo(systemProxy)); Assert.That(result.Id, Is.EqualTo(userId)); if (hasUserName) { Assert.That(result.UserName, Is.Not.Null); Assert.That(result.UserName, Is.Not.Empty); Assert.That(result.UserName, Is.EqualTo(userName)); } else { Assert.That(result.UserName, Is.Null); } Assert.That(result.Navn, Is.Not.Null); Assert.That(result.Navn, Is.Not.Empty); Assert.That(result.Navn, Is.EqualTo(name)); Assert.That(result.Initialer, Is.Not.Null); Assert.That(result.Initialer, Is.Not.Empty); Assert.That(result.Initialer, Is.EqualTo(initials)); dataReader.AssertWasCalled(m => m.GetInt32(Arg <string> .Is.Equal("UserId")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetOrdinal(Arg <string> .Is.Equal("UserName")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.IsDBNull(Arg <int> .Is.Equal(2)), opt => opt.Repeat.Once()); if (hasUserName) { dataReader.AssertWasCalled(m => m.GetString(Arg <string> .Is.Equal("UserName")), opt => opt.Repeat.Once()); } else { dataReader.AssertWasNotCalled(m => m.GetString(Arg <string> .Is.Equal("UserName"))); } dataReader.AssertWasCalled(m => m.GetString(Arg <string> .Is.Equal("Name")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetString(Arg <string> .Is.Equal("Initials")), opt => opt.Repeat.Once()); dataProvider.AssertWasCalled(m => m.Create( Arg <ISystemProxy> .Is.TypeOf, Arg <MySqlDataReader> .Is.Equal(dataReader), Arg <string[]> .Matches(e => e != null && e.Length == 3 && e[0] == "SystemNo" && e[1] == "Title" && e[2] == "Properties")), opt => opt.Repeat.Once()); }
public void TestAtMapDataMapperBrugeraftaleProxy(bool hasProperties) { IBrugeraftaleProxy sut = CreateSut(); Assert.That(sut, Is.Not.Null); int systemNo = _fixture.Create <int>(); int calId = _fixture.Create <int>(); int userId = _fixture.Create <int>(); int? properties = hasProperties ? _fixture.Create <int>() : (int?)null; MySqlDataReader dataReader = CreateMySqlDataReader(systemNo, calId, userId, properties); ISystemProxy systemProxy = MockRepository.GenerateMock <ISystemProxy>(); IAftaleProxy appointmentProxy = MockRepository.GenerateMock <IAftaleProxy>(); IBrugerProxy calenderUserProxy = MockRepository.GenerateMock <IBrugerProxy>(); IMySqlDataProvider dataProvider = CreateMySqlDataProvider(systemProxy, appointmentProxy, calenderUserProxy); sut.MapData(dataReader, dataProvider); Assert.That(sut.System, Is.Not.Null); Assert.That(sut.System, Is.EqualTo(systemProxy)); Assert.That(sut.Aftale, Is.Not.Null); Assert.That(sut.Aftale, Is.EqualTo(appointmentProxy)); Assert.That(sut.Bruger, Is.Not.Null); Assert.That(sut.Bruger, Is.EqualTo(calenderUserProxy)); if (hasProperties) { Assert.That(sut.Properties, Is.EqualTo(properties)); } else { Assert.That(sut.Properties, Is.EqualTo(0)); } dataReader.AssertWasCalled(m => m.GetOrdinal(Arg <string> .Is.Equal("Properties")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.IsDBNull(Arg <int> .Is.Equal(3)), opt => opt.Repeat.Once()); if (hasProperties) { dataReader.AssertWasCalled(m => m.GetInt32(Arg <string> .Is.Equal("Properties")), opt => opt.Repeat.Once()); } else { dataReader.AssertWasNotCalled(m => m.GetInt32(Arg <string> .Is.Equal("Properties"))); } dataProvider.AssertWasCalled(m => m.Create( Arg <ISystemProxy> .Is.TypeOf, Arg <MySqlDataReader> .Is.Equal(dataReader), Arg <string[]> .Matches(e => e != null && e.Length == 3 && e[0] == "SystemNo" && e[1] == "SystemTitle" && e[2] == "SystemProperties")), opt => opt.Repeat.Once()); dataProvider.AssertWasCalled(m => m.Create( Arg <IAftaleProxy> .Is.TypeOf, Arg <MySqlDataReader> .Is.Equal(dataReader), Arg <string[]> .Matches(e => e != null && e.Length == 10 && e[0] == "CalId" && e[1] == "Date" && e[2] == "FromTime" && e[3] == "ToTime" && e[4] == "AppointmentProperties" && e[5] == "Subject" && e[6] == "Note" && e[7] == "SystemNo" && e[8] == "SystemTitle" && e[9] == "SystemProperties")), opt => opt.Repeat.Once()); dataProvider.AssertWasCalled(m => m.Create( Arg <IBrugerProxy> .Is.TypeOf, Arg <MySqlDataReader> .Is.Equal(dataReader), Arg <string[]> .Matches(e => e != null && e.Length == 7 && e[0] == "UserId" && e[1] == "UserInitials" && e[2] == "UserFullname" && e[3] == "UserName" && e[4] == "SystemNo" && e[5] == "SystemTitle" && e[6] == "SystemProperties")), opt => opt.Repeat.Once()); }
public void TestThatCreateCreatesProxy(bool hasDescription) { IStorageProxy sut = CreateSut(); Assert.That(sut, Is.Not.Null); Guid identifier = Guid.NewGuid(); Guid householdIdentifier = Guid.NewGuid(); int sortOrder = GetLegalSortOrder(); Guid storageTypeIdentifier = Guid.NewGuid(); string description = hasDescription ? _fixture.Create <string>() : null; IRange <int> temperatureRange = DomainObjectMockBuilder.BuildIntRange(); int temperature = GetLegalTemperature(temperatureRange); DateTime creationTime = DateTime.Now; MySqlDataReader dataReader = CreateMySqlDataReader(identifier, householdIdentifier, sortOrder, storageTypeIdentifier, description, temperature, creationTime); HouseholdProxy householdProxy = BuildHouseholdProxy(); StorageTypeProxy storageTypeProxy = BuildStorageTypeProxy(temperatureRange: temperatureRange); IFoodWasteDataProvider dataProvider = CreateFoodWasteDataProvider(householdProxy, storageTypeProxy); // ReSharper disable StringLiteralTypo IStorageProxy result = sut.Create(dataReader, dataProvider, "StorageIdentifier", "HouseholdIdentifier", "SortOrder", "StorageTypeIdentifier", "Descr", "Temperature", "CreationTime", "HouseholdName", "HouseholdDescr", "HouseholdCreationTime", "StorageTypeSortOrder", "StorageTypeTemperature", "StorageTypeTemperatureRangeStartValue", "StorageTypeTemperatureRangeEndValue", "StorageTypeCreatable", "StorageTypeEditable", "StorageTypeDeletable"); // ReSharper restore StringLiteralTypo Assert.That(result, Is.Not.Null); Assert.That(result.Identifier, Is.Not.Null); Assert.That(result.Identifier, Is.EqualTo(identifier)); Assert.That(result.Household, Is.Not.Null); Assert.That(result.Household, Is.EqualTo(householdProxy)); Assert.That(result.SortOrder, Is.EqualTo(sortOrder)); Assert.That(result.StorageType, Is.Not.Null); Assert.That(result.StorageType, Is.EqualTo(storageTypeProxy)); if (string.IsNullOrWhiteSpace(description) == false) { Assert.That(result.Description, Is.Not.Null); Assert.That(result.Description, Is.Not.Empty); Assert.That(result.Description, Is.EqualTo(description)); } else { Assert.That(result.Description, Is.Null); } Assert.That(result.Temperature, Is.EqualTo(temperature)); Assert.That(result.CreationTime, Is.EqualTo(creationTime).Within(1).Milliseconds); dataReader.AssertWasCalled(m => m.GetString(Arg <string> .Is.Equal("StorageIdentifier")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetInt16(Arg <string> .Is.Equal("SortOrder")), opt => opt.Repeat.Once()); // ReSharper disable StringLiteralTypo dataReader.AssertWasCalled(m => m.GetOrdinal(Arg <string> .Is.Equal("Descr")), opt => opt.Repeat.Once()); // ReSharper restore StringLiteralTypo dataReader.AssertWasCalled(m => m.IsDBNull(Arg <int> .Is.Equal(4)), opt => opt.Repeat.Once()); if (string.IsNullOrWhiteSpace(description) == false) { dataReader.AssertWasCalled(m => m.GetString(Arg <int> .Is.Equal(4)), opt => opt.Repeat.Once()); } else { dataReader.AssertWasNotCalled(m => m.GetString(Arg <int> .Is.Equal(4))); } dataReader.AssertWasCalled(m => m.GetInt16(Arg <string> .Is.Equal("Temperature")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetMySqlDateTime(Arg <string> .Is.Equal("CreationTime")), opt => opt.Repeat.Once()); dataProvider.AssertWasNotCalled(m => m.Clone()); dataProvider.AssertWasCalled(m => m.Create( Arg <IHouseholdProxy> .Is.TypeOf, Arg <MySqlDataReader> .Is.Equal(dataReader), Arg <string[]> .Matches(e => e != null && e.Length == 4 && e[0] == "HouseholdIdentifier" && e[1] == "HouseholdName" && // ReSharper disable StringLiteralTypo e[2] == "HouseholdDescr" && // ReSharper restore StringLiteralTypo e[3] == "HouseholdCreationTime")), opt => opt.Repeat.Once()); dataProvider.AssertWasCalled(m => m.Create( Arg <IStorageTypeProxy> .Is.TypeOf, Arg <MySqlDataReader> .Is.Equal(dataReader), Arg <string[]> .Matches(e => e != null && e.Length == 8 && e[0] == "StorageTypeIdentifier" && e[1] == "StorageTypeSortOrder" && e[2] == "StorageTypeTemperature" && e[3] == "StorageTypeTemperatureRangeStartValue" && e[4] == "StorageTypeTemperatureRangeEndValue" && e[5] == "StorageTypeCreatable" && e[6] == "StorageTypeEditable" && e[7] == "StorageTypeDeletable")), opt => opt.Repeat.Once()); }
public void TestThatCreateCreatesCalenderUserProxy(bool hasProperties, bool hasNote) { IAftaleProxy sut = CreateSut(); Assert.That(sut, Is.Not.Null); int systemNo = _fixture.Create <int>(); int calId = _fixture.Create <int>(); DateTime fromDateTime = DateTime.Today.AddDays(_random.Next(1, 30)).AddHours(_random.Next(8, 16)).AddMinutes(_random.Next(0, 3) * 15); TimeSpan duration = new TimeSpan(0, 0, _random.Next(1, 3) * 15, 0); int? properties = hasProperties ? _fixture.Create <int>() : (int?)null; string subject = _fixture.Create <string>(); string note = hasNote ? _fixture.Create <string>() : null; MySqlDataReader dataReader = CreateMySqlDataReader(systemNo, calId, fromDateTime, duration, properties, subject, note); ISystemProxy systemProxy = MockRepository.GenerateMock <ISystemProxy>(); IMySqlDataProvider dataProvider = CreateMySqlDataProvider(systemProxy); IAftaleProxy result = sut.Create(dataReader, dataProvider, "CalId", "Date", "FromTime", "ToTime", "Properties", "Subject", "Note", "SystemNo", "SystemTitle", "SystemProperties"); Assert.That(result.System, Is.Not.Null); Assert.That(result.System, Is.EqualTo(systemProxy)); Assert.That(result.Id, Is.EqualTo(calId)); Assert.That(result.FraTidspunkt, Is.EqualTo(fromDateTime)); Assert.That(result.TilTidspunkt, Is.EqualTo(fromDateTime.Add(duration))); if (hasProperties) { Assert.That(result.Properties, Is.EqualTo(properties)); } else { Assert.That(result.Properties, Is.EqualTo(0)); } Assert.That(result.Emne, Is.Not.Null); Assert.That(result.Emne, Is.Not.Empty); Assert.That(result.Emne, Is.EqualTo(subject)); if (hasNote) { Assert.That(result.Notat, Is.Not.Null); Assert.That(result.Notat, Is.Not.Empty); Assert.That(result.Notat, Is.EqualTo(note)); } else { Assert.That(result.Notat, Is.Null); } dataReader.AssertWasCalled(m => m.GetInt32(Arg <string> .Is.Equal("CalId")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetMySqlDateTime(Arg <string> .Is.Equal("Date")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetTimeSpan(Arg <string> .Is.Equal("FromTime")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetTimeSpan(Arg <string> .Is.Equal("ToTime")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetOrdinal(Arg <string> .Is.Equal("Properties")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.IsDBNull(Arg <int> .Is.Equal(5)), opt => opt.Repeat.Once()); if (hasProperties) { dataReader.AssertWasCalled(m => m.GetInt32(Arg <string> .Is.Equal("Properties")), opt => opt.Repeat.Once()); } else { dataReader.AssertWasNotCalled(m => m.GetInt32(Arg <string> .Is.Equal("Properties"))); } dataReader.AssertWasCalled(m => m.GetOrdinal(Arg <string> .Is.Equal("Subject")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.IsDBNull(Arg <int> .Is.Equal(6)), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetString(Arg <string> .Is.Equal("Subject")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetOrdinal(Arg <string> .Is.Equal("Note")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.IsDBNull(Arg <int> .Is.Equal(7)), opt => opt.Repeat.Once()); if (hasNote) { dataReader.AssertWasCalled(m => m.GetString(Arg <string> .Is.Equal("Note")), opt => opt.Repeat.Once()); } else { dataReader.AssertWasNotCalled(m => m.GetString(Arg <string> .Is.Equal("Note"))); } dataProvider.AssertWasCalled(m => m.Create( Arg <ISystemProxy> .Is.TypeOf, Arg <MySqlDataReader> .Is.Equal(dataReader), Arg <string[]> .Matches(e => e != null && e.Length == 3 && e[0] == "SystemNo" && e[1] == "SystemTitle" && e[2] == "SystemProperties")), opt => opt.Repeat.Once()); dataProvider.AssertWasNotCalled(m => m.Clone()); }
public void TestThatMapDataMapsDataIntoProxy(StakeholderType stakeholderType, bool hasPaymentReceipt) { IPaymentProxy sut = CreateSut(); Assert.That(sut, Is.Not.Null); Guid paymentIdentifier = Guid.NewGuid(); Guid stakeholderIdentifier = Guid.NewGuid(); Guid dataProviderIdentifier = Guid.NewGuid(); DateTime paymentTime = DateTime.Now.AddDays(_random.Next(1, 7) * -1).AddMinutes(_random.Next(120, 240)); string paymentReference = _fixture.Create <string>(); byte[] paymentReceipt = hasPaymentReceipt ? _fixture.CreateMany <byte>(_random.Next(1024, 4096)).ToArray() : null; DateTime creationTime = DateTime.Now; MySqlDataReader dataReader = CreateMySqlDataReader(paymentIdentifier, stakeholderIdentifier, stakeholderType, dataProviderIdentifier, paymentTime, paymentReference, paymentReceipt, creationTime); DataProviderProxy dataProviderProxy = BuildDataProviderProxy(); HouseholdMemberProxy householdMemberProxy = BuildHouseholdMemberProxy(); IFoodWasteDataProvider dataProvider = CreateFoodWasteDataProvider(dataProviderProxy, householdMemberProxy); sut.MapData(dataReader, dataProvider); Assert.That(sut.Identifier, Is.Not.Null); Assert.That(sut.Identifier, Is.EqualTo(paymentIdentifier)); Assert.That(sut.Stakeholder, Is.Not.Null); Assert.That(sut.Stakeholder, Is.EqualTo(householdMemberProxy)); Assert.That(sut.DataProvider, Is.Not.Null); Assert.That(sut.DataProvider, Is.EqualTo(dataProviderProxy)); Assert.That(sut.PaymentTime, Is.EqualTo(paymentTime).Within(1).Milliseconds); Assert.That(sut.PaymentReference, Is.Not.Null); Assert.That(sut.PaymentReference, Is.Not.Empty); Assert.That(sut.PaymentReference, Is.EqualTo(paymentReference)); if (paymentReceipt != null) { Assert.That(sut.PaymentReceipt, Is.Not.Null); Assert.That(sut.PaymentReceipt, Is.Not.Empty); Assert.That(sut.PaymentReceipt, Is.EqualTo(paymentReceipt)); } else { Assert.That(sut.PaymentReceipt, Is.Null); } Assert.That(sut.CreationTime, Is.EqualTo(creationTime).Within(1).Milliseconds); dataReader.AssertWasCalled(m => m.GetString(Arg <string> .Is.Equal("PaymentIdentifier")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetInt32(Arg <string> .Is.Equal("StakeholderType")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetMySqlDateTime(Arg <string> .Is.Equal("PaymentTime")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetString(Arg <string> .Is.Equal("PaymentReference")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.GetOrdinal(Arg <string> .Is.Equal("PaymentReceipt")), opt => opt.Repeat.Once()); dataReader.AssertWasCalled(m => m.IsDBNull(Arg <int> .Is.Equal(6)), opt => opt.Repeat.Once()); if (paymentReceipt != null) { dataReader.AssertWasCalled(m => m.GetTextReader(Arg <int> .Is.Equal(6)), opt => opt.Repeat.Once()); } else { dataReader.AssertWasNotCalled(m => m.GetTextReader(Arg <int> .Is.Equal(6))); } dataReader.AssertWasCalled(m => m.GetMySqlDateTime(Arg <string> .Is.Equal("CreationTime")), opt => opt.Repeat.Once()); dataProvider.AssertWasNotCalled(m => m.Clone()); switch (stakeholderType) { case StakeholderType.HouseholdMember: dataProvider.AssertWasCalled(m => m.Create( Arg <IHouseholdMemberProxy> .Is.TypeOf, Arg <MySqlDataReader> .Is.Equal(dataReader), Arg <string[]> .Matches(e => e != null && e.Length == 8 && e[0] == "StakeholderIdentifier" && e[1] == "HouseholdMemberMailAddress" && e[2] == "HouseholdMemberMembership" && e[3] == "HouseholdMemberMembershipExpireTime" && e[4] == "HouseholdMemberActivationCode" && e[5] == "HouseholdMemberActivationTime" && e[6] == "HouseholdMemberPrivacyPolicyAcceptedTime" && e[7] == "HouseholdMemberCreationTime")), opt => opt.Repeat.Once()); break; default: throw new NotSupportedException($"The stakeholderType '{stakeholderType}' is not supported."); } dataProvider.AssertWasCalled(m => m.Create( Arg <IDataProviderProxy> .Is.TypeOf, Arg <MySqlDataReader> .Is.Equal(dataReader), Arg <string[]> .Matches(e => e != null && e.Length == 4 && e[0] == "DataProviderIdentifier" && e[1] == "DataProviderName" && e[2] == "DataProviderHandlesPayments" && e[3] == "DataProviderDataSourceStatementIdentifier")), opt => opt.Repeat.Once()); }