public void TestThatConstructorInitializeHouseholdMemberDataGetQueryHandler()
        {
            var householdDataRepositoryMock = MockRepository.GenerateMock <IHouseholdDataRepository>();
            var claimValueProviderMock      = MockRepository.GenerateMock <IClaimValueProvider>();
            var objectMapperMock            = MockRepository.GenerateMock <IFoodWasteObjectMapper>();

            var householdMemberDataGetQueryHandler = new HouseholdMemberDataGetQueryHandler(householdDataRepositoryMock, claimValueProviderMock, objectMapperMock);

            Assert.That(householdMemberDataGetQueryHandler, Is.Not.Null);
            Assert.That(householdMemberDataGetQueryHandler.ShouldBeActivated, Is.True);
            Assert.That(householdMemberDataGetQueryHandler.ShouldHaveAcceptedPrivacyPolicy, Is.True);
            Assert.That(householdMemberDataGetQueryHandler.RequiredMembership, Is.EqualTo(Membership.Basic));
        }
        public void TestThatGetDataThrowsArgumentNullExceptionWhenQueryIsNull()
        {
            var householdDataRepositoryMock = MockRepository.GenerateMock <IHouseholdDataRepository>();
            var claimValueProviderMock      = MockRepository.GenerateMock <IClaimValueProvider>();
            var objectMapperMock            = MockRepository.GenerateMock <IFoodWasteObjectMapper>();

            var householdMemberDataGetQueryHandler = new HouseholdMemberDataGetQueryHandler(householdDataRepositoryMock, claimValueProviderMock, objectMapperMock);

            Assert.That(householdMemberDataGetQueryHandler, Is.Not.Null);

            var exception = Assert.Throws <ArgumentNullException>(() => householdMemberDataGetQueryHandler.GetData(DomainObjectMockBuilder.BuildHouseholdMemberMock(), null, DomainObjectMockBuilder.BuildTranslationInfoMock()));

            Assert.That(exception, Is.Not.Null);
            Assert.That(exception.ParamName, Is.Not.Null);
            Assert.That(exception.ParamName, Is.Not.Empty);
            Assert.That(exception.ParamName, Is.EqualTo("query"));
            Assert.That(exception.InnerException, Is.Null);
        }
        public void TestThatGetDataReturnsHouseholdMember()
        {
            var fixture = new Fixture();
            var householdDataRepositoryMock = MockRepository.GenerateMock <IHouseholdDataRepository>();
            var claimValueProviderMock      = MockRepository.GenerateMock <IClaimValueProvider>();
            var objectMapperMock            = MockRepository.GenerateMock <IFoodWasteObjectMapper>();

            var householdMemberMock = DomainObjectMockBuilder.BuildHouseholdMemberMock();

            var householdMemberDataGetQueryHandler = new HouseholdMemberDataGetQueryHandler(householdDataRepositoryMock, claimValueProviderMock, objectMapperMock);

            Assert.That(householdMemberDataGetQueryHandler, Is.Not.Null);

            var result = householdMemberDataGetQueryHandler.GetData(householdMemberMock, fixture.Create <HouseholdMemberDataGetQuery>(), DomainObjectMockBuilder.BuildTranslationInfoMock());

            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.EqualTo(householdMemberMock));
        }
        public void TestThatGetDataCallsTranslateOnHouseholdMember()
        {
            var fixture = new Fixture();
            var householdDataRepositoryMock = MockRepository.GenerateMock <IHouseholdDataRepository>();
            var claimValueProviderMock      = MockRepository.GenerateMock <IClaimValueProvider>();
            var objectMapperMock            = MockRepository.GenerateMock <IFoodWasteObjectMapper>();

            var householdMemberMock = DomainObjectMockBuilder.BuildHouseholdMemberMock();
            var translationInfoMock = DomainObjectMockBuilder.BuildTranslationInfoMock();

            var householdMemberDataGetQueryHandler = new HouseholdMemberDataGetQueryHandler(householdDataRepositoryMock, claimValueProviderMock, objectMapperMock);

            Assert.That(householdMemberDataGetQueryHandler, Is.Not.Null);

            householdMemberDataGetQueryHandler.GetData(householdMemberMock, fixture.Create <HouseholdMemberDataGetQuery>(), translationInfoMock);

            householdMemberMock.AssertWasCalled(m => m.Translate(Arg <CultureInfo> .Is.Equal(translationInfoMock.CultureInfo), Arg <bool> .Is.Equal(false), Arg <bool> .Is.Equal(true)));
        }